1var Nd=Object.defineProperty;var kd=(r,e,t)=>e in r?Nd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ye=(r,e,t)=>(kd(r,typeof e!="symbol"?e+"":e,t),t);import{v as bh,r as vh,s as ma,x as Bd,w as Is,y as Fd,z as ga,A as wh,B as Ud,C as Vd,D as Hd,E as Gd,G as Wd,H as Xd,j as Zd}from"./_plugin-vue_export-helper.f09dc1ee.js";import{A as Ge,d as Ie,T as rt,s as pn,h as In,O as Wa,U as jt,K as At,r as Qt,Q as xr,B as Nt,G as Ln,a as yr,g as jd,l as qd}from"./index.dfb0252e.js";let Yd=class{constructor(e){Ye(this,"disposables",[]);Ye(this,"inputs",{name:"",type:"image",textureSrc:null,visible:!0,aspectRatio:1});Ye(this,"events",{"INTERACTION.CLICK":!0,"INTERACTION.HOVER":!1});Ye(this,"emits",{planeEvents:!0});Ye(this,"onInit",()=>{const e=this.context.three;this.inputs.type=="video"?(this.element=document.createElement("video"),this.element.crossOrigin="anonymous",this.element.src=this.inputs.textureSrc,this.texture=new e.VideoTexture(this.element),this.texture.needsUpdate,this.texture.minFilter=e.LinearFilter,this.texture.magFilter=e.LinearFilter,this.texture.format=e.RGBAFormat,this.texture.crossOrigin="anonymous",this.element.loop=!1,this.element.addEventListener("error",()=>{console.error("Failed to load video.")}),this.element.addEventListener("canplay",()=>{console.log("vid ready to play"),this.mesh.material.visible=!0})):(this.texture=new e.TextureLoader().load(this.inputs.textureSrc),this.texture.minFilter=e.LinearFilter,this.texture.magFilter=e.LinearFilter,this.texture.anisotropy=this.context.renderer.capabilities.getMaxAnisotropy()),this.mesh=new e.Mesh(new e.PlaneGeometry(1,1),new e.MeshBasicMaterial({map:this.texture,transparent:!0,needsUpdate:!0,side:e.DoubleSide})),this.mesh.name=this.inputs.name,this.outputs.objectRoot=this.mesh,this.outputs.collider=this.mesh});this.onEvent=this.onEvent.bind(this),this.sdk=e,this.element,this.texture}onEvent(e,t){this.notify("planeEvents",t),(e="INTERACTION.CLICK")&&(console.log("plane Clicked notify"),t.input.type="click",this.notify("planeEvents",t),this.inputs.type=="video"&&(this.element.paused?(this.element.play(),this.element.muted=!1):(this.element.pause(),this.element.muted=!0))),e=="INTERACTION.HOVER"&&(t.hover==!0?this.sdk.Pointer.setVisible(!1):this.sdk.Pointer.setVisible(!0)),e=="INTERACTION.DRAG_BEGIN"&&this.inputs.type=="video"&&(this.element.paused?this.element.play():this.element.pause())}onInputsUpdated(){console.log("Inputs updated",this)}onDestroy(){this.outputs.collider=null,this.outputs.objectRoot=null,this.mesh.material.dispose(),this.mesh.geometry.dispose()}};const _r="mp.plane",Yl=function(r){return function(){return new Yd(r)}};var $d=!1;/*! 2 * pinia v2.0.28 3 * (c) 2022 Eduardo San Martin Morote 4 * @license MIT 5 */let Sh;const wa=r=>Sh=r,Mh=Symbol();function Eo(r){return r&&typeof r=="object"&&Object.prototype.toString.call(r)==="[object Object]"&&typeof r.toJSON!="function"}var Rs;(function(r){r.direct="direct",r.patchObject="patch object",r.patchFunction="patch function"})(Rs||(Rs={}));function Ab(){const r=bh(!0),e=r.run(()=>vh({}));let t=[],n=[];const i=ma({install(s){wa(i),i._a=s,s.provide(Mh,i),s.config.globalProperties.$pinia=i,n.forEach(a=>t.push(a)),n=[]},use(s){return!this._a&&!$d?n.push(s):t.push(s),this},_p:t,_a:null,_e:r,_s:new Map,state:e});return i}const Th=()=>{};function $l(r,e,t,n=Th){r.push(e);const i=()=>{const s=r.indexOf(e);s>-1&&(r.splice(s,1),n())};return!t&&Hd()&&Gd(i),i}function Ni(r,...e){r.slice().forEach(t=>{t(...e)})}function Po(r,e){r instanceof Map&&e instanceof Map&&e.forEach((t,n)=>r.set(n,t)),r instanceof Set&&e instanceof Set&&e.forEach(r.add,r);for(const t in e){if(!e.hasOwnProperty(t))continue;const n=e[t],i=r[t];Eo(i)&&Eo(n)&&r.hasOwnProperty(t)&&!ga(n)&&!wh(n)?r[t]=Po(i,n):r[t]=n}return r}const Jd=Symbol();function Kd(r){return!Eo(r)||!r.hasOwnProperty(Jd)}const{assign:Un}=Object;function Qd(r){return!!(ga(r)&&r.effect)}function ef(r,e,t,n){const{state:i,actions:s,getters:a}=e,o=t.state.value[r];let l;function c(){o||(t.state.value[r]=i?i():{});const u=Xd(t.state.value[r]);return Un(u,s,Object.keys(a||{}).reduce((f,p)=>(f[p]=ma(Zd(()=>{wa(t);const g=t._s.get(r);return a[p].call(g,g)})),f),{}))}return l=Ah(r,c,e,t,n,!0),l.$reset=function(){const f=i?i():{};this.$patch(p=>{Un(p,f)})},l}function Ah(r,e,t={},n,i,s){let a;const o=Un({actions:{}},t),l={deep:!0};let c,u,f=ma([]),p=ma([]),g;const x=n.state.value[r];!s&&!x&&(n.state.value[r]={}),vh({});let h;function d(C){let b;c=u=!1,typeof C=="function"?(C(n.state.value[r]),b={type:Rs.patchFunction,storeId:r,events:g}
5):(Po(n.state.value[r],C),b={type:Rs.patchObject,payload:C,storeId:r,events:g});const w=h=Symbol();Wd().then(()=>{h===w&&(c=!0)}),u=!0,Ni(f,b,n.state.value[r])}const m=Th;function v(){a.stop(),f=[],p=[],n._s.delete(r)}function y(C,b){return function(){wa(n);const w=Array.from(arguments),P=[],T=[];function F(U){P.push(U)}function B(U){T.push(U)}Ni(p,{args:w,name:C,store:S,after:F,onError:B});let R;try{R=b.apply(this&&this.$id===r?this:S,w)}catch(U){throw Ni(T,U),U}return R instanceof Promise?R.then(U=>(Ni(P,U),U)).catch(U=>(Ni(T,U),Promise.reject(U))):(Ni(P,R),R)}}const _={_p:n,$id:r,$onAction:$l.bind(null,p),$patch:d,$reset:m,$subscribe(C,b={}){const w=$l(f,C,b.detached,()=>P()),P=a.run(()=>Is(()=>n.state.value[r],T=>{(b.flush==="sync"?u:c)&&C({storeId:r,type:Rs.direct,events:g},T)},Un({},l,b)));return w},$dispose:v},S=Fd(_);n._s.set(r,S);const M=n._e.run(()=>(a=bh(),a.run(()=>e())));for(const C in M){const b=M[C];if(ga(b)&&!Qd(b)||wh(b))s||(x&&Kd(b)&&(ga(b)?b.value=x[C]:Po(b,x[C])),n.state.value[r][C]=b);else if(typeof b=="function"){const w=y(C,b);M[C]=w,o.actions[C]=b}}return Un(S,M),Un(Ud(S),M),Object.defineProperty(S,"$state",{get:()=>n.state.value[r],set:C=>{d(b=>{Un(b,C)})}}),n._p.forEach(C=>{Un(S,a.run(()=>C({store:S,app:n._a,pinia:n,options:o})))}),x&&s&&t.hydrate&&t.hydrate(S.$state,x),c=!0,u=!0,S}function Ch(r,e,t){let n,i;const s=typeof e=="function";typeof r=="string"?(n=r,i=s?t:e):(i=r,n=r.id);function a(o,l){const c=Bd();return o=o||c&&Vd(Mh,null),o&&wa(o),o=Sh,o._s.has(n)||(s?Ah(n,e,i,o):ef(n,i,o)),o._s.get(n)}return a.$id=n,a}function tf(r,e){return` 6 <style> 7 button { 8 width: 100px; 9 height: 50px; 10 background-color: #369DD7; 11 color: white; 12 border-radius: 10px; 13 width: 100%; 14 font-weight: 400; 15 margin-top: 40px; 16 } 17 </style> 18 <button id='btn-${r}'>View Cvent 3D!</button> 19 <script> 20 var btn${r} = document.getElementById('btn-${r}'); 21 btn${r}.addEventListener('click', () => { 22 // send data out of the sandbox 23 window.send('buttonClick', '${r}'); 24 }); 25 // receive data from outside of the sandbox 26 window.on('updateButton', (newLabel, color) => { 27 btn${r}.innerText = newLabel; 28 btn${r}.style.backgroundColor = color; 29 }); 30 <\/script> 31 `}let br;const nf=new Uint8Array(16);function sf(){if(!br&&(br=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!br))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return br(nf)}const St=[];for(let r=0;r<256;++r)St.push((r+256).toString(16).slice(1));function rf(r,e=0){return St[r[e+0]]+St[r[e+1]]+St[r[e+2]]+St[r[e+3]]+"-"+St[r[e+4]]+St[r[e+5]]+"-"+St[r[e+6]]+St[r[e+7]]+"-"+St[r[e+8]]+St[r[e+9]]+"-"+St[r[e+10]]+St[r[e+11]]+St[r[e+12]]+St[r[e+13]]+St[r[e+14]]+St[r[e+15]]}const af=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jl={randomUUID:af};function Ct(r,e,t){if(Jl.randomUUID&&!e&&!r)return Jl.randomUUID();r=r||{};const n=r.random||(r.rng||sf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return rf(n)}/** 32 * @license 33 * Copyright 2010-2022 Three.js Authors 34 * SPDX-License-Identifier: MIT 35 */const Sa="146",of={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},lf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Eh=0,Io=1,Ph=2,cf=3,hf=0,fl=1,Ih=2,is=3,wi=0,Gt=1,wn=2,Tn=0,xi=1,Lo=2,Ro=3,zo=4,Lh=5,ui=100,Rh=101,zh=102,Do=103,Oo=104,Dh=200,Oh=201,Nh=202,kh=203,pl=204,ml=205,Bh=206,Fh=207,Uh=208,Vh=209,Hh=210,Gh=0,Wh=1,Xh=2,xa=3,Zh=4,jh=5,qh=6,Yh=7,er=0,$h=1,Jh=2,hn=0,Kh=1,Qh=2,eu=3,tu=4,nu=5,Ma=300,Xn=301,Zn=302,Ns=303,ks=304,ds=306,Bs=1e3,Pt=1001,Fs=1002,xt=1003,ya=1004,uf=1004,_a=1005,df=1005,ft=1006,gl=1007,ff=1007,Ci=1008,pf=1008,jn=1009,iu=1010,su=1011,xl=1012,ru=1013,Hn=1014,Sn=1015,cs=1016,au=1017,ou=1018,yi=1020,lu=1021,cu=1022,Ht=1023,hu=1024,uu=1025,Wn=1026,Si=1027,du=1028,fu=1029,pu=1030,mu=1031,gu=1033,oa=33776,la=33777,ca=33778,ha=33779,No=35840,ko=35841,Bo=35842,Fo=35843,xu=36196,Uo=37492,Vo=37496,Ho=37808,Go=37809,Wo=37810,Xo=37811,Zo=37812,jo=37813,qo=37814,Yo=37815,$o=37816,Jo=37817,Ko=37818,Qo=37819,el=37820,tl=37821,nl=36492,yu=2200,_u=2201,bu=2202,Us=2300,Vs=2301,ua=2302,fi=2400,pi=2401,Hs=2402,Ta=2500,yl=2501,mf=0,gf=1,xf=2,qn=3e3,ot=3001,vu=3200,wu=3201,$n=0,Su=1,yf="",cn="srgb",Gn="srgb-linear",_f=0,da=7680,bf=7681,vf=7682,wf=7683,Sf=34055,Mf=34056,Tf=5386,Af=512,Cf=513,Ef=514,Pf=515,If=516,Lf=517,Rf=518,Mu=519,Gs=35044,zf=35048,Df=35040,Of=35045,Nf=35049,kf=35041,Bf=35046,Ff=35050,Uf=35042,Vf="100",il="300 es",ba=1035;class Cn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const Et=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
355","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Kl=1234567;const _i=Math.PI/180,Ws=180/Math.PI;function Wt(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Et[r&255]+Et[r>>8&255]+Et[r>>16&255]+Et[r>>24&255]+"-"+Et[e&255]+Et[e>>8&255]+"-"+Et[e>>16&15|64]+Et[e>>24&255]+"-"+Et[t&63|128]+Et[t>>8&255]+"-"+Et[t>>16&255]+Et[t>>24&255]+Et[n&255]+Et[n>>8&255]+Et[n>>16&255]+Et[n>>24&255]).toLowerCase()}function pt(r,e,t){return Math.max(e,Math.min(t,r))}function _l(r,e){return(r%e+e)%e}function Hf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Gf(r,e,t){return r!==e?(t-r)/(e-r):0}function zs(r,e,t){return(1-t)*r+t*e}function Wf(r,e,t,n){return zs(r,e,1-Math.exp(-t*n))}function Xf(r,e=1){return e-Math.abs(_l(r,e*2)-e)}function Zf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function jf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function qf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Yf(r,e){return r+Math.random()*(e-r)}function $f(r){return r*(.5-Math.random())}function Jf(r){r!==void 0&&(Kl=r);let e=Kl+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Kf(r){return r*_i}function Qf(r){return r*Ws}function sl(r){return(r&r-1)===0&&r!==0}function Tu(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function va(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function ep(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),f=s((e-n)/2),p=a((e-n)/2),g=s((n-e)/2),x=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*f,l*p,o*c);break;case"YZY":r.set(l*p,o*u,l*f,o*c);break;case"ZXZ":r.set(l*f,l*p,o*u,o*c);break;case"XZX":r.set(o*u,l*x,l*g,o*c);break;case"YXY":r.set(l*g,o*u,l*x,o*c);break;case"ZYZ":r.set(l*x,l*g,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Mn(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function et(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var tp=Object.freeze({__proto__:null,DEG2RAD:_i,RAD2DEG:Ws,generateUUID:Wt,clamp:pt,euclideanModulo:_l,mapLinear:Hf,inverseLerp:Gf,lerp:zs,damp:Wf,pingpong:Xf,smoothstep:Zf,smootherstep:jf,randInt:qf,randFloat:Yf,randFloatSpread:$f,seededRandom:Jf,degToRad:Kf,radToDeg:Qf,isPowerOfTwo:sl,ceilPowerOfTwo:Tu,floorPowerOfTwo:va,setQuaternionFromProperEuler:ep,normalize:et,denormalize:Mn});class se{constructor(e=0,t=0){se.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 18,573 bytes, line 35
35sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class kt{constructor(){kt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],g=n[5],x=n[8],h=i[0],d=i[3],m=i[6],v=i[1],y=i[4],_=i[7],S=i[2],M=i[5],C=i[8];return s[0]=a*h+o*v+l*S,s[3]=a*d+o*y+l*M,s[6]=a*m+o*_+l*C,s[1]=c*h+u*v+f*S,s[4]=c*d+u*y+f*M,s[7]=c*m+u*_+f*C,s[2]=p*h+g*v+x*S,s[5]=p*d+g*y+x*M,s[8]=p*m+g*_+x*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],f=u*a-o*c,p=o*l-u*s,g=c*s-a*l,x=t*f+n*p+i*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const h=1/x;return e[0]=f*h,e[1]=(i*c-u*n)*h,e[2]=(o*n-i*a)*h,e[3]=p*h,e[4]=(u*t-i*l)*h,e[5]=(i*s-o*t)*h,e[6]=g*h,e[7]=(n*l-c*t)*h,e[8]=(a*t-n*s)*h,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],c=i[4],u=i[7];return i[0]=t*s+n*l,i[3]=t*a+n*c,i[6]=t*o+n*u,i[1]=-n*s+t*l,i[4]=-n*a+t*c,i[7]=-n*o+t*u,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function Au(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const np={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ss(r,e){return new np[r](e)}function Xs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function bi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function fa(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const Xa={[cn]:{[Gn]:bi},[Gn]:{[cn]:fa}},Yt={legacyMode:!0,get workingColorSpace(){return Gn},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.legacyMode||e===t||!e||!t)return r;if(Xa[e]&&Xa[e][t]!==void 0){const n=Xa[e][t];return r.r=n(r.r),r.g=n(r.g),r.b=n(r.b),r}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}},Cu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yt={r:0,g:0,b:0},en={h:0,s:0,l:0},vr={h:0,s:0,l:0};function Za(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function wr(r,e){return e.r=r.r,e.g=r.g,e.b=r.b,e}class Te{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=cn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Gn){return this.r=e,this.g=t,this.b=n,Yt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Gn){if(e=_l(e,1),t=pt(t,0,1),n=pt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Za(a,s,e+1/3),this.g=Za(a,s,e),this.b=Za(a,s,e-1/3)}return Yt.toWorkingColorSpace(this,i),this}setStyle(e,t=cn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Yt.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Yt.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return n(s[4]),this.setHSL(l,c,u,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Yt.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Yt.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=cn){const n=Cu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=bi(e.r),this.g=bi(e.g),this.b=bi(e.b),this}copyLinearToSRGB(e){return this.r=fa(e.r),this.g=fa(e.g),this.b=fa(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cn){return Yt.fromWorkingColorSpace(wr(this,yt),e),pt(yt.r*255,0,255)<<16^pt(yt.g*255,0,255)<<8^pt(yt.b*255,0,255)<<0}getHexString(e=cn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gn){Yt.fromWorkingColorSpace(wr(this,yt),t);const n=yt.r,i=yt.g,s=yt.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=u<=.5?f/(a+o):f/(2-a-o),a){case n:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-n)/f+2;break;case s:l=(n-i)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Gn){return Yt.fromWorkingColorSpace(wr(this,yt),t),e.r=yt.r,e.g=yt.g,e.b=yt.b,e}getStyle(e=cn){return Yt.fromWorkingColorSpace(wr(this,yt),e),e!==cn?`color(${e} ${yt.r} ${yt.g} ${yt.b})`:`rgb(${yt.r*255|0},${yt.g*255|0},${yt.b*255|0})`}offsetHSL(e,t,n){return this.getHSL(en),en.h+=e,en.s+=t,en.l+=n,this.setHSL(en.h,en.s,en.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(en),e.getHSL(vr);const n=zs(en.h,vr.h,t),i=zs(en.s,vr.s,t),s=zs(en.l,vr.l,t);return this.setHSL(n,i,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Te.NAMES=Cu;let ki;class bl{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ki===void 0&&(ki=Xs("canvas")),ki.width=e.width,ki.height=e.height;const n=ki.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ki}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=bi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(bi(t[n]/255)*255):t[n]=bi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class mi{constructor(e=null){this.isSource=!0,this.uuid=Wt(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(ja(i[a].image)):s.push(ja(i[a]))}else s=ja(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function ja(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?bl.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ip=0;class _t extends Cn{constructor(e=_t.DEFAULT_IMAGE,t=_t.DEFAULT_MAPPING,n=Pt,i=Pt,s=ft,a=Ci,o=Ht,l=jn,c=1,u=qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ip++}),this.uuid=Wt(),this.name="",this.source=new mi(e),this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new se(0,0),this.repeat=new se(1,1),this.center=new se(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new kt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.t
vendor: 4,773 bytes, line 35
35ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ma)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bs:e.x=e.x-Math.floor(e.x);break;case Pt:e.x=e.x<0?0:1;break;case Fs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bs:e.y=e.y-Math.floor(e.y);break;case Pt:e.y=e.y<0?0:1;break;case Fs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}_t.DEFAULT_IMAGE=null;_t.DEFAULT_MAPPING=Ma;class Ke{constructor(e=0,t=0,n=0,i=1){Ke.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],g=l[5],x=l[9],h=l[2],d=l[6],m=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-h)<.01&&Math.abs(x-d)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+h)<.1&&Math.abs(x+d)<.1&&Math.abs(c+g+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,_=(g+1)/2,S=(m+1)/2,M=(u+p)/4,C=(f+h)/4,b=(x+d)/4;return y>_&&y>S?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=M/n,s=C/n):_>S?_<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),n=M/i,s=b/i):S<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(S),n=C/s,i=b/s),this.set(n,i,s,t),this}let v=Math.sqrt((d-x)*(d-x)+(f-h)*(f-h)+(p-u)*(p-u));return Math.abs(v)<.001&&(v=1),this.x=(d-x)/v,this.y=(f-h)/v,this.z=(p-u)/v,this.w=Math.acos((c+g+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}
vendor: 4,112 bytes, line 35
35round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Kt extends Cn{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ke(0,0,e,t),this.scissorTest=!1,this.viewport=new Ke(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new _t(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:ft,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new mi(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tr extends _t{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=Pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sp extends Kt{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new tr(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Aa extends _t{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=Pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rp extends Kt{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Aa(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class ap extends Kt{constructor(e=1,t=1,n=1,i={}
vendor: 4,450 bytes, line 35
35){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class De{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],u=n[i+2],f=n[i+3];const p=s[a+0],g=s[a+1],x=s[a+2],h=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f;return}if(o===1){e[t+0]=p,e[t+1]=g,e[t+2]=x,e[t+3]=h;return}if(f!==h||l!==p||c!==g||u!==x){let d=1-o;const m=l*p+c*g+u*x+f*h,v=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){const S=Math.sqrt(y),M=Math.atan2(S,m*v);d=Math.sin(d*M)/S,o=Math.sin(o*M)/S}const _=o*v;if(l=l*d+p*_,c=c*d+g*_,u=u*d+x*_,f=f*d+h*_,d===1-o){const S=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=S,c*=S,u*=S,f*=S}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],f=s[a],p=s[a+1],g=s[a+2],x=s[a+3];return e[t]=o*x+u*f+l*g-c*p,e[t+1]=l*x+u*p+c*f-o*g,e[t+2]=c*x+u*g+o*p-l*f,e[t+3]=u*x-o*f-l*p-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),f=o(s/2),p=l(n/2),g=l(i/2),x=l(s/2);switch(a){case"XYZ":this._x=p*u*f+c*g*x,this._y=c*g*f-p*u*x,this._z=c*u*x+p*g*f,this._w=c*u*f-p*g*x;break;case"YXZ":this._x=p*u*f+c*g*x,this._y=c*g*f-p*u*x,this._z=c*u*x-p*g*f,this._w=c*u*f+p*g*x;break;case"ZXY":this._x=p*u*f-c*g*x,this._y=c*g*f+p*u*x,this._z=c*u*x+p*g*f,this._w=c*u*f-p*g*x;break;case"ZYX":this._x=p*u*f-c*g*x,this._y=c*g*f+p*u*x,this._z=c*u*x-p*g*f,this._w=c*u*f+p*g*x;break;case"YZX":this._x=p*u*f+c*g*x,this._y=c*g*f+p*u*x,this._z=c*u*x-p*g*f,this._w=c*u*f-p*g*x;break;case"XZY":this._x=p*u*f-c*g*x,this._y=c*g*f-p*u*x,this._z=c*u*x+p*g*f,this._w=c*u*f+p*g*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+o+f;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(u-l)*g,this._y=(s-c)*g,this._z=(a-i)*g}else if(n>o&&n>f){const g=2*Math.sqrt(1+n-o-f);this._w=(u-l)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+c)/g}else if(o>f){const g=2*Math.sqrt(1+o-n-f);this._w=(s-c)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(l+u)/g}else{const g=2*Math.sqrt(1+f-n-o);this._w=(a-i)/g,this._x=(s+c)/g,this._y=(l+u)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(pt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
vendor: 11,679 bytes, line 35
35conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),f=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=a*f+this._w*p,this._x=n*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class A{constructor(e=0,t=0,n=0){A.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ql.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ql.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*i-o*n,u=l*n+o*t-s*i,f=l*i+s*n-a*t,p=-s*t-a*n-o*i;return this.x=c*l+p*-s+u*-o-f*-a,this.y=u*l+p*-a+f*-s-c*-o,this.z=f*l+p*-o+c*-a-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return qa.copy(this).projectOnVector(e),this.sub(qa)}reflect(e){return this.sub(qa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(pt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const qa=new A,Ql=new De;class Ei{constructor(e=new A(1/0,1/0,1/0),t=new A(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.length;l<c;l+=3){const u=e[l],f=e[l+1],p=e[l+2];u<t&&(t=u),f<n&&(n=f),p<i&&(i=p),u>s&&(s=u),f>a&&(a=f),p>o&&(o=p)}return this.min.set(t,n,i),this.max.set(s,a,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,o=-1/0;for(let l=0,c=e.count;l<c;l++){const u=e.getX(l),f=e.getY(l),p=e.getZ(l);u<t&&(t=u),f<n&&(n=f),p<i&&(i=p),u>s&&(s=u),f>a&&(a=f),p>o&&(o=p)}return this.min.set(t,n,i),this.max.set(s,a,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=ni.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0)if(t&&n.attributes!=null&&n.attributes.position!==void 0){const s=n.attributes.position;for(let a=0,o=s.count;a<o;a++)ni.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(ni)}else n.boundingBox===null&&n.computeBoundingBox(),Ya.copy(n.boundingBox),Ya.applyMatrix4(e.matrixWorld),this.union(Ya);const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ni),ni.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 6,338 bytes, line 35
35s}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vs),Sr.subVectors(this.max,vs),Bi.subVectors(e.a,vs),Fi.subVectors(e.b,vs),Ui.subVectors(e.c,vs),Rn.subVectors(Fi,Bi),zn.subVectors(Ui,Fi),ii.subVectors(Bi,Ui);let t=[0,-Rn.z,Rn.y,0,-zn.z,zn.y,0,-ii.z,ii.y,Rn.z,0,-Rn.x,zn.z,0,-zn.x,ii.z,0,-ii.x,-Rn.y,Rn.x,0,-zn.y,zn.x,0,-ii.y,ii.x,0];return!$a(t,Bi,Fi,Ui,Sr)||(t=[1,0,0,0,1,0,0,0,1],!$a(t,Bi,Fi,Ui,Sr))?!1:(Mr.crossVectors(Rn,zn),t=[Mr.x,Mr.y,Mr.z],$a(t,Bi,Fi,Ui,Sr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ni.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(ni).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const mn=[new A,new A,new A,new A,new A,new A,new A,new A],ni=new A,Ya=new Ei,Bi=new A,Fi=new A,Ui=new A,Rn=new A,zn=new A,ii=new A,vs=new A,Sr=new A,Mr=new A,si=new A;function $a(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){si.fromArray(r,s);const o=i.x*Math.abs(si.x)+i.y*Math.abs(si.y)+i.z*Math.abs(si.z),l=e.dot(si),c=t.dot(si),u=n.dot(si);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const op=new Ei,ws=new A,Ja=new A;class Pi{constructor(e=new A,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):op.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ws.subVectors(e,this.center);const t=ws.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ws,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ja.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ws.copy(e.center).add(Ja)),this.expandByPoint(ws.copy(e.center).sub(Ja))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const gn=new A,Ka=new A,Tr=new A,Dn=new A,Qa=new A,Ar=new A,eo=new A;class nr{constructor(e=new A,t=new A(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,gn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(gn.copy(this.direction).multiplyScalar(t).add(this.origin),gn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ka.copy(e).add(t).multiplyScalar(.5),Tr.copy(t).sub(e).normalize(),Dn.copy(this.origin).sub(Ka);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Tr),o=Dn.dot(this.direction),l=-Dn.dot(Tr),c=Dn.lengthSq(),u=Math.abs(1-a*a);let f,p,g,x;if(u>0)if(f=a*l-o,p=a*o-l,x=s*u,f>=0)if(p>=-x)if(p<=x){const h=1/u;f*=h,p*=h,g=f*(f+a*p+2*o)+p*(a*f+p+2*l)+c}else p=s,f=Math.max(0,-(a*p+o)),g=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(a*p+o)),g=-f*f+p*(p+2*l)+c;else p<=-x?(f=Math.max(0,-(-a*s+o)),p=f>0?-s:Math.min(Math.max(-s,-l),s),g=-f*f+p*(p+2*l)+c):p<=x?(f=0,p=Math.min(Math.max(-s,-l),s),g=p*(p+2*l)+c):(f=Math.max(0,-(a*s+o)),p=f>0?s:Math.min(Math.max(-s,-l),s),g=-f*f+p*(p+2*l)+c);else p=a>0?-s:s,f=Math.max(0,-(a*p+o)),g=-f*f+p*(p+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(f).add(this.origin),i&&i.copy(Tr).multiplyScalar(p).add(Ka),g}intersectSphere(e,t){gn.subVectors(e.center,this.origin);const n=gn.dot(this.direction),i=gn.dot(gn)-n*n,s=e.radius*e.radiu
vendor: 5,069 bytes, line 35
35s;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return o<0&&l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,a=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,a=(e.min.y-p.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),f>=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,gn)!==null}intersectTriangle(e,t,n,i,s){Qa.subVectors(t,e),Ar.subVectors(n,e),eo.crossVectors(Qa,Ar);let a=this.direction.dot(eo),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Dn.subVectors(this.origin,e);const l=o*this.direction.dot(Ar.crossVectors(Dn,Ar));if(l<0)return null;const c=o*this.direction.dot(Qa.cross(Dn));if(c<0||l+c>a)return null;const u=-o*Dn.dot(eo);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Be{constructor(){Be.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,i,s,a,o,l,c,u,f,p,g,x,h,d){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=u,m[10]=f,m[14]=p,m[3]=g,m[7]=x,m[11]=h,m[15]=d,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Be().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Vi.setFromMatrixColumn(e,0).length(),s=1/Vi.setFromMatrixColumn(e,1).length(),a=1/Vi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=a*u,g=a*f,x=o*u,h=o*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=g+x*c,t[5]=p-h*c,t[9]=-o*l,t[2]=h-p*c,t[6]=x+g*c,t[10]=a*l}else if(e.order==="YXZ"){const p=l*u,g=l*f,x=c*u,h=c*f;t[0]=p+h*o,t[4]=x*o-g,t[8]=a*c,t[1]=a*f,t[5]=a*u,t[9]=-o,t[2]=g*o-x,t[6]=h+p*o,t[10]=a*l}else if(e.order==="ZXY"){const p=l*u,g=l*f,x=c*u,h=c*f;t[0]=p-h*o,t[4]=-a*f,t[8]=x+g*o,t[1]=g+x*o,t[5]=a*u,t[9]=h-p*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const p=a*u,g=a*f,x=o*u,h=o*f;t[0]=l*u,t[4]=x*c-g,t[8]=p*c+h,t[1]=l*f,t[5]=h*c+p,t[9]=g*c-x,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const p=a*l,g=a*c,x=o*l,h=o*c;t[0]=l*u,t[4]=h-p*f,t[8]=x*f+g,t[1]=f,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=g*f+x,t[10]=p-h*f}else if(e.order==="XZY"){const p=a*l,g=a*c,x=o*l,h=o*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+h,t[5]=a*u,t[9]=g*f-x,t[2]=x*f-g,t[6]=o*u,t[10]=h*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(lp,e,cp)}lookAt(e,t,n){const i=this.elements;return Ut.subVectors(e,t),Ut.lengthSq()===0&&(Ut.z=1),Ut.normalize(),On.crossVectors(n,Ut),On.lengthSq()===0&&(Math.abs(n.z)===1?Ut.x+=1e-4:Ut.z+=1e-4,Ut.normalize(),On.crossVectors(n,Ut)),On.normalize(),Cr.crossVectors(Ut,On),i[0]=On.x,i[4]=Cr.x,i[8]=Ut.x,i[1]=On.y,i[5]=Cr.y,i[9]=Ut.y,i[2]=On.z,i[6]=Cr.z,i[10]=Ut.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],g=n[13],x=n[2],h=n[6],d=n[10],m=n[14],v=n[3],y=n[7],_=n[11],S=n[15],M=i[0],C=i[4],b=i[8],w=i[12],P=i[1],T=i[5],F=i[9],B=i[13],R=i[2],U=i[6],q=i[10],J=i[14],X=i[3],O=i[7],N=i[11],re=i[15];
vendor: 1,804 bytes, line 35
35return s[0]=a*M+o*P+l*R+c*X,s[4]=a*C+o*T+l*U+c*O,s[8]=a*b+o*F+l*q+c*N,s[12]=a*w+o*B+l*J+c*re,s[1]=u*M+f*P+p*R+g*X,s[5]=u*C+f*T+p*U+g*O,s[9]=u*b+f*F+p*q+g*N,s[13]=u*w+f*B+p*J+g*re,s[2]=x*M+h*P+d*R+m*X,s[6]=x*C+h*T+d*U+m*O,s[10]=x*b+h*F+d*q+m*N,s[14]=x*w+h*B+d*J+m*re,s[3]=v*M+y*P+_*R+S*X,s[7]=v*C+y*T+_*U+S*O,s[11]=v*b+y*F+_*q+S*N,s[15]=v*w+y*B+_*J+S*re,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],g=e[14],x=e[3],h=e[7],d=e[11],m=e[15];return x*(+s*l*f-i*c*f-s*o*p+n*c*p+i*o*g-n*l*g)+h*(+t*l*g-t*c*p+s*a*p-i*a*g+i*c*u-s*l*u)+d*(+t*c*f-t*o*g-s*a*f+n*a*g+s*o*u-n*c*u)+m*(-i*o*u-t*l*f+t*o*p+i*a*f-n*a*p+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],g=e[11],x=e[12],h=e[13],d=e[14],m=e[15],v=f*d*c-h*p*c+h*l*g-o*d*g-f*l*m+o*p*m,y=x*p*c-u*d*c-x*l*g+a*d*g+u*l*m-a*p*m,_=u*h*c-x*f*c+x*o*g-a*h*g-u*o*m+a*f*m,S=x*f*l-u*h*l-x*o*p+a*h*p+u*o*d-a*f*d,M=t*v+n*y+i*_+s*S;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/M;return e[0]=v*C,e[1]=(h*p*s-f*d*s-h*i*g+n*d*g+f*i*m-n*p*m)*C,e[2]=(o*d*s-h*l*s+h*i*c-n*d*c-o*i*m+n*l*m)*C,e[3]=(f*l*s-o*p*s-f*i*c+n*p*c+o*i*g-n*l*g)*C,e[4]=y*C,e[5]=(u*d*s-x*p*s+x*i*g-t*d*g-u*i*m+t*p*m)*C,e[6]=(x*l*s-a*
vendor: 4,272 bytes, line 35
35d*s-x*i*c+t*d*c+a*i*m-t*l*m)*C,e[7]=(a*p*s-u*l*s+u*i*c-t*p*c-a*i*g+t*l*g)*C,e[8]=_*C,e[9]=(x*f*s-u*h*s-x*n*g+t*h*g+u*n*m-t*f*m)*C,e[10]=(a*h*s-x*o*s+x*n*c-t*h*c-a*n*m+t*o*m)*C,e[11]=(u*o*s-a*f*s-u*n*c+t*f*c+a*n*g-t*o*g)*C,e[12]=S*C,e[13]=(u*h*i-x*f*i+x*n*p-t*h*p-u*n*d+t*f*d)*C,e[14]=(x*o*i-a*h*i-x*n*l+t*h*l+a*n*d-t*o*d)*C,e[15]=(a*f*i-u*o*i+u*n*l-t*f*l-a*n*p+t*o*p)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,f=o+o,p=s*c,g=s*u,x=s*f,h=a*u,d=a*f,m=o*f,v=l*c,y=l*u,_=l*f,S=n.x,M=n.y,C=n.z;return i[0]=(1-(h+m))*S,i[1]=(g+_)*S,i[2]=(x-y)*S,i[3]=0,i[4]=(g-_)*M,i[5]=(1-(p+m))*M,i[6]=(d+v)*M,i[7]=0,i[8]=(x+y)*C,i[9]=(d-v)*C,i[10]=(1-(p+h))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Vi.set(i[0],i[1],i[2]).length();const a=Vi.set(i[4],i[5],i[6]).length(),o=Vi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],tn.copy(this);const c=1/s,u=1/a,f=1/o;return tn.elements[0]*=c,tn.elements[1]*=c,tn.elements[2]*=c,tn.elements[4]*=u,tn.elements[5]*=u,tn.elements[6]*=u,tn.elements[8]*=f,tn.elements[9]*=f,tn.elements[10]*=f,t.setFromRotationMatrix(tn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a){const o=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i),p=-(a+s)/(a-s),g=-2*a*s/(a-s);return o[0]=l,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=f,o[13]=0,o[2]=0,o[6]=0,o[10]=p,o[14]=g,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,a){const o=this.elements,l=1/(t-e),c=1/(n-i),u=1/(a-s),f=(t+e)*l,p=(n+i)*c,g=(a+s)*u;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-f,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-p,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-g,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Vi=new A,tn=new Be,lp=new A(0,0,0),cp=new A(1,1,1),On=new A,Cr=new A,Ut=new A,ec=new Be,tc=new De;class fs{constructor(e=0,t=0,n=0,i=fs.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],f=i[2],p=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(pt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c
vendor: 25,859 bytes, line 35
35),this._z=0);break;case"YXZ":this._x=Math.asin(-pt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(pt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-pt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(pt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-pt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ec,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tc.setFromEuler(this),this.setFromQuaternion(tc,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}fs.DefaultOrder="XYZ";fs.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ca{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let hp=0;const nc=new A,Hi=new De,xn=new Be,Er=new A,Ss=new A,up=new A,dp=new De,ic=new A(1,0,0),sc=new A(0,1,0),rc=new A(0,0,1),fp={type:"added"},ac={type:"removed"};class qe extends Cn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:hp++}),this.uuid=Wt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=qe.DefaultUp.clone();const e=new A,t=new fs,n=new De,i=new A(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Be},normalMatrix:{value:new kt}}),this.matrix=new Be,this.matrixWorld=new Be,this.matrixAutoUpdate=qe.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=qe.DefaultMatrixWorldAutoUpdate,this.layers=new Ca,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Hi.setFromAxisAngle(e,t),this.quaternion.multiply(Hi),this}rotateOnWorldAxis(e,t){return Hi.setFromAxisAngle(e,t),this.quaternion.premultiply(Hi),this}rotateX(e){return this.rotateOnAxis(ic,e)}rotateY(e){return this.rotateOnAxis(sc,e)}rotateZ(e){return this.rotateOnAxis(rc,e)}translateOnAxis(e,t){return nc.copy(e).applyQuaternion(this.quaternion),this.position.add(nc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ic,e)}translateY(e){return this.translateOnAxis(sc,e)}translateZ(e){return this.translateOnAxis(rc,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(xn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Er.copy(e):Er.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ss.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xn.lookAt(Ss,Er,this.up):xn.lookAt(Er,Ss,this.up),this.quaternion.setFromRotationMatrix(xn),i&&(xn.extractRotation(i.matrixWorld),Hi.setFromRotationMatrix(xn),this.quaternion.premultiply(Hi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(fp)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ac)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(ac)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),xn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xn.multiply(e.parent.matrixWorld)),e.applyMatrix4(xn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ss,e,up),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ss,dp,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++){const o=i[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),f=a(e.shapes),p=a(e.skeletons),g=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}qe.DefaultUp=new A(0,1,0);qe.DefaultMatrixAutoUpdate=!0;qe.DefaultMatrixWorldAutoUpdate=!0;const nn=new A,yn=new A,to=new A,_n=new A,Gi=new A,Wi=new A,oc=new A,no=new A,io=new A,so=new A;class Jt{constructor(e=new A,t=new A,n=new A){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),nn.subVectors(e,t),i.cross(nn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){nn.subVectors(i,t),yn.subVectors(n,t),to.subVectors(e,t);const a=nn.dot(nn),o=nn.dot(yn),l=nn.dot(to),c=yn.dot(yn),u=yn.dot(to),f=a*c-o*o;if(f===0)return s.set(-2,-1,-1);const p=1/f,g=(c*l-o*u)*p,x=(a*u-o*l)*p;return s.set(1-g-x,x,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,_n),_n.x>=0&&_n.y>=0&&_n.x+_n.y<=1}static getUV(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,_n),l.set(0,0),l.addScaledVector(s,_n.x),l.addScaledVector(a,_n.y),l.addScaledVector(o,_n.z),l}static isFrontFacing(e,t,n,i){return nn.subVectors(n,t),yn.subVectors(e,t),nn.cross(yn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return nn.subVectors(this.c,this.b),yn.subVectors(this.a,this.b),nn.cross(yn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Jt.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Jt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;Gi.subVectors(i,n),Wi.subVectors(s,n),no.subVectors(e,n);const l=Gi.dot(no),c=Wi.dot(no);if(l<=0&&c<=0)return t.copy(n);io.subVectors(e,i);const u=Gi.dot(io),f=Wi.dot(io);if(u>=0&&f<=u)return t.copy(i);const p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Gi,a);so.subVectors(e,s);const g=Gi.dot(so),x=Wi.dot(so);if(x>=0&&g<=x)return t.copy(s);const h=g*c-l*x;if(h<=0&&c>=0&&x<=0)return o=c/(c-x),t.copy(n).addScaledVector(Wi,o);const d=u*x-g*f;if(d<=0&&f-u>=0&&g-x>=0)return oc.subVectors(s,i),o=(f-u)/(f-u+(g-x)),t.copy(i).addScaledVector(oc,o);const m=1/(d+h+p);return a=h*m,o=p*m,t.copy(n).addScaledVector(Gi,a).addScaledVector(Wi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let pp=0;class It extends Cn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pp++}),this.uuid=Wt(),this.name="",this.type="Material",this.blending=xi,this.side=wi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=pl,this.blendDst=ml,this.blendEquation=ui,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=xa,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Mu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=da,this.stencilZFail=da,this.stencilZPass=da,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==xi&&(n.blending=this.blending),this.side!==wi&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Jn extends It{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=er,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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.fog=e.fog,this}}const gt=new A,Pr=new se;class tt{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=Gs,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;
vendor: 5,979 bytes, line 35
35t++)Pr.fromBufferAttribute(this,t),Pr.applyMatrix3(e),this.setXY(t,Pr.x,Pr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix3(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix4(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyNormalMatrix(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.transformDirection(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Mn(t,this.array)),t}setX(e,t){return this.normalized&&(t=et(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Mn(t,this.array)),t}setY(e,t){return this.normalized&&(t=et(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Mn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=et(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Mn(t,this.array)),t}setW(e,t){return this.normalized&&(t=et(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=et(t,this.array),n=et(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=et(t,this.array),n=et(n,this.array),i=et(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=et(t,this.array),n=et(n,this.array),i=et(i,this.array),s=et(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Gs&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class mp extends tt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class gp extends tt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class xp extends tt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class yp extends tt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class vl extends tt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class _p extends tt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class wl extends tt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class bp extends tt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}}class Ee extends tt{constructor(e,t,n){super(new Float32Array(e),t,n)}}class vp extends tt{constructor(e,t,n){super(new Float64Array(e),t,n)}}let wp=0;const qt=new Be,ro=new qe,Xi=new A,Vt=new Ei,Ms=new Ei,wt=new A;class Ve extends Cn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wp++}),this.uuid=Wt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Au(e)?wl:vl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new kt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return qt.makeRotationFromQuaternion(e),this.applyMatrix4(qt),this}rotateX(e){return qt.makeRotationX(e),this.applyMatrix4(qt),this}rotateY(e){return qt.makeRotationY(e),this.applyMatrix4(qt),this}rotateZ(e){return qt.makeRotationZ(e),this.applyMatrix4(qt),this}translate(e,t,n){return qt.makeTranslation(e,t,n),this.applyMatrix4(qt),this}scale(e,t,n){return qt.makeScale(e,t,n),this.applyMatrix4(qt),this}lookAt(e){return ro.lookAt(e),ro.updateMatrix(),this.applyMatrix4(ro.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xi).negate(),this.translate(Xi.x,Xi.y,Xi.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ee(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ei);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
35se".',this),this.boundingBox.set(new A(-1/0,-1/0,-1/0),new A(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];Vt.setFromBufferAttribute(s),this.morphTargetsRelative?(wt.addVectors(this.boundingBox.min,Vt.min),this.boundingBox.expandByPoint(wt),wt.addVectors(this.boundingBox.max,Vt.max),this.boundingBox.expandByPoint(wt)):(this.boundingBox.expandByPoint(Vt.min),this.boundingBox.expandByPoint(Vt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
35se".',this),this.boundingSphere.set(new A,1/0);return}if(e){const n=this.boundingSphere.center;if(Vt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ms.setFromBufferAttribute(o),this.morphTargetsRelative?(wt.addVectors(Vt.min,Ms.min),Vt.expandByPoint(wt),wt.addVectors(Vt.max,Ms.max),Vt.expandByPoint(wt)):(Vt.expandByPoint(Ms.min),Vt.expandByPoint(Ms.max))}Vt.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)wt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(wt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)wt.fromBufferAttribute(o,c),l&&(Xi.fromBufferAttribute(e,c),wt.add(Xi)),i=Math.max(i,n.distanceToSquared(wt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,o=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new tt(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],u=[];for(let P=0;P<o;P++)c[P]=new A,u[P]=new A;const f=new A,p=new A,g=new A,x=new se,h=new se,d=new se,m=new A,v=new A;function y(P,T,F){f.fromArray(i,P*3),p.fromArray(i,T*3),g.fromArray(i,F*3),x.fromArray(a,P*2),h.fromArray(a,T*2),d.fromArray(a,F*2),p.sub(f),g.sub(f),h.sub(x),d.sub(x);const B=1/(h.x*d.y-d.x*h.y);isFinite(B)&&(m.copy(p).multiplyScalar(d.y).addScaledVector(g,-h.y).multiplyScalar(B),v.copy(g).multiplyScalar(h.x).addScaledVector(p,-d.x).multiplyScalar(B),c[P].add(m),c[T].add(m),c[F].add(m),u[P].add(v),u[T].add(v),u[F].add(v))}let _=this.groups;_.length===0&&(_=[{start:0,count:n.length}]);for(let P=0,T=_.length;P<T;++P){const F=_[P],B=F.start,R=F.count;for(let U=B,q=B+R;U<q;U+=3)y(n[U+0],n[U+1],n[U+2])}const S=new A,M=new A,C=new A,b=new A;function w(P){C.fromArray(s,P*3),b.copy(C);const T=c[P];S.copy(T),S.sub(C.multiplyScalar(C.dot(T))).normalize(),M.crossVectors(b,T);const B=M.dot(u[P])<0?-1:1;l[P*4]=S.x,l[P*4+1]=S.y,l[P*4+2]=S.z,l[P*4+3]=B}for(let P=0,T=_.length;P<T;++P){const F=_[P],B=F.start,R=F.count;for(let U=B,q=B+R;U<q;U+=3)w(n[U+0]),w(n[U+1]),w(n[U+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new tt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,g=n.count;p<g;p++)n.setXYZ(p,0,0,0);const i=new A,s=new A,a=new A,o=new A,l=new A,c=new A,u=new A,f=new A;if(e)for(let p=0,g=e.count;p<g;p+=3){const x=e.getX(p+0),h=e.getX(p+1),d=e.getX(p+2);i.fromBufferAttribute(t,x),s.fromBufferAttribute(t,h),a.fromBufferAttribute(t,d),u.subVectors(a,s),f.subVectors(i,s),u.cross(f),o.fromBufferAttribute(n,x),l.fromBufferAttribute(n,h),c.fromBufferAttribute(n,d),o.add(u),l.add(u),c.add(u),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(h,l.x,l.y,l.z),n.setXYZ(d,c.x,c.y,c.z)}else for(let p=0,g=t.count;p<g;p+=3)i.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),a.fromBufferAttribute(t,p+2),u.subVectors(a,s),f.subVectors(i,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)wt.fromBufferAttribute(e,t),wt.normalize(),e.setXYZ(t,wt.x,wt.y,wt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,f=o.normalized,p=new c.constructor(l.length*u);let g=0,x=0;for(let h=0,d=l.length;h<d;h++){o.isInterleavedBufferAttribute?g=l[h]*o.data.stride+o.offset:g=l[h]*u;for(let m=0;m<u;m++)p[x++]=c[g++]}return new tt(p,u,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ve,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,f=c.length;u<f;u++){const p=c[u],g=e(p,n);l.push(g)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 25,482 bytes, lines 35-152
35if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){const g=c[f];u.push(g.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let p=0,g=f.length;p<g;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const lc=new Be,Zi=new nr,ao=new Pi,Nn=new A,kn=new A,Bn=new A,oo=new A,lo=new A,co=new A,Ir=new A,Lr=new A,Rr=new A,zr=new se,Dr=new se,Or=new se,ho=new A,Nr=new A;class Tt extends qe{constructor(e=new Ve,t=new Jn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),ao.copy(n.boundingSphere),ao.applyMatrix4(s),e.ray.intersectsSphere(ao)===!1)||(lc.copy(s).invert(),Zi.copy(e.ray).applyMatrix4(lc),n.boundingBox!==null&&Zi.intersectsBox(n.boundingBox)===!1))return;let a;const o=n.index,l=n.attributes.position,c=n.morphAttributes.position,u=n.morphTargetsRelative,f=n.attributes.uv,p=n.attributes.uv2,g=n.groups,x=n.drawRange;if(o!==null)if(Array.isArray(i))for(let h=0,d=g.length;h<d;h++){const m=g[h],v=i[m.materialIndex],y=Math.max(m.start,x.start),_=Math.min(o.count,Math.min(m.start+m.count,x.start+x.count));for(let S=y,M=_;S<M;S+=3){const C=o.getX(S),b=o.getX(S+1),w=o.getX(S+2);a=kr(this,v,e,Zi,l,c,u,f,p,C,b,w),a&&(a.faceIndex=Math.floor(S/3),a.face.materialIndex=m.materialIndex,t.push(a))}}else{const h=Math.max(0,x.start),d=Math.min(o.count,x.start+x.count);for(let m=h,v=d;m<v;m+=3){const y=o.getX(m),_=o.getX(m+1),S=o.getX(m+2);a=kr(this,i,e,Zi,l,c,u,f,p,y,_,S),a&&(a.faceIndex=Math.floor(m/3),t.push(a))}}else if(l!==void 0)if(Array.isArray(i))for(let h=0,d=g.length;h<d;h++){const m=g[h],v=i[m.materialIndex],y=Math.max(m.start,x.start),_=Math.min(l.count,Math.min(m.start+m.count,x.start+x.count));for(let S=y,M=_;S<M;S+=3){const C=S,b=S+1,w=S+2;a=kr(this,v,e,Zi,l,c,u,f,p,C,b,w),a&&(a.faceIndex=Math.floor(S/3),a.face.materialIndex=m.materialIndex,t.push(a))}}else{const h=Math.max(0,x.start),d=Math.min(l.count,x.start+x.count);for(let m=h,v=d;m<v;m+=3){const y=m,_=m+1,S=m+2;a=kr(this,i,e,Zi,l,c,u,f,p,y,_,S),a&&(a.faceIndex=Math.floor(m/3),t.push(a))}}}}function Sp(r,e,t,n,i,s,a,o){let l;if(e.side===Gt?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side!==wn,o),l===null)return null;Nr.copy(o),Nr.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Nr);return c<t.near||c>t.far?null:{distance:c,point:Nr.clone(),object:r}}function kr(r,e,t,n,i,s,a,o,l,c,u,f){Nn.fromBufferAttribute(i,c),kn.fromBufferAttribute(i,u),Bn.fromBufferAttribute(i,f);const p=r.morphTargetInfluences;if(s&&p){Ir.set(0,0,0),Lr.set(0,0,0),Rr.set(0,0,0);for(let x=0,h=s.length;x<h;x++){const d=p[x],m=s[x];d!==0&&(oo.fromBufferAttribute(m,c),lo.fromBufferAttribute(m,u),co.fromBufferAttribute(m,f),a?(Ir.addScaledVector(oo,d),Lr.addScaledVector(lo,d),Rr.addScaledVector(co,d)):(Ir.addScaledVector(oo.sub(Nn),d),Lr.addScaledVector(lo.sub(kn),d),Rr.addScaledVector(co.sub(Bn),d)))}Nn.add(Ir),kn.add(Lr),Bn.add(Rr)}r.isSkinnedMesh&&(r.boneTransform(c,Nn),r.boneTransform(u,kn),r.boneTransform(f,Bn));const g=Sp(r,e,t,n,Nn,kn,Bn,ho);if(g){o&&(zr.fromBufferAttribute(o,c),Dr.fromBufferAttribute(o,u),Or.fromBufferAttribute(o,f),g.uv=Jt.getUV(ho,Nn,kn,Bn,zr,Dr,Or,new se)),l&&(zr.fromBufferAttribute(l,c),Dr.fromBufferAttribute(l,u),Or.fromBufferAttribute(l,f),g.uv2=Jt.getUV(ho,Nn,kn,Bn,zr,Dr,Or,new se));const x={a:c,b:u,c:f,normal:new A,materialIndex:0};Jt.getNormal(Nn,kn,Bn,x.normal),g.face=x}return g}class Kn extends Ve{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],f=[];let p=0,g=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,i,a,2),x("x","z","y",1,-1,e,n,-t,i,a,3),x("x","y","z",1,-1,e,t,n,i,s,4),x("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Ee(c,3)),this.setAttribute("normal",new Ee(u,3)),this.setAttribute("uv",new Ee(f,2));function x(h,d,m,v,y,_,S,M,C,b,w){const P=_/C,T=S/b,F=_/2,B=S/2,R=M/2,U=C+1,q=b+1;let J=0,X=0;const O=new A;for(let N=0;N<q;N++){const re=N*T-B;for(let ee=0;ee<U;ee++){const le=ee*P-F;O[h]=le*v,O[d]=re*y,O[m]=R,c.push(O.x,O.y,O.z),O[h]=0,O[d]=0,O[m]=M>0?1:-1,u.push(O.x,O.y,O.z),f.push(ee/C),f.push(1-N/b),J+=1}}for(let N=0;N<b;N++)for(let re=0;re<C;re++){const ee=p+re+U*N,le=p+re+U*(N+1),me=p+(re+1)+U*(N+1),he=p+(re+1)+U*N;l.push(ee,le,he),l.push(le,me,he),X+=6}o.addGroup(g,X,w),g+=X,p+=J}}static fromJSON(e){return new Kn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function hs(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Dt(r){const e={};for(let t=0;t<r.length;t++){const n=hs(r[t]);for(const i in n)e[i]=n[i]}return e}function Mp(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}const Eu={clone:hs,merge:Dt};var Tp=`void main() { 36 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 37}`,Ap=`void main() { 38 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 39}`;class dn extends It{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Tp,this.fragmentShader=Ap,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=hs(e.uniforms),this.uniformsGroups=Mp(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ea extends qe{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Be,this.projectionMatrix=new Be,this.projectionMatrixInverse=new Be}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Mt extends Ea{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ws*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(_i*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ws*2*Math.atan(Math.tan(_i*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,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=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(_i*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ji=90,qi=1;class Pu extends qe{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new Mt(ji,qi,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new A(1,0,0)),this.add(i);const s=new Mt(ji,qi,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new A(-1,0,0)),this.add(s);const a=new Mt(ji,qi,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new A(0,1,0)),this.add(a);const o=new Mt(ji,qi,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new A(0,-1,0)),this.add(o);const l=new Mt(ji,qi,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new A(0,0,1)),this.add(l);const c=new Mt(ji,qi,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new A(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,a,o,l,c]=this.children,u=e.getRenderTarget(),f=e.toneMapping,p=e.xr.enabled;e.toneMapping=hn,e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=g,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=f,e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class ir extends _t{constructor(e,t,n,i,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Xn,super(e,t,n,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Iu extends Kt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new ir(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ft}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 40 41 varying vec3 vWorldDirection; 42 43 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 44 45 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 46 47 } 48 49 void main() { 50 51 vWorldDirection = transformDirection( position, modelMatrix ); 52 53 #include <begin_vertex> 54 #include <project_vertex> 55 56 } 57 `,fragmentShader:` 58 59 uniform sampler2D tEquirect; 60 61 varying vec3 vWorldDirection; 62 63 #include <common> 64 65 void main() { 66 67 vec3 direction = normalize( vWorldDirection ); 68 69 vec2 sampleUV = equirectUv( direction ); 70 71 gl_FragColor = texture2D( tEquirect, sampleUV ); 72 73 } 74 `},i=new Kn(5,5,5),s=new dn({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Gt,blending:Tn});s.uniforms.tEquirect.value=t;const a=new Tt(i,s),o=t.minFilter;return t.minFilter===Ci&&(t.minFilter=ft),new Pu(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}const uo=new A,Cp=new A,Ep=new kt;class Vn{constructor(e=new A(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=uo.subVectors(n,t).cross(Cp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(uo),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Ep.getNormalMatrix(e),i=this.coplanarPoint(uo).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Yi=new Pi,Br=new A;class Pa{constructor(e=new Vn,t=new Vn,n=new Vn,i=new Vn,s=new Vn,a=new Vn){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],a=n[2],o=n[3],l=n[4],c=n[5],u=n[6],f=n[7],p=n[8],g=n[9],x=n[10],h=n[11],d=n[12],m=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,f-l,h-p,y-d).normalize(),t[1].setComponents(o+i,f+l,h+p,y+d).normalize(),t[2].setComponents(o+s,f+c,h+g,y+m).normalize(),t[3].setComponents(o-s,f-c,h-g,y-m).normalize(),t[4].setComponents(o-a,f-u,h-x,y-v).normalize(),t[5].setComponents(o+a,f+u,h+x,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Yi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Yi)}intersectsSprite(e){return Yi.center.set(0,0,0),Yi.radius=.7071067811865476,Yi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Br.x=i.normal.x>0?e.max.x:e.min.x,Br.y=i.normal.y>0?e.max.y:e.min.y,Br.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Br)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Lu(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Pp(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const f=c.array,p=c.usage,g=r.createBuffer();r.bindBuffer(u,g),r.bufferData(u,f,p),c.onUploadCallback();let x;if(f instanceof Float32Array)x=5126;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)x=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else x=5123;else if(f instanceof Int16Array)x=5122;else if(f instanceof Uint32Array)x=5125;else if(f instanceof Int32Array)x=5124;else if(f instanceof Int8Array)x=5120;else if(f instanceof Uint8Array)x=5121;else if(f instanceof Uint8ClampedArray)x=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:g,type:x,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,f){const p=u.array,g=u.updateRange;r.bindBuffer(f,c),g.count===-1?r.bufferSubData(f,0,p):(t?r.bufferSubData(f,g.offset*p.BYTES_PER_ELEMENT,p,g.offset,g.count):r.bufferSubData(f,g.offset*p.BYTES_PER_ELEMENT,p.subarray(g.offset,g.offset+g.count)),g.count=-1)}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const p=n.get(c);(!p||p.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const f=n.get(c);f===void 0?n.set(c,i(c,u)):f.version<c.version&&(s(f.buffer,c,u),f.version=c.version)}return{get:a,remove:o,update:l}}class ps extends Ve{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,u=l+1,f=e/o,p=t/l,g=[],x=[],h=[],d=[];for(let m=0;m<u;m++){const v=m*p-a;for(let y=0;y<c;y++){const _=y*f-s;x.push(_,-v,0),h.push(0,0,1),d.push(y/o),d.push(1-m/l)}}for(let m=0;m<l;m++)for(let v=0;v<o;v++){const y=v+c*m,_=v+c*(m+1),S=v+1+c*(m+1),M=v+1+c*m;g.push(y,_,M),g.push(_,S,M)}this.setIndex(g),this.setAttribute("position",new Ee(x,3)),this.setAttribute("normal",new Ee(h,3)),this.setAttribute("uv",new Ee(d,2))}static fromJSON(e){return new ps(e.width,e.height,e.widthSegments,e.heightSegments)}}var Ip=`#ifdef USE_ALPHAMAP 75 diffuseColor.a *= texture2D( alphaMap, vUv ).g; 76#endif`,Lp=`#ifdef USE_ALPHAMAP 77 uniform sampler2D alphaMap; 78#endif`,Rp=`#ifdef USE_ALPHATEST 79 if ( diffuseColor.a < alphaTest ) discard; 80#endif`,zp=`#ifdef USE_ALPHATEST 81 uniform float alphaTest; 82#endif`,Dp=`#ifdef USE_AOMAP 83 float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; 84 reflectedLight.indirectDiffuse *= ambientOcclusion; 85 #if defined( USE_ENVMAP ) && defined( STANDARD ) 86 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 87 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 88 #endif 89#endif`,Op=`#ifdef USE_AOMAP 90 uniform sampler2D aoMap; 91 uniform float aoMapIntensity; 92#endif`,Np="vec3 transformed = vec3( position );",kp=`vec3 objectNormal = vec3( normal ); 93#ifdef USE_TANGENT 94 vec3 objectTangent = vec3( tangent.xyz ); 95#endif`,Bp=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 96 return RECIPROCAL_PI * diffuseColor; 97} 98vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 99 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 100 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 101} 102float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 103 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 104 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 105} 106vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 107 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 108 float x2 = x * x; 109 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 110 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 111} 112float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 113 float a2 = pow2( alpha ); 114 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 115 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 116 return 0.5 / max( gv + gl, EPSILON ); 117} 118float D_GGX( const in float alpha, const in float dotNH ) { 119 float a2 = pow2( alpha ); 120 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 121 return RECIPROCAL_PI * a2 / pow2( denom ); 122} 123vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { 124 float alpha = pow2( roughness ); 125 vec3 halfDir = normalize( lightDir + viewDir ); 126 float dotNL = saturate( dot( normal, lightDir ) ); 127 float dotNV = saturate( dot( normal, viewDir ) ); 128 float dotNH = saturate( dot( normal, halfDir ) ); 129 float dotVH = saturate( dot( viewDir, halfDir ) ); 130 vec3 F = F_Schlick( f0, f90, dotVH ); 131 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 132 float D = D_GGX( alpha, dotNH ); 133 return F * ( V * D ); 134} 135#ifdef USE_IRIDESCENCE 136 vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) { 137 float alpha = pow2( roughness ); 138 vec3 halfDir = normalize( lightDir + viewDir ); 139 float dotNL = saturate( dot( normal, lightDir ) ); 140 float dotNV = saturate( dot( normal, viewDir ) ); 141 float dotNH = saturate( dot( normal, halfDir ) ); 142 float dotVH = saturate( dot( viewDir, halfDir ) ); 143 vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence ); 144 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 145 float D = D_GGX( alpha, dotNH ); 146 return F * ( V * D ); 147 } 148#endif 149vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 150 const float LUT_SIZE = 64.0; 151 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 152 const float LUT_BIAS = 0.5 / LUT_SIZE;
153 float dotNV = saturate( dot( N, V ) ); 154 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 155 uv = uv * LUT_SCALE + LUT_BIAS; 156 return uv; 157} 158float LTC_ClippedSphereFormFactor( const in vec3 f ) { 159 float l = length( f ); 160 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 161} 162vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 163 float x = dot( v1, v2 ); 164 float y = abs( x ); 165 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 166 float b = 3.4175940 + ( 4.1616724 + y ) * y; 167 float v = a / b; 168 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 169 return cross( v1, v2 ) * theta_sintheta; 170} 171vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 172 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 173 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 174 vec3 lightNormal = cross( v1, v2 ); 175 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 176 vec3 T1, T2; 177 T1 = normalize( V - N * dot( V, N ) ); 178 T2 = - cross( N, T1 ); 179 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 180 vec3 coords[ 4 ]; 181 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 182 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 183 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 184 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 185 coords[ 0 ] = normalize( coords[ 0 ] ); 186 coords[ 1 ] = normalize( coords[ 1 ] ); 187 coords[ 2 ] = normalize( coords[ 2 ] ); 188 coords[ 3 ] = normalize( coords[ 3 ] ); 189 vec3 vectorFormFactor = vec3( 0.0 ); 190 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 191 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 192 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 193 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 194 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 195 return vec3( result ); 196} 197float G_BlinnPhong_Implicit( ) { 198 return 0.25; 199} 200float D_BlinnPhong( const in float shininess, const in float dotNH ) { 201 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 202} 203vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 204 vec3 halfDir = normalize( lightDir + viewDir ); 205 float dotNH = saturate( dot( normal, halfDir ) ); 206 float dotVH = saturate( dot( viewDir, halfDir ) ); 207 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 208 float G = G_BlinnPhong_Implicit( ); 209 float D = D_BlinnPhong( shininess, dotNH ); 210 return F * ( G * D ); 211} 212#if defined( USE_SHEEN ) 213float D_Charlie( float roughness, float dotNH ) { 214 float alpha = pow2( roughness ); 215 float invAlpha = 1.0 / alpha; 216 float cos2h = dotNH * dotNH; 217 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 218 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 219} 220float V_Neubelt( float dotNV, float dotNL ) { 221 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 222} 223vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 224 vec3 halfDir = normalize( lightDir + viewDir ); 225 float dotNL = saturate( dot( normal, lightDir ) ); 226 float dotNV = saturate( dot( normal, viewDir ) ); 227 float dotNH = saturate( dot( normal, halfDir ) ); 228 float D = D_Charlie( sheenRoughness, dotNH ); 229 float V = V_Neubelt( dotNV, dotNL ); 230 return sheenColor * ( D * V ); 231} 232#endif`,Fp=`#ifdef USE_IRIDESCENCE 233 const mat3 XYZ_TO_REC709 = mat3( 234 3.2404542, -0.9692660, 0.0556434, 235 -1.5371385, 1.8760108, -0.2040259, 236 -0.4985314, 0.0415560, 1.0572252 237 ); 238 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 239 vec3 sqrtF0 = sqrt( fresnel0 ); 240 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 241 } 242 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 243 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 244 } 245 float IorToFresnel0( float transmittedIor, float incidentIor ) { 246 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 247 } 248 vec3 evalSensitivity( float OPD, vec3 shift ) { 249 float phase = 2.0 * PI * OPD * 1.0e-9; 250 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 251 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 252 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 253 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 254 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 255 xyz /= 1.0685e-7; 256 vec3 rgb = XYZ_TO_REC709 * xyz; 257 return rgb; 258 } 259 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 260 vec3 I; 261 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 262 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 263 float cosTheta2Sq = 1.0 - sinTheta2Sq; 264 if ( cosTheta2Sq < 0.0 ) { 265 return vec3( 1.0 ); 266 } 267 float cosTheta2 = sqrt( cosTheta2Sq ); 268 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
269 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 270 float R21 = R12; 271 float T121 = 1.0 - R12; 272 float phi12 = 0.0; 273 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 274 float phi21 = PI - phi12; 275 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 276 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 277 vec3 phi23 = vec3( 0.0 ); 278 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 279 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 280 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 281 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 282 vec3 phi = vec3( phi21 ) + phi23; 283 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 284 vec3 r123 = sqrt( R123 ); 285 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 286 vec3 C0 = R12 + Rs; 287 I = C0; 288 vec3 Cm = Rs - T121; 289 for ( int m = 1; m <= 2; ++ m ) { 290 Cm *= r123; 291 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 292 I += Cm * Sm; 293 } 294 return max( I, vec3( 0.0 ) ); 295 } 296#endif`,Up=`#ifdef USE_BUMPMAP 297 uniform sampler2D bumpMap; 298 uniform float bumpScale; 299 vec2 dHdxy_fwd() { 300 vec2 dSTdx = dFdx( vUv ); 301 vec2 dSTdy = dFdy( vUv ); 302 float Hll = bumpScale * texture2D( bumpMap, vUv ).x; 303 float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; 304 float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; 305 return vec2( dBx, dBy ); 306 } 307 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 308 vec3 vSigmaX = dFdx( surf_pos.xyz ); 309 vec3 vSigmaY = dFdy( surf_pos.xyz ); 310 vec3 vN = surf_norm; 311 vec3 R1 = cross( vSigmaY, vN ); 312 vec3 R2 = cross( vN, vSigmaX ); 313 float fDet = dot( vSigmaX, R1 ) * faceDirection; 314 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 315 return normalize( abs( fDet ) * surf_norm - vGrad ); 316 } 317#endif`,Vp=`#if NUM_CLIPPING_PLANES > 0 318 vec4 plane; 319 #pragma unroll_loop_start 320 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 321 plane = clippingPlanes[ i ]; 322 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 323 } 324 #pragma unroll_loop_end 325 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 326 bool clipped = true; 327 #pragma unroll_loop_start 328 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 329 plane = clippingPlanes[ i ]; 330 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 331 } 332 #pragma unroll_loop_end 333 if ( clipped ) discard; 334 #endif 335#endif`,Hp=`#if NUM_CLIPPING_PLANES > 0 336 varying vec3 vClipPosition; 337 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 338#endif`,Gp=`#if NUM_CLIPPING_PLANES > 0 339 varying vec3 vClipPosition; 340#endif`,Wp=`#if NUM_CLIPPING_PLANES > 0 341 vClipPosition = - mvPosition.xyz; 342#endif`,Xp=`#if defined( USE_COLOR_ALPHA ) 343 diffuseColor *= vColor; 344#elif defined( USE_COLOR ) 345 diffuseColor.rgb *= vColor; 346#endif`,Zp=`#if defined( USE_COLOR_ALPHA ) 347 varying vec4 vColor; 348#elif defined( USE_COLOR ) 349 varying vec3 vColor; 350#endif`,jp=`#if defined( USE_COLOR_ALPHA ) 351 varying vec4 vColor; 352#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 353 varying vec3 vColor; 354#endif`,qp=`#if defined( USE_COLOR_ALPHA ) 355 vColor = vec4( 1.0 ); 356#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 357 vColor = vec3( 1.0 ); 358#endif 359#ifdef USE_COLOR 360 vColor *= color; 361#endif 362#ifdef USE_INSTANCING_COLOR 363 vColor.xyz *= instanceColor.xyz; 364#endif`,Yp=`#define PI 3.141592653589793 365#define PI2 6.283185307179586 366#define PI_HALF 1.5707963267948966 367#define RECIPROCAL_PI 0.3183098861837907 368#define RECIPROCAL_PI2 0.15915494309189535 369#define EPSILON 1e-6 370#ifndef saturate 371#define saturate( a ) clamp( a, 0.0, 1.0 ) 372#endif 373#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 374float pow2( const in float x ) { return x*x; } 375vec3 pow2( const in vec3 x ) { return x*x; } 376float pow3( const in float x ) { return x*x*x; } 377float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 378float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 379float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 380highp float rand( const in vec2 uv ) { 381 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 382 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 383 return fract( sin( sn ) * c ); 384} 385#ifdef HIGH_PRECISION 386 float precisionSafeLength( vec3 v ) { return length( v ); } 387#else 388 float precisionSafeLength( vec3 v ) { 389 float maxComponent = max3( abs( v ) ); 390 return length( v / maxComponent ) * maxComponent; 391 } 392#endif 393struct IncidentLight { 394 vec3 color; 395 vec3 direction; 396 bool visible; 397}; 398struct ReflectedLight { 399 vec3 directDiffuse; 400 vec3 directSpecular; 401 vec3 indirectDiffuse; 402 vec3 indirectSpecular; 403}; 404struct GeometricContext { 405 vec3 position; 406 vec3 normal; 407 vec3 viewDir; 408#ifdef USE_CLEARCOAT 409 vec3 clearcoatNormal; 410#endif 411}; 412vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 413 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 414} 415vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 416 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 417} 418mat3 transposeMat3( const in mat3 m ) { 419 mat3 tmp; 420 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 421 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 422 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 423 return tmp; 424} 425float luminance( const in vec3 rgb ) { 426 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 427 return dot( weights, rgb ); 428} 429bool isPerspectiveMatrix( mat4 m ) { 430 return m[ 2 ][ 3 ] == - 1.0; 431} 432vec2 equirectUv( in vec3 dir ) { 433 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 434 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 435 return vec2( u, v ); 436}`,$p=`#ifdef ENVMAP_TYPE_CUBE_UV 437 #define cubeUV_minMipLevel 4.0 438 #define cubeUV_minTileSize 16.0 439 float getFace( vec3 direction ) { 440 vec3 absDirection = abs( direction ); 441 float face = - 1.0; 442 if ( absDirection.x > absDirection.z ) { 443 if ( absDirection.x > absDirection.y ) 444 face = direction.x > 0.0 ? 0.0 : 3.0; 445 else 446 face = direction.y > 0.0 ? 1.0 : 4.0; 447 } else { 448 if ( absDirection.z > absDirection.y ) 449 face = direction.z > 0.0 ? 2.0 : 5.0; 450 else 451 face = direction.y > 0.0 ? 1.0 : 4.0; 452 } 453 return face; 454 } 455 vec2 getUV( vec3 direction, float face ) { 456 vec2 uv; 457 if ( face == 0.0 ) { 458 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 459 } else if ( face == 1.0 ) { 460 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 461 } else if ( face == 2.0 ) { 462 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 463 } else if ( face == 3.0 ) { 464 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 465 } else if ( face == 4.0 ) { 466 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 467 } else { 468 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 469 } 470 return 0.5 * ( uv + 1.0 ); 471 } 472 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 473 float face = getFace( direction ); 474 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 475 mipInt = max( mipInt, cubeUV_minMipLevel ); 476 float faceSize = exp2( mipInt ); 477 vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 478 if ( face > 2.0 ) { 479 uv.y += faceSize; 480 face -= 3.0; 481 } 482 uv.x += face * faceSize; 483 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 484 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 485 uv.x *= CUBEUV_TEXEL_WIDTH; 486 uv.y *= CUBEUV_TEXEL_HEIGHT; 487 #ifdef texture2DGradEXT 488 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 489 #else 490 return texture2D( envMap, uv ).rgb; 491 #endif 492 } 493 #define cubeUV_r0 1.0 494 #define cubeUV_v0 0.339 495 #define cubeUV_m0 - 2.0 496 #define cubeUV_r1 0.8 497 #define cubeUV_v1 0.276 498 #define cubeUV_m1 - 1.0 499 #define cubeUV_r4 0.4 500 #define cubeUV_v4 0.046 501 #define cubeUV_m4 2.0 502 #define cubeUV_r5 0.305 503 #define cubeUV_v5 0.016 504 #define cubeUV_m5 3.0 505 #define cubeUV_r6 0.21 506 #define cubeUV_v6 0.0038 507 #define cubeUV_m6 4.0 508 float roughnessToMip( float roughness ) { 509 float mip = 0.0; 510 if ( roughness >= cubeUV_r1 ) { 511 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 512 } else if ( roughness >= cubeUV_r4 ) { 513 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 514 } else if ( roughness >= cubeUV_r5 ) { 515 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 516 } else if ( roughness >= cubeUV_r6 ) { 517 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 518 } else { 519 mip = - 2.0 * log2( 1.16 * roughness ); } 520 return mip; 521 } 522 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 523 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 524 float mipF = fract( mip ); 525 float mipInt = floor( mip ); 526 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 527 if ( mipF == 0.0 ) { 528 return vec4( color0, 1.0 ); 529 } else { 530 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 531 return vec4( mix( color0, color1, mipF ), 1.0 ); 532 } 533 } 534#endif`,Jp=`vec3 transformedNormal = objectNormal; 535#ifdef USE_INSTANCING 536 mat3 m = mat3( instanceMatrix ); 537 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 538 transformedNormal = m * transformedNormal; 539#endif 540transformedNormal = normalMatrix * transformedNormal; 541#ifdef FLIP_SIDED 542 transformedNormal = - transformedNormal; 543#endif 544#ifdef USE_TANGENT 545 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 546 #ifdef FLIP_SIDED 547 transformedTangent = - transformedTangent; 548 #endif 549#endif`,Kp=`#ifdef USE_DISPLACEMENTMAP 550 uniform sampler2D displacementMap; 551 uniform float displacementScale; 552 uniform float displacementBias; 553#endif`,Qp=`#ifdef USE_DISPLACEMENTMAP 554 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
554placementBias ); 555#endif`,em=`#ifdef USE_EMISSIVEMAP 556 vec4 emissiveColor = texture2D( emissiveMap, vUv ); 557 totalEmissiveRadiance *= emissiveColor.rgb; 558#endif`,tm=`#ifdef USE_EMISSIVEMAP 559 uniform sampler2D emissiveMap; 560#endif`,nm="gl_FragColor = linearToOutputTexel( gl_FragColor );",im=`vec4 LinearToLinear( in vec4 value ) { 561 return value; 562} 563vec4 LinearTosRGB( in vec4 value ) { 564 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 565}`,sm=`#ifdef USE_ENVMAP 566 #ifdef ENV_WORLDPOS 567 vec3 cameraToFrag; 568 if ( isOrthographic ) { 569 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 570 } else { 571 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 572 } 573 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 574 #ifdef ENVMAP_MODE_REFLECTION 575 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 576 #else 577 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 578 #endif 579 #else 580 vec3 reflectVec = vReflect; 581 #endif 582 #ifdef ENVMAP_TYPE_CUBE 583 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 584 #else 585 vec4 envColor = vec4( 0.0 ); 586 #endif 587 #ifdef ENVMAP_BLENDING_MULTIPLY 588 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 589 #elif defined( ENVMAP_BLENDING_MIX ) 590 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 591 #elif defined( ENVMAP_BLENDING_ADD ) 592 outgoingLight += envColor.xyz * specularStrength * reflectivity; 593 #endif 594#endif`,rm=`#ifdef USE_ENVMAP 595 uniform float envMapIntensity; 596 uniform float flipEnvMap; 597 #ifdef ENVMAP_TYPE_CUBE 598 uniform samplerCube envMap; 599 #else 600 uniform sampler2D envMap; 601 #endif 602 603#endif`,am=`#ifdef USE_ENVMAP 604 uniform float reflectivity; 605 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 606 #define ENV_WORLDPOS 607 #endif 608 #ifdef ENV_WORLDPOS 609 varying vec3 vWorldPosition; 610 uniform float refractionRatio; 611 #else 612 varying vec3 vReflect; 613 #endif 614#endif`,om=`#ifdef USE_ENVMAP 615 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 616 #define ENV_WORLDPOS 617 #endif 618 #ifdef ENV_WORLDPOS 619 620 varying vec3 vWorldPosition; 621 #else 622 varying vec3 vReflect; 623 uniform float refractionRatio; 624 #endif 625#endif`,lm=`#ifdef USE_ENVMAP 626 #ifdef ENV_WORLDPOS 627 vWorldPosition = worldPosition.xyz; 628 #else 629 vec3 cameraToVertex; 630 if ( isOrthographic ) { 631 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 632 } else {
633 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 634 } 635 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 636 #ifdef ENVMAP_MODE_REFLECTION 637 vReflect = reflect( cameraToVertex, worldNormal ); 638 #else 639 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 640 #endif 641 #endif 642#endif`,cm=`#ifdef USE_FOG 643 vFogDepth = - mvPosition.z; 644#endif`,hm=`#ifdef USE_FOG 645 varying float vFogDepth; 646#endif`,um=`#ifdef USE_FOG 647 #ifdef FOG_EXP2 648 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 649 #else 650 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 651 #endif 652 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 653#endif`,dm=`#ifdef USE_FOG 654 uniform vec3 fogColor; 655 varying float vFogDepth; 656 #ifdef FOG_EXP2 657 uniform float fogDensity; 658 #else 659 uniform float fogNear; 660 uniform float fogFar; 661 #endif 662#endif`,fm=`#ifdef USE_GRADIENTMAP 663 uniform sampler2D gradientMap; 664#endif 665vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 666 float dotNL = dot( normal, lightDirection ); 667 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 668 #ifdef USE_GRADIENTMAP 669 return vec3( texture2D( gradientMap, coord ).r ); 670 #else 671 vec2 fw = fwidth( coord ) * 0.5; 672 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 673 #endif 674}`,pm=`#ifdef USE_LIGHTMAP 675 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 676 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 677 reflectedLight.indirectDiffuse += lightMapIrradiance; 678#endif`,mm=`#ifdef USE_LIGHTMAP 679 uniform sampler2D lightMap; 680 uniform float lightMapIntensity; 681#endif`,gm=`LambertMaterial material; 682material.diffuseColor = diffuseColor.rgb; 683material.specularStrength = specularStrength;`,xm=`varying vec3 vViewPosition; 684struct LambertMaterial { 685 vec3 diffuseColor; 686 float specularStrength; 687}; 688void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 689 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 690 vec3 irradiance = dotNL * directLight.color; 691 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 692} 693void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 694 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 695} 696#define RE_Direct RE_Direct_Lambert 697#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert 698#define Material_LightProbeLOD( material ) (0)`,ym=`uniform bool receiveShadow; 699uniform vec3 ambientLightColor; 700uniform vec3 lightProbe[ 9 ]; 701vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 702 float x = normal.x, y = normal.y, z = normal.z; 703 vec3 result = shCoefficients[ 0 ] * 0.886227; 704 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 705 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 706 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 707 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 708 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 709 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 710 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 711 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 712 return result; 713} 714vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 715 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 716 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 717 return irradiance; 718} 719vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 720 vec3 irradiance = ambientLightColor; 721 return irradiance; 722} 723float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 724 #if defined ( PHYSICALLY_CORRECT_LIGHTS ) 725 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 726 if ( cutoffDistance > 0.0 ) { 727 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 728 } 729 return distanceFalloff; 730 #else 731 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 732 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 733 } 734 return 1.0; 735 #endif 736} 737float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 738 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 739} 740#if NUM_DIR_LIGHTS > 0 741 struct DirectionalLight { 742 vec3 direction; 743 vec3 color; 744 }; 745 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 746 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 747 light.color = directionalLight.color; 748 light.direction = directionalLight.direction; 749 light.visible = true; 750 } 751#endif 752#if NUM_POINT_LIGHTS > 0 753 struct PointLight { 754 vec3 position; 755 vec3 color; 756 float distance; 757 float decay; 758 }; 759 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 760 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 761 vec3 lVector = pointLight.position - geometry.position; 762 light.direction = normalize( lVector ); 763 float lightDistance = length( lVector ); 764 light.color = pointLight.color; 765 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 766 light.visible = ( light.color != vec3( 0.0 ) ); 767 } 768#endif
769#if NUM_SPOT_LIGHTS > 0 770 struct SpotLight { 771 vec3 position; 772 vec3 direction; 773 vec3 color; 774 float distance; 775 float decay; 776 float coneCos; 777 float penumbraCos; 778 }; 779 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 780 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 781 vec3 lVector = spotLight.position - geometry.position; 782 light.direction = normalize( lVector ); 783 float angleCos = dot( light.direction, spotLight.direction ); 784 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 785 if ( spotAttenuation > 0.0 ) { 786 float lightDistance = length( lVector ); 787 light.color = spotLight.color * spotAttenuation; 788 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 789 light.visible = ( light.color != vec3( 0.0 ) ); 790 } else { 791 light.color = vec3( 0.0 ); 792 light.visible = false; 793 } 794 } 795#endif 796#if NUM_RECT_AREA_LIGHTS > 0 797 struct RectAreaLight { 798 vec3 color; 799 vec3 position; 800 vec3 halfWidth; 801 vec3 halfHeight; 802 }; 803 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 804 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 805#endif 806#if NUM_HEMI_LIGHTS > 0 807 struct HemisphereLight { 808 vec3 direction; 809 vec3 skyColor; 810 vec3 groundColor; 811 }; 812 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 813 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 814 float dotNL = dot( normal, hemiLight.direction ); 815 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 816 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 817 return irradiance; 818 } 819#endif`,_m=`#if defined( USE_ENVMAP ) 820 vec3 getIBLIrradiance( const in vec3 normal ) { 821 #if defined( ENVMAP_TYPE_CUBE_UV ) 822 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 823 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 824 return PI * envMapColor.rgb * envMapIntensity; 825 #else 826 return vec3( 0.0 ); 827 #endif 828 } 829 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 830 #if defined( ENVMAP_TYPE_CUBE_UV ) 831 vec3 reflectVec = reflect( - viewDir, normal ); 832 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 833 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 834 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 835 return envMapColor.rgb * envMapIntensity; 836 #else 837 return vec3( 0.0 ); 838 #endif 839 } 840#endif`,bm=`ToonMaterial material; 841material.diffuseColor = diffuseColor.rgb;`,vm=`varying vec3 vViewPosition; 842struct ToonMaterial { 843 vec3 diffuseColor; 844}; 845void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 846 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 847 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 848} 849void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 850 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 851} 852#define RE_Direct RE_Direct_Toon 853#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon 854#define Material_LightProbeLOD( material ) (0)`,wm=`BlinnPhongMaterial material; 855material.diffuseColor = diffuseColor.rgb; 856material.specularColor = specular; 857material.specularShininess = shininess; 858material.specularStrength = specularStrength;`,Sm=`varying vec3 vViewPosition; 859struct BlinnPhongMaterial { 860 vec3 diffuseColor; 861 vec3 specularColor; 862 float specularShininess; 863 float specularStrength; 864}; 865void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 866 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 867 vec3 irradiance = dotNL * directLight.color; 868 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 869 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 870} 871void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 872 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 873} 874#define RE_Direct RE_Direct_BlinnPhong 875#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong 876#define Material_LightProbeLOD( material ) (0)`,Mm=`PhysicalMaterial material; 877material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 878vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 879float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 880material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 881material.roughness = min( material.roughness, 1.0 ); 882#ifdef IOR 883 material.ior = ior; 884 #ifdef SPECULAR 885 float specularIntensityFactor = specularIntensity; 886 vec3 specularColorFactor = specularColor; 887 #ifdef USE_SPECULARINTENSITYMAP 888 specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; 889 #endif 890 #ifdef USE_SPECULARCOLORMAP 891 specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; 892 #endif 893 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 894 #else 895 float specularIntensityFactor = 1.0; 896 vec3 specularColorFactor = vec3( 1.0 ); 897 material.specularF90 = 1.0; 898 #endif 899 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 900#else 901 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 902 material.specularF90 = 1.0; 903#endif 904#ifdef USE_CLEARCOAT 905 material.clearcoat = clearcoat; 906 material.clearcoatRoughness = clearcoatRoughness; 907 material.clearcoatF0 = vec3( 0.04 ); 908 material.clearcoatF90 = 1.0; 909 #ifdef USE_CLEARCOATMAP 910 material.clearcoat *= texture2D( clearcoatMap, vUv ).x; 911 #endif 912 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 913 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; 914 #endif 915 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 916 material.clearcoatRoughness += geometryRoughness; 917 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 918#endif
919#ifdef USE_IRIDESCENCE 920 material.iridescence = iridescence; 921 material.iridescenceIOR = iridescenceIOR; 922 #ifdef USE_IRIDESCENCEMAP 923 material.iridescence *= texture2D( iridescenceMap, vUv ).r; 924 #endif 925 #ifdef USE_IRIDESCENCE_THICKNESSMAP 926 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; 927 #else 928 material.iridescenceThickness = iridescenceThicknessMaximum; 929 #endif 930#endif 931#ifdef USE_SHEEN 932 material.sheenColor = sheenColor; 933 #ifdef USE_SHEENCOLORMAP 934 material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; 935 #endif 936 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 937 #ifdef USE_SHEENROUGHNESSMAP 938 material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; 939 #endif 940#endif`,Tm=`struct PhysicalMaterial { 941 vec3 diffuseColor; 942 float roughness; 943 vec3 specularColor; 944 float specularF90; 945 #ifdef USE_CLEARCOAT 946 float clearcoat; 947 float clearcoatRoughness; 948 vec3 clearcoatF0; 949 float clearcoatF90; 950 #endif 951 #ifdef USE_IRIDESCENCE 952 float iridescence; 953 float iridescenceIOR; 954 float iridescenceThickness; 955 vec3 iridescenceFresnel; 956 vec3 iridescenceF0; 957 #endif 958 #ifdef USE_SHEEN 959 vec3 sheenColor; 960 float sheenRoughness; 961 #endif 962 #ifdef IOR 963 float ior; 964 #endif 965 #ifdef USE_TRANSMISSION 966 float transmission; 967 float transmissionAlpha; 968 float thickness; 969 float attenuationDistance; 970 vec3 attenuationColor; 971 #endif 972}; 973vec3 clearcoatSpecular = vec3( 0.0 ); 974vec3 sheenSpecular = vec3( 0.0 ); 975float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 976 float dotNV = saturate( dot( normal, viewDir ) ); 977 float r2 = roughness * roughness; 978 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 979 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 980 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 981 return saturate( DG * RECIPROCAL_PI ); 982} 983vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 984 float dotNV = saturate( dot( normal, viewDir ) ); 985 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 986 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 987 vec4 r = roughness * c0 + c1; 988 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 989 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 990 return fab; 991} 992vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 993 vec2 fab = DFGApprox( normal, viewDir, roughness ); 994 return specularColor * fab.x + specularF90 * fab.y; 995} 996#ifdef USE_IRIDESCENCE 997void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 998#else 999void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1000#endif 1001 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1002 #ifdef USE_IRIDESCENCE 1003 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1004 #else 1005 vec3 Fr = specularColor; 1006 #endif 1007 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1008 float Ess = fab.x + fab.y; 1009 float Ems = 1.0 - Ess; 1010 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1011 singleScatter += FssEss; 1012 multiScatter += Fms * Ems; 1013} 1014#if NUM_RECT_AREA_LIGHTS > 0 1015 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1016 vec3 normal = geometry.normal; 1017 vec3 viewDir = geometry.viewDir; 1018 vec3 position = geometry.position; 1019 vec3 lightPos = rectAreaLight.position; 1020 vec3 halfWidth = rectAreaLight.halfWidth; 1021 vec3 halfHeight = rectAreaLight.halfHeight; 1022 vec3 lightColor = rectAreaLight.color; 1023 float roughness = material.roughness; 1024 vec3 rectCoords[ 4 ]; 1025 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1026 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1027 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1028 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1029 vec4 t1 = texture2D( ltc_1, uv ); 1030 vec4 t2 = texture2D( ltc_2, uv ); 1031 mat3 mInv = mat3( 1032 vec3( t1.x, 0, t1.y ), 1033 vec3( 0, 1, 0 ), 1034 vec3( t1.z, 0, t1.w ) 1035 ); 1036 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1037 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1038 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1039 } 1040#endif 1041void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1042 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1043 vec3 irradiance = dotNL * directLight.color; 1044 #ifdef USE_CLEARCOAT 1045 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1046 vec3 ccIrradiance = dotNLcc * directLight.color; 1047 clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1048 #endif 1049 #ifdef USE_SHEEN 1050 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1051 #endif 1052 #ifdef USE_IRIDESCENCE 1053 reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); 1054 #else 1055 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); 1056 #endif 1057 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1058} 1059void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1060 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1061} 1062void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1063 #ifdef USE_CLEARCOAT 1064 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1065 #endif 1066 #ifdef USE_SHEEN 1067 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1068 #endif 1069 vec3 singleScattering = vec3( 0.0 ); 1070 vec3 multiScattering = vec3( 0.0 ); 1071 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1072 #ifdef USE_IRIDESCENCE 1073 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1074 #else 1075 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1076 #endif 1077 vec3 totalScattering = singleScattering + multiScattering; 1078 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1079 reflectedLight.indirectSpecular += radiance * singleScattering; 1080 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1081 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1082} 1083#define RE_Direct RE_Direct_Physical 1084#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1085#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1086#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1087float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1088 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1089}`,Am=` 1090GeometricContext geometry; 1091geometry.position = - vViewPosition; 1092geometry.normal = normal; 1093geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1094#ifdef USE_CLEARCOAT 1095 geometry.clearcoatNormal = clearcoatNormal; 1096#endif 1097#ifdef USE_IRIDESCENCE 1098 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1099 if ( material.iridescenceThickness == 0.0 ) { 1100 material.iridescence = 0.0; 1101 } else { 1102 material.iridescence = saturate( material.iridescence ); 1103 } 1104 if ( material.iridescence > 0.0 ) { 1105 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1106 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1107 } 1108#endif 1109IncidentLight directLight; 1110#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1111 PointLight pointLight; 1112 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1113 PointLightShadow pointLightShadow; 1114 #endif 1115 #pragma unroll_loop_start 1116 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1117 pointLight = pointLights[ i ]; 1118 getPointLightInfo( pointLight, geometry, directLight ); 1119 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1120 pointLightShadow = pointLightShadows[ i ]; 1121 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1122 #endif 1123 RE_Direct( directLight, geometry, material, reflectedLight ); 1124 } 1125 #pragma unroll_loop_end 1126#endif
1127#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1128 SpotLight spotLight; 1129 vec4 spotColor; 1130 vec3 spotLightCoord; 1131 bool inSpotLightMap; 1132 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1133 SpotLightShadow spotLightShadow; 1134 #endif 1135 #pragma unroll_loop_start 1136 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1137 spotLight = spotLights[ i ]; 1138 getSpotLightInfo( spotLight, geometry, directLight ); 1139 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1140 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1141 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1142 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1143 #else 1144 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1145 #endif 1146 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1147 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1148 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1149 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1150 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1151 #endif 1152 #undef SPOT_LIGHT_MAP_INDEX 1153 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1154 spotLightShadow = spotLightShadows[ i ]; 1155 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1156 #endif 1157 RE_Direct( directLight, geometry, material, reflectedLight ); 1158 } 1159 #pragma unroll_loop_end 1160#endif 1161#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1162 DirectionalLight directionalLight; 1163 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1164 DirectionalLightShadow directionalLightShadow; 1165 #endif 1166 #pragma unroll_loop_start 1167 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1168 directionalLight = directionalLights[ i ]; 1169 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1170 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1171 directionalLightShadow = directionalLightShadows[ i ]; 1172 directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1173 #endif 1174 RE_Direct( directLight, geometry, material, reflectedLight ); 1175 } 1176 #pragma unroll_loop_end 1177#endif 1178#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1179 RectAreaLight rectAreaLight; 1180 #pragma unroll_loop_start 1181 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1182 rectAreaLight = rectAreaLights[ i ]; 1183 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1184 } 1185 #pragma unroll_loop_end 1186#endif 1187#if defined( RE_IndirectDiffuse ) 1188 vec3 iblIrradiance = vec3( 0.0 ); 1189 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1190 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1191 #if ( NUM_HEMI_LIGHTS > 0 ) 1192 #pragma unroll_loop_start 1193 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1194 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1195 } 1196 #pragma unroll_loop_end 1197 #endif 1198#endif 1199#if defined( RE_IndirectSpecular ) 1200 vec3 radiance = vec3( 0.0 ); 1201 vec3 clearcoatRadiance = vec3( 0.0 ); 1202#endif`,Cm=`#if defined( RE_IndirectDiffuse ) 1203 #ifdef USE_LIGHTMAP 1204 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 1205 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1206 irradiance += lightMapIrradiance; 1207 #endif 1208 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1209 iblIrradiance += getIBLIrradiance( geometry.normal ); 1210 #endif 1211#endif 1212#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1213 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1214 #ifdef USE_CLEARCOAT 1215 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1216 #endif 1217#endif`,Em=`#if defined( RE_IndirectDiffuse ) 1218 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1219#endif 1220#if defined( RE_IndirectSpecular ) 1221 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1222#endif`,Pm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1223 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1224#endif`,Im=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1225 uniform float logDepthBufFC; 1226 varying float vFragDepth; 1227 varying float vIsPerspective; 1228#endif`,Lm=`#ifdef USE_LOGDEPTHBUF 1229 #ifdef USE_LOGDEPTHBUF_EXT 1230 varying float vFragDepth; 1231 varying float vIsPerspective; 1232 #else 1233 uniform float logDepthBufFC; 1234 #endif 1235#endif`,Rm=`#ifdef USE_LOGDEPTHBUF 1236 #ifdef USE_LOGDEPTHBUF_EXT 1237 vFragDepth = 1.0 + gl_Position.w; 1238 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1239 #else 1240 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1241 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1242 gl_Position.z *= gl_Position.w; 1243 } 1244 #endif 1245#endif`,zm=`#ifdef USE_MAP 1246 vec4 sampledDiffuseColor = texture2D( map, vUv ); 1247 #ifdef DECODE_VIDEO_TEXTURE 1248 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1249 #endif 1250 diffuseColor *= sampledDiffuseColor; 1251#endif`,Dm=`#ifdef USE_MAP 1252 uniform sampler2D map; 1253#endif`,Om=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1254 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1255#endif 1256#ifdef USE_MAP 1257 diffuseColor *= texture2D( map, uv ); 1258#endif 1259#ifdef USE_ALPHAMAP 1260 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1261#endif`,Nm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1262 uniform mat3 uvTransform; 1263#endif 1264#ifdef USE_MAP 1265 uniform sampler2D map; 1266#endif 1267#ifdef USE_ALPHAMAP 1268 uniform sampler2D alphaMap; 1269#endif`,km=`float metalnessFactor = metalness; 1270#ifdef USE_METALNESSMAP 1271 vec4 texelMetalness = texture2D( metalnessMap, vUv ); 1272 metalnessFactor *= texelMetalness.b; 1273#endif`,Bm=`#ifdef USE_METALNESSMAP 1274 uniform sampler2D metalnessMap; 1275#endif`,Fm=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1276 vColor *= morphTargetBaseInfluence; 1277 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1278 #if defined( USE_COLOR_ALPHA ) 1279 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1280 #elif defined( USE_COLOR ) 1281 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1282 #endif 1283 } 1284#endif`,Um=`#ifdef USE_MORPHNORMALS 1285 objectNormal *= morphTargetBaseInfluence; 1286 #ifdef MORPHTARGETS_TEXTURE 1287 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1288 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1289 } 1290 #else 1291 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1292 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1293 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1294 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1295 #endif 1296#endif`,Vm=`#ifdef USE_MORPHTARGETS 1297 uniform float morphTargetBaseInfluence; 1298 #ifdef MORPHTARGETS_TEXTURE 1299 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1300 uniform sampler2DArray morphTargetsTexture; 1301 uniform ivec2 morphTargetsTextureSize; 1302 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1303 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1304 int y = texelIndex / morphTargetsTextureSize.x; 1305 int x = texelIndex - y * morphTargetsTextureSize.x; 1306 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1307 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1308 } 1309 #else 1310 #ifndef USE_MORPHNORMALS 1311 uniform float morphTargetInfluences[ 8 ]; 1312 #else 1313 uniform float morphTargetInfluences[ 4 ]; 1314 #endif 1315 #endif 1316#endif`,Hm=`#ifdef USE_MORPHTARGETS 1317 transformed *= morphTargetBaseInfluence; 1318 #ifdef MORPHTARGETS_TEXTURE 1319 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1320 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1321 } 1322 #else 1323 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1324 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1325 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1326 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1327 #ifndef USE_MORPHNORMALS 1328 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1329 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1330 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1331 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1332 #endif 1333 #endif 1334#endif`,Gm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1335#ifdef FLAT_SHADED 1336 vec3 fdx = dFdx( vViewPosition ); 1337 vec3 fdy = dFdy( vViewPosition ); 1338 vec3 normal = normalize( cross( fdx, fdy ) ); 1339#else 1340 vec3 normal = normalize( vNormal ); 1341 #ifdef DOUBLE_SIDED 1342 normal = normal * faceDirection; 1343 #endif 1344 #ifdef USE_TANGENT 1345 vec3 tangent = normalize( vTangent ); 1346 vec3 bitangent = normalize( vBitangent ); 1347 #ifdef DOUBLE_SIDED 1348 tangent = tangent * faceDirection; 1349 bitangent = bitangent * faceDirection; 1350 #endif 1351 #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) 1352 mat3 vTBN = mat3( tangent, bitangent, normal ); 1353 #endif 1354 #endif 1355#endif 1356vec3 geometryNormal = normal;`,Wm=`#ifdef OBJECTSPACE_NORMALMAP 1357 normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1358 #ifdef FLIP_SIDED 1359 normal = - normal; 1360 #endif 1361 #ifdef DOUBLE_SIDED 1362 normal = normal * faceDirection; 1363 #endif 1364 normal = normalize( normalMatrix * normal ); 1365#elif defined( TANGENTSPACE_NORMALMAP ) 1366 vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1367 mapN.xy *= normalScale; 1368 #ifdef USE_TANGENT 1369 normal = normalize( vTBN * mapN ); 1370 #else
1371 normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); 1372 #endif 1373#elif defined( USE_BUMPMAP ) 1374 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1375#endif`,Xm=`#ifndef FLAT_SHADED 1376 varying vec3 vNormal; 1377 #ifdef USE_TANGENT 1378 varying vec3 vTangent; 1379 varying vec3 vBitangent; 1380 #endif 1381#endif`,Zm=`#ifndef FLAT_SHADED 1382 varying vec3 vNormal; 1383 #ifdef USE_TANGENT 1384 varying vec3 vTangent; 1385 varying vec3 vBitangent; 1386 #endif 1387#endif`,jm=`#ifndef FLAT_SHADED 1388 vNormal = normalize( transformedNormal ); 1389 #ifdef USE_TANGENT 1390 vTangent = normalize( transformedTangent ); 1391 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1392 #endif 1393#endif`,qm=`#ifdef USE_NORMALMAP 1394 uniform sampler2D normalMap; 1395 uniform vec2 normalScale; 1396#endif 1397#ifdef OBJECTSPACE_NORMALMAP 1398 uniform mat3 normalMatrix; 1399#endif 1400#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1401 vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { 1402 vec3 q0 = dFdx( eye_pos.xyz ); 1403 vec3 q1 = dFdy( eye_pos.xyz ); 1404 vec2 st0 = dFdx( vUv.st ); 1405 vec2 st1 = dFdy( vUv.st ); 1406 vec3 N = surf_norm; 1407 vec3 q1perp = cross( q1, N ); 1408 vec3 q0perp = cross( N, q0 ); 1409 vec3 T = q1perp * st0.x + q0perp * st1.x; 1410 vec3 B = q1perp * st0.y + q0perp * st1.y; 1411 float det = max( dot( T, T ), dot( B, B ) ); 1412 float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); 1413 return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); 1414 } 1415#endif`,Ym=`#ifdef USE_CLEARCOAT 1416 vec3 clearcoatNormal = geometryNormal; 1417#endif`,$m=`#ifdef USE_CLEARCOAT_NORMALMAP 1418 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; 1419 clearcoatMapN.xy *= clearcoatNormalScale; 1420 #ifdef USE_TANGENT 1421 clearcoatNormal = normalize( vTBN * clearcoatMapN ); 1422 #else 1423 clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); 1424 #endif 1425#endif`,Jm=`#ifdef USE_CLEARCOATMAP 1426 uniform sampler2D clearcoatMap; 1427#endif 1428#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1429 uniform sampler2D clearcoatRoughnessMap; 1430#endif 1431#ifdef USE_CLEARCOAT_NORMALMAP 1432 uniform sampler2D clearcoatNormalMap; 1433 uniform vec2 clearcoatNormalScale; 1434#endif`,Km=`#ifdef USE_IRIDESCENCEMAP 1435 uniform sampler2D iridescenceMap; 1436#endif 1437#ifdef USE_IRIDESCENCE_THICKNESSMAP 1438 uniform sampler2D iridescenceThicknessMap; 1439#endif`,Qm=`#ifdef OPAQUE 1440diffuseColor.a = 1.0; 1441#endif 1442#ifdef USE_TRANSMISSION 1443diffuseColor.a *= material.transmissionAlpha + 0.1; 1444#endif 1445gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,eg=`vec3 packNormalToRGB( const in vec3 normal ) { 1446 return normalize( normal ) * 0.5 + 0.5; 1447} 1448vec3 unpackRGBToNormal( const in vec3 rgb ) { 1449 return 2.0 * rgb.xyz - 1.0; 1450} 1451const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1452const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1453const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1454const float ShiftRight8 = 1. / 256.; 1455vec4 packDepthToRGBA( const in float v ) { 1456 vec4 r = vec4( fract( v * PackFactors ), v ); 1457 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1458} 1459float unpackRGBAToDepth( const in vec4 v ) { 1460 return dot( v, UnpackFactors ); 1461} 1462vec2 packDepthToRG( in highp float v ) { 1463 return packDepthToRGBA( v ).yx; 1464} 1465float unpackRGToDepth( const in highp vec2 v ) { 1466 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1467} 1468vec4 pack2HalfToRGBA( vec2 v ) { 1469 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1470 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1471} 1472vec2 unpackRGBATo2Half( vec4 v ) { 1473 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1474} 1475float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1476 return ( viewZ + near ) / ( near - far ); 1477} 1478float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { 1479 return linearClipZ * ( near - far ) - near; 1480} 1481float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1482 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1483} 1484float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { 1485 return ( near * far ) / ( ( far - near ) * invClipZ - far ); 1486}`,tg=`#ifdef PREMULTIPLIED_ALPHA 1487 gl_FragColor.rgb *= gl_FragColor.a; 1488#endif`,ng=`vec4 mvPosition = vec4( transformed, 1.0 ); 1489#ifdef USE_INSTANCING 1490 mvPosition = instanceMatrix * mvPosition; 1491#endif 1492mvPosition = modelViewMatrix * mvPosition; 1493gl_Position = projectionMatrix * mvPosition;`,ig=`#ifdef DITHERING 1494 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1495#endif`,sg=`#ifdef DITHERING 1496 vec3 dithering( vec3 color ) { 1497 float grid_position = rand( gl_FragCoord.xy ); 1498 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1499 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1500 return color + dither_shift_RGB; 1501 } 1502#endif`,rg=`float roughnessFactor = roughness; 1503#ifdef USE_ROUGHNESSMAP 1504 vec4 texelRoughness = texture2D( roughnessMap, vUv ); 1505 roughnessFactor *= texelRoughness.g; 1506#endif`,ag=`#ifdef USE_ROUGHNESSMAP 1507 uniform sampler2D roughnessMap;
1508#endif`,og=`#if NUM_SPOT_LIGHT_COORDS > 0 1509 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1510#endif 1511#if NUM_SPOT_LIGHT_MAPS > 0 1512 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1513#endif 1514#ifdef USE_SHADOWMAP 1515 #if NUM_DIR_LIGHT_SHADOWS > 0 1516 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1517 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1518 struct DirectionalLightShadow { 1519 float shadowBias; 1520 float shadowNormalBias; 1521 float shadowRadius; 1522 vec2 shadowMapSize; 1523 }; 1524 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1525 #endif 1526 #if NUM_SPOT_LIGHT_SHADOWS > 0 1527 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1528 struct SpotLightShadow { 1529 float shadowBias; 1530 float shadowNormalBias; 1531 float shadowRadius; 1532 vec2 shadowMapSize; 1533 }; 1534 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1535 #endif 1536 #if NUM_POINT_LIGHT_SHADOWS > 0 1537 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1538 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1539 struct PointLightShadow { 1540 float shadowBias; 1541 float shadowNormalBias; 1542 float shadowRadius; 1543 vec2 shadowMapSize; 1544 float shadowCameraNear; 1545 float shadowCameraFar; 1546 }; 1547 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1548 #endif 1549 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1550 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1551 } 1552 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1553 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1554 } 1555 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1556 float occlusion = 1.0; 1557 vec2 distribution = texture2DDistribution( shadow, uv ); 1558 float hard_shadow = step( compare , distribution.x ); 1559 if (hard_shadow != 1.0 ) { 1560 float distance = compare - distribution.x ; 1561 float variance = max( 0.00000, distribution.y * distribution.y ); 1562 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1563 } 1564 return occlusion; 1565 } 1566 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1567 float shadow = 1.0; 1568 shadowCoord.xyz /= shadowCoord.w; 1569 shadowCoord.z += shadowBias; 1570 bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); 1571 bool inFrustum = all( inFrustumVec ); 1572 bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); 1573 bool frustumTest = all( frustumTestVec ); 1574 if ( frustumTest ) { 1575 #if defined( SHADOWMAP_TYPE_PCF ) 1576 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1577 float dx0 = - texelSize.x * shadowRadius; 1578 float dy0 = - texelSize.y * shadowRadius; 1579 float dx1 = + texelSize.x * shadowRadius; 1580 float dy1 = + texelSize.y * shadowRadius; 1581 float dx2 = dx0 / 2.0; 1582 float dy2 = dy0 / 2.0; 1583 float dx3 = dx1 / 2.0; 1584 float dy3 = dy1 / 2.0; 1585 shadow = ( 1586 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1587 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1588 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1589 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1590 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1591 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1592 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1593 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1594 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1595 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1596 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1597 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1598 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1599 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1600 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1601 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1602 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1603 ) * ( 1.0 / 17.0 ); 1604 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1605 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1606 float dx = texelSize.x; 1607 float dy = texelSize.y; 1608 vec2 uv = shadowCoord.xy;
1609 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1610 uv -= f * texelSize; 1611 shadow = ( 1612 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1613 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1614 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1615 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1616 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1617 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1618 f.x ) + 1619 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1620 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1621 f.x ) + 1622 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1623 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1624 f.y ) + 1625 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1626 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1627 f.y ) + 1628 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1629 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1630 f.x ), 1631 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1632 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1633 f.x ), 1634 f.y ) 1635 ) * ( 1.0 / 9.0 ); 1636 #elif defined( SHADOWMAP_TYPE_VSM ) 1637 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1638 #else 1639 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1640 #endif 1641 } 1642 return shadow; 1643 } 1644 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1645 vec3 absV = abs( v ); 1646 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1647 absV *= scaleToCube; 1648 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1649 vec2 planar = v.xy; 1650 float almostATexel = 1.5 * texelSizeY; 1651 float almostOne = 1.0 - almostATexel; 1652 if ( absV.z >= almostOne ) { 1653 if ( v.z > 0.0 ) 1654 planar.x = 4.0 - v.x; 1655 } else if ( absV.x >= almostOne ) { 1656 float signX = sign( v.x ); 1657 planar.x = v.z * signX + 2.0 * signX; 1658 } else if ( absV.y >= almostOne ) { 1659 float signY = sign( v.y ); 1660 planar.x = v.x + 2.0 * signY + 2.0; 1661 planar.y = v.z * signY - 2.0; 1662 } 1663 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1664 } 1665 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1666 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1667 vec3 lightToPosition = shadowCoord.xyz; 1668 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1669 vec3 bd3D = normalize( lightToPosition ); 1670 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1671 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1672 return ( 1673 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1674 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1675 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1676 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1677 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1678 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1679 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1680 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1681 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1682 ) * ( 1.0 / 9.0 ); 1683 #else 1684 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1685 #endif 1686 } 1687#endif`,lg=`#if NUM_SPOT_LIGHT_COORDS > 0 1688 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1689 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1690#endif 1691#ifdef USE_SHADOWMAP 1692 #if NUM_DIR_LIGHT_SHADOWS > 0 1693 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1694 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1695 struct DirectionalLightShadow { 1696 float shadowBias; 1697 float shadowNormalBias; 1698 float shadowRadius; 1699 vec2 shadowMapSize; 1700 }; 1701 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1702 #endif
1703 #if NUM_SPOT_LIGHT_SHADOWS > 0 1704 struct SpotLightShadow { 1705 float shadowBias; 1706 float shadowNormalBias; 1707 float shadowRadius; 1708 vec2 shadowMapSize; 1709 }; 1710 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1711 #endif 1712 #if NUM_POINT_LIGHT_SHADOWS > 0 1713 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1714 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1715 struct PointLightShadow { 1716 float shadowBias; 1717 float shadowNormalBias; 1718 float shadowRadius; 1719 vec2 shadowMapSize; 1720 float shadowCameraNear; 1721 float shadowCameraFar; 1722 }; 1723 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1724 #endif 1725#endif`,cg=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1726 #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 1727 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1728 vec4 shadowWorldPosition; 1729 #endif 1730 #if NUM_DIR_LIGHT_SHADOWS > 0 1731 #pragma unroll_loop_start 1732 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1733 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1734 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1735 } 1736 #pragma unroll_loop_end 1737 #endif 1738 #if NUM_SPOT_LIGHT_COORDS > 0 1739 #pragma unroll_loop_start 1740 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1741 shadowWorldPosition = worldPosition; 1742 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1743 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1744 #endif 1745 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1746 } 1747 #pragma unroll_loop_end 1748 #endif 1749 #if NUM_POINT_LIGHT_SHADOWS > 0 1750 #pragma unroll_loop_start 1751 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1752 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1753 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1754 } 1755 #pragma unroll_loop_end 1756 #endif 1757#endif`,hg=`float getShadowMask() { 1758 float shadow = 1.0; 1759 #ifdef USE_SHADOWMAP 1760 #if NUM_DIR_LIGHT_SHADOWS > 0 1761 DirectionalLightShadow directionalLight; 1762 #pragma unroll_loop_start 1763 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1764 directionalLight = directionalLightShadows[ i ]; 1765 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1766 } 1767 #pragma unroll_loop_end 1768 #endif 1769 #if NUM_SPOT_LIGHT_SHADOWS > 0 1770 SpotLightShadow spotLight; 1771 #pragma unroll_loop_start 1772 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1773 spotLight = spotLightShadows[ i ]; 1774 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1775 } 1776 #pragma unroll_loop_end 1777 #endif 1778 #if NUM_POINT_LIGHT_SHADOWS > 0 1779 PointLightShadow pointLight; 1780 #pragma unroll_loop_start 1781 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1782 pointLight = pointLightShadows[ i ]; 1783 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1784 } 1785 #pragma unroll_loop_end 1786 #endif 1787 #endif 1788 return shadow; 1789}`,ug=`#ifdef USE_SKINNING 1790 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1791 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1792 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1793 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1794#endif`,dg=`#ifdef USE_SKINNING 1795 uniform mat4 bindMatrix; 1796 uniform mat4 bindMatrixInverse; 1797 uniform highp sampler2D boneTexture; 1798 uniform int boneTextureSize; 1799 mat4 getBoneMatrix( const in float i ) { 1800 float j = i * 4.0; 1801 float x = mod( j, float( boneTextureSize ) ); 1802 float y = floor( j / float( boneTextureSize ) ); 1803 float dx = 1.0 / float( boneTextureSize ); 1804 float dy = 1.0 / float( boneTextureSize ); 1805 y = dy * ( y + 0.5 ); 1806 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1807 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1808 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1809 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1810 mat4 bone = mat4( v1, v2, v3, v4 ); 1811 return bone; 1812 } 1813#endif`,fg=`#ifdef USE_SKINNING 1814 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1815 vec4 skinned = vec4( 0.0 ); 1816 skinned += boneMatX * skinVertex * skinWeight.x; 1817 skinned += boneMatY * skinVertex * skinWeight.y; 1818 skinned += boneMatZ * skinVertex * skinWeight.z; 1819 skinned += boneMatW * skinVertex * skinWeight.w; 1820 transformed = ( bindMatrixInverse * skinned ).xyz; 1821#endif`,pg=`#ifdef USE_SKINNING 1822 mat4 skinMatrix = mat4( 0.0 ); 1823 skinMatrix += skinWeight.x * boneMatX; 1824 skinMatrix += skinWeight.y * boneMatY; 1825 skinMatrix += skinWeight.z * boneMatZ; 1826 skinMatrix += skinWeight.w * boneMatW; 1827 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1828 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1829 #ifdef USE_TANGENT 1830 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1831 #endif 1832#endif`,mg=`float specularStrength; 1833#ifdef USE_SPECULARMAP 1834 vec4 texelSpecular = texture2D( specularMap, vUv ); 1835 specularStrength = texelSpecular.r; 1836#else 1837 specularStrength = 1.0; 1838#endif`,gg=`#ifdef USE_SPECULARMAP 1839 uniform sampler2D specularMap; 1840#endif`,xg=`#if defined( TONE_MAPPING ) 1841 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1842#endif`,yg=`#ifndef saturate 1843#define saturate( a ) clamp( a, 0.0, 1.0 ) 1844#endif 1845uniform float toneMappingExposure; 1846vec3 LinearToneMapping( vec3 color ) { 1847 return toneMappingExposure * color; 1848} 1849vec3 ReinhardToneMapping( vec3 color ) { 1850 color *= toneMappingExposure; 1851 return saturate( color / ( vec3( 1.0 ) + color ) ); 1852} 1853vec3 OptimizedCineonToneMapping( vec3 color ) { 1854 color *= toneMappingExposure; 1855 color = max( vec3( 0.0 ), color - 0.004 ); 1856 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1857} 1858vec3 RRTAndODTFit( vec3 v ) { 1859 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1860 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1861 return a / b; 1862} 1863vec3 ACESFilmicToneMapping( vec3 color ) { 1864 const mat3 ACESInputMat = mat3( 1865 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1866 vec3( 0.04823, 0.01566, 0.83777 ) 1867 ); 1868 const mat3 ACESOutputMat = mat3( 1869 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1870 vec3( -0.07367, -0.00605, 1.07602 ) 1871 ); 1872 color *= toneMappingExposure / 0.6; 1873 color = ACESInputMat * color; 1874 color = RRTAndODTFit( color ); 1875 color = ACESOutputMat * color; 1876 return saturate( color ); 1877} 1878vec3 CustomToneMapping( vec3 color ) { return color; }`,_g=`#ifdef USE_TRANSMISSION 1879 material.transmission = transmission; 1880 material.transmissionAlpha = 1.0; 1881 material.thickness = thickness; 1882 material.attenuationDistance = attenuationDistance; 1883 material.attenuationColor = attenuationColor; 1884 #ifdef USE_TRANSMISSIONMAP 1885 material.transmission *= texture2D( transmissionMap, vUv ).r; 1886 #endif 1887 #ifdef USE_THICKNESSMAP 1888 material.thickness *= texture2D( thicknessMap, vUv ).g;
1889 #endif 1890 vec3 pos = vWorldPosition; 1891 vec3 v = normalize( cameraPosition - pos ); 1892 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1893 vec4 transmission = getIBLVolumeRefraction( 1894 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1895 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1896 material.attenuationColor, material.attenuationDistance ); 1897 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1898 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1899#endif`,bg=`#ifdef USE_TRANSMISSION 1900 uniform float transmission; 1901 uniform float thickness; 1902 uniform float attenuationDistance; 1903 uniform vec3 attenuationColor; 1904 #ifdef USE_TRANSMISSIONMAP 1905 uniform sampler2D transmissionMap; 1906 #endif 1907 #ifdef USE_THICKNESSMAP 1908 uniform sampler2D thicknessMap; 1909 #endif 1910 uniform vec2 transmissionSamplerSize; 1911 uniform sampler2D transmissionSamplerMap; 1912 uniform mat4 modelMatrix; 1913 uniform mat4 projectionMatrix; 1914 varying vec3 vWorldPosition; 1915 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1916 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1917 vec3 modelScale; 1918 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1919 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1920 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1921 return normalize( refractionVector ) * thickness * modelScale; 1922 } 1923 float applyIorToRoughness( const in float roughness, const in float ior ) { 1924 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1925 } 1926 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1927 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1928 #ifdef texture2DLodEXT 1929 return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1930 #else 1931 return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1932 #endif 1933 } 1934 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1935 if ( isinf( attenuationDistance ) ) { 1936 return radiance; 1937 } else { 1938 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1939 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1940 } 1941 } 1942 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1943 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1944 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1945 const in vec3 attenuationColor, const in float attenuationDistance ) { 1946 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1947 vec3 refractedRayExit = position + transmissionRay; 1948 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1949 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1950 refractionCoords += 1.0; 1951 refractionCoords /= 2.0; 1952 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1953 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1954 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1955 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1956 } 1957#endif`,vg=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) 1958 varying vec2 vUv; 1959#endif`,wg=`#ifdef USE_UV 1960 #ifdef UVS_VERTEX_ONLY 1961 vec2 vUv; 1962 #else 1963 varying vec2 vUv; 1964 #endif 1965 uniform mat3 uvTransform; 1966#endif`,Sg=`#ifdef USE_UV 1967 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1968#endif`,Mg=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1969 varying vec2 vUv2; 1970#endif`,Tg=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1971 attribute vec2 uv2; 1972 varying vec2 vUv2; 1973 uniform mat3 uv2Transform; 1974#endif`,Ag=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1975 vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; 1976#endif`,Cg=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1976IGHT_COORDS > 0 1977 vec4 worldPosition = vec4( transformed, 1.0 ); 1978 #ifdef USE_INSTANCING 1979 worldPosition = instanceMatrix * worldPosition; 1980 #endif 1981 worldPosition = modelMatrix * worldPosition; 1982#endif`;const Eg=`varying vec2 vUv; 1983uniform mat3 uvTransform; 1984void main() { 1985 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1986 gl_Position = vec4( position.xy, 1.0, 1.0 ); 1987}`,Pg=`uniform sampler2D t2D; 1988varying vec2 vUv; 1989void main() { 1990 gl_FragColor = texture2D( t2D, vUv ); 1991 #ifdef DECODE_VIDEO_TEXTURE 1992 gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w ); 1993 #endif 1994 #include <tonemapping_fragment> 1995 #include <encodings_fragment> 1996}`,Ig=`varying vec3 vWorldDirection; 1997#include <common> 1998void main() { 1999 vWorldDirection = transformDirection( position, modelMatrix ); 2000 #include <begin_vertex> 2001 #include <project_vertex> 2002 gl_Position.z = gl_Position.w; 2003}`,Lg=`#ifdef ENVMAP_TYPE_CUBE 2004 uniform samplerCube envMap; 2005#elif defined( ENVMAP_TYPE_CUBE_UV ) 2006 uniform sampler2D envMap; 2007#endif 2008uniform float flipEnvMap; 2009uniform float backgroundBlurriness; 2010varying vec3 vWorldDirection; 2011#include <cube_uv_reflection_fragment> 2012void main() { 2013 #ifdef ENVMAP_TYPE_CUBE 2014 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2015 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2016 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 2017 #else 2018 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2019 #endif 2020 gl_FragColor = texColor; 2021 #include <tonemapping_fragment> 2022 #include <encodings_fragment> 2023}`,Rg=`varying vec3 vWorldDirection; 2024#include <common> 2025void main() { 2026 vWorldDirection = transformDirection( position, modelMatrix ); 2027 #include <begin_vertex> 2028 #include <project_vertex> 2029 gl_Position.z = gl_Position.w; 2030}`,zg=`uniform samplerCube tCube; 2031uniform float tFlip; 2032uniform float opacity; 2033varying vec3 vWorldDirection; 2034void main() { 2035 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2036 gl_FragColor = texColor; 2037 gl_FragColor.a *= opacity; 2038 #include <tonemapping_fragment> 2039 #include <encodings_fragment> 2040}`,Dg=`#include <common> 2041#include <uv_pars_vertex> 2042#include <displacementmap_pars_vertex> 2043#include <morphtarget_pars_vertex> 2044#include <skinning_pars_vertex> 2045#include <logdepthbuf_pars_vertex> 2046#include <clipping_planes_pars_vertex> 2047varying vec2 vHighPrecisionZW; 2048void main() { 2049 #include <uv_vertex> 2050 #include <skinbase_vertex> 2051 #ifdef USE_DISPLACEMENTMAP 2052 #include <beginnormal_vertex> 2053 #include <morphnormal_vertex> 2054 #include <skinnormal_vertex> 2055 #endif 2056 #include <begin_vertex> 2057 #include <morphtarget_vertex> 2058 #include <skinning_vertex> 2059 #include <displacementmap_vertex> 2060 #include <project_vertex> 2061 #include <logdepthbuf_vertex> 2062 #include <clipping_planes_vertex> 2063 vHighPrecisionZW = gl_Position.zw; 2064}`,Og=`#if DEPTH_PACKING == 3200 2065 uniform float opacity; 2066#endif 2067#include <common> 2068#include <packing> 2069#include <uv_pars_fragment> 2070#include <map_pars_fragment> 2071#include <alphamap_pars_fragment> 2072#include <alphatest_pars_fragment> 2073#include <logdepthbuf_pars_fragment> 2074#include <clipping_planes_pars_fragment> 2075varying vec2 vHighPrecisionZW; 2076void main() { 2077 #include <clipping_planes_fragment> 2078 vec4 diffuseColor = vec4( 1.0 ); 2079 #if DEPTH_PACKING == 3200 2080 diffuseColor.a = opacity; 2081 #endif 2082 #include <map_fragment> 2083 #include <alphamap_fragment> 2084 #include <alphatest_fragment> 2085 #include <logdepthbuf_fragment> 2086 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2087 #if DEPTH_PACKING == 3200 2088 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2089 #elif DEPTH_PACKING == 3201 2090 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2091 #endif 2092}`,Ng=`#define DISTANCE 2093varying vec3 vWorldPosition; 2094#include <common> 2095#include <uv_pars_vertex> 2096#include <displacementmap_pars_vertex> 2097#include <morphtarget_pars_vertex> 2098#include <skinning_pars_vertex> 2099#include <clipping_planes_pars_vertex> 2100void main() { 2101 #include <uv_vertex> 2102 #include <skinbase_vertex> 2103 #ifdef USE_DISPLACEMENTMAP 2104 #include <beginnormal_vertex> 2105 #include <morphnormal_vertex> 2106 #include <skinnormal_vertex> 2107 #endif 2108 #include <begin_vertex> 2109 #include <morphtarget_vertex> 2110 #include <skinning_vertex> 2111 #include <displacementmap_vertex> 2112 #include <project_vertex> 2113 #include <worldpos_vertex> 2114 #include <clipping_planes_vertex> 2115 vWorldPosition = worldPosition.xyz; 2116}`,kg=`#define DISTANCE 2117uniform vec3 referencePosition; 2118uniform float nearDistance; 2119uniform float farDistance; 2120varying vec3 vWorldPosition; 2121#include <common> 2122#include <packing> 2123#include <uv_pars_fragment> 2124#include <map_pars_fragment> 2125#include <alphamap_pars_fragment> 2126#include <alphatest_pars_fragment> 2127#include <clipping_planes_pars_fragment> 2128void main () { 2129 #include <clipping_planes_fragment> 2130 vec4 diffuseColor = vec4( 1.0 ); 2131 #include <map_fragment> 2132 #include <alphamap_fragment> 2133 #include <alphatest_fragment> 2134 float dist = length( vWorldPosition - referencePosition ); 2135 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2136 dist = saturate( dist ); 2137 gl_FragColor = packDepthToRGBA( dist ); 2138}`,Bg=`varying vec3 vWorldDirection; 2139#include <common> 2140void main() { 2141 vWorldDirection = transformDirection( position, modelMatrix ); 2142 #include <begin_vertex> 2143 #include <project_vertex> 2144}`,Fg=`uniform sampler2D tEquirect; 2145varying vec3 vWorldDirection; 2146#include <common> 2147void main() { 2148 vec3 direction = normalize( vWorldDirection ); 2149 vec2 sampleUV = equirectUv( direction ); 2150 gl_FragColor = texture2D( tEquirect, sampleUV ); 2151 #include <tonemapping_fragment> 2152 #include <encodings_fragment> 2153}`,Ug=`uniform float scale; 2154attribute float lineDistance; 2155varying float vLineDistance; 2156#include <common> 2157#include <color_pars_vertex> 2158#include <fog_pars_vertex> 2159#include <morphtarget_pars_vertex> 2160#include <logdepthbuf_pars_vertex> 2161#include <clipping_planes_pars_vertex> 2162void main() { 2163 vLineDistance = scale * lineDistance; 2164 #include <color_vertex> 2165 #include <morphcolor_vertex> 2166 #include <begin_vertex> 2167 #include <morphtarget_vertex> 2168 #include <project_vertex> 2169 #include <logdepthbuf_vertex> 2170 #include <clipping_planes_vertex> 2171 #include <fog_vertex> 2172}`,Vg=`uniform vec3 diffuse; 2173uniform float opacity; 2174uniform float dashSize; 2175uniform float totalSize; 2176varying float vLineDistance; 2177#include <common> 2178#include <color_pars_fragment> 2179#include <fog_pars_fragment> 2180#include <logdepthbuf_pars_fragment> 2181#include <clipping_planes_pars_fragment> 2182void main() { 2183 #include <clipping_planes_fragment> 2184 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2185 discard; 2186 } 2187 vec3 outgoingLight = vec3( 0.0 ); 2188 vec4 diffuseColor = vec4( diffuse, opacity ); 2189 #include <logdepthbuf_fragment> 2190 #include <color_fragment> 2191 outgoingLight = diffuseColor.rgb; 2192 #include <output_fragment> 2193 #include <tonemapping_fragment> 2194 #include <encodings_fragment> 2195 #include <fog_fragment> 2196 #include <premultiplied_alpha_fragment> 2197}`,Hg=`#include <common> 2198#include <uv_pars_vertex> 2199#include <uv2_pars_vertex> 2200#include <envmap_pars_vertex> 2201#include <color_pars_vertex> 2202#include <fog_pars_vertex> 2203#include <morphtarget_pars_vertex> 2204#include <skinning_pars_vertex> 2205#include <logdepthbuf_pars_vertex> 2206#include <clipping_planes_pars_vertex> 2207void main() { 2208 #include <uv_vertex> 2209 #include <uv2_vertex> 2210 #include <color_vertex> 2211 #include <morphcolor_vertex> 2212 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2213 #include <beginnormal_vertex> 2214 #include <morphnormal_vertex> 2215 #include <skinbase_vertex> 2216 #include <skinnormal_vertex> 2217 #include <defaultnormal_vertex> 2218 #endif 2219 #include <begin_vertex> 2220 #include <morphtarget_vertex> 2221 #include <skinning_vertex> 2222 #include <project_vertex> 2223 #include <logdepthbuf_vertex> 2224 #include <clipping_planes_vertex> 2225 #include <worldpos_vertex> 2226 #include <envmap_vertex> 2227 #include <fog_vertex> 2228}`,Gg=`uniform vec3 diffuse; 2229uniform float opacity; 2230#ifndef FLAT_SHADED 2231 varying vec3 vNormal; 2232#endif 2233#include <common> 2234#include <dithering_pars_fragment> 2235#include <color_pars_fragment> 2236#include <uv_pars_fragment> 2237#include <uv2_pars_fragment> 2238#include <map_pars_fragment> 2239#include <alphamap_pars_fragment> 2240#include <alphatest_pars_fragment> 2241#include <aomap_pars_fragment> 2242#include <lightmap_pars_fragment> 2243#include <envmap_common_pars_fragment> 2244#include <envmap_pars_fragment> 2245#include <fog_pars_fragment> 2246#include <specularmap_pars_fragment> 2247#include <logdepthbuf_pars_fragment> 2248#include <clipping_planes_pars_fragment> 2249void main() { 2250 #include <clipping_planes_fragment> 2251 vec4 diffuseColor = vec4( diffuse, opacity ); 2252 #include <logdepthbuf_fragment> 2253 #include <map_fragment> 2254 #include <color_fragment> 2255 #include <alphamap_fragment> 2256 #include <alphatest_fragment> 2257 #include <specularmap_fragment> 2258 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2259 #ifdef USE_LIGHTMAP 2260 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 2261 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2262 #else 2263 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2264 #endif 2265 #include <aomap_fragment> 2266 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2267 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2268 #include <envmap_fragment> 2269 #include <output_fragment> 2270 #include <tonemapping_fragment> 2271 #include <encodings_fragment> 2272 #include <fog_fragment> 2273 #include <premultiplied_alpha_fragment> 2274 #include <dithering_fragment> 2275}`,Wg=`#define LAMBERT 2276varying vec3 vViewPosition; 2277#include <common> 2278#include <uv_pars_vertex> 2279#include <uv2_pars_vertex> 2280#include <displacementmap_pars_vertex> 2281#include <envmap_pars_vertex> 2282#include <color_pars_vertex> 2283#include <fog_pars_vertex> 2284#include <normal_pars_vertex> 2285#include <morphtarget_pars_vertex> 2286#include <skinning_pars_vertex> 2287#include <shadowmap_pars_vertex> 2288#include <logdepthbuf_pars_vertex> 2289#include <clipping_planes_pars_vertex> 2290void main() { 2291 #include <uv_vertex> 2292 #include <uv2_vertex> 2293 #include <color_vertex> 2294 #include <morphcolor_vertex> 2295 #include <beginnormal_vertex> 2296 #include <morphnormal_vertex> 2297 #include <skinbase_vertex> 2298 #include <skinnormal_vertex> 2299 #include <defaultnormal_vertex> 2300 #include <normal_vertex> 2301 #include <begin_vertex> 2302 #include <morphtarget_vertex> 2303 #include <skinning_vertex> 2304 #include <displacementmap_vertex> 2305 #include <project_vertex> 2306 #include <logdepthbuf_vertex> 2307 #include <clipping_planes_vertex> 2308 vViewPosition = - mvPosition.xyz; 2309 #include <worldpos_vertex> 2310 #include <envmap_vertex> 2311 #include <shadowmap_vertex> 2312 #include <fog_vertex> 2313}`,Xg=`#define LAMBERT 2314uniform vec3 diffuse; 2315uniform vec3 emissive; 2316uniform float opacity; 2317#include <common> 2318#include <packing> 2319#include <dithering_pars_fragment> 2320#include <color_pars_fragment> 2321#include <uv_pars_fragment> 2322#include <uv2_pars_fragment> 2323#include <map_pars_fragment> 2324#include <alphamap_pars_fragment> 2325#include <alphatest_pars_fragment> 2326#include <aomap_pars_fragment> 2327#include <lightmap_pars_fragment> 2328#include <emissivemap_pars_fragment> 2329#include <envmap_common_pars_fragment> 2330#include <envmap_pars_fragment> 2331#include <fog_pars_fragment> 2332#include <bsdfs> 2333#include <lights_pars_begin> 2334#include <normal_pars_fragment> 2335#include <lights_lambert_pars_fragment> 2336#include <shadowmap_pars_fragment> 2337#include <bumpmap_pars_fragment> 2338#include <normalmap_pars_fragment> 2339#include <specularmap_pars_fragment> 2340#include <logdepthbuf_pars_fragment> 2341#include <clipping_planes_pars_fragment> 2342void main() { 2343 #include <clipping_planes_fragment> 2344 vec4 diffuseColor = vec4( diffuse, opacity ); 2345 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2346 vec3 totalEmissiveRadiance = emissive; 2347 #include <logdepthbuf_fragment> 2348 #include <map_fragment> 2349 #include <color_fragment> 2350 #include <alphamap_fragment> 2351 #include <alphatest_fragment> 2352 #include <specularmap_fragment> 2353 #include <normal_fragment_begin> 2354 #include <normal_fragment_maps> 2355 #include <emissivemap_fragment> 2356 #include <lights_lambert_fragment> 2357 #include <lights_fragment_begin> 2358 #include <lights_fragment_maps> 2359 #include <lights_fragment_end> 2360 #include <aomap_fragment> 2361 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2362 #include <envmap_fragment> 2363 #include <output_fragment> 2364 #include <tonemapping_fragment> 2365 #include <encodings_fragment> 2366 #include <fog_fragment> 2367 #include <premultiplied_alpha_fragment> 2368 #include <dithering_fragment> 2369}`,Zg=`#define MATCAP 2370varying vec3 vViewPosition; 2371#include <common> 2372#include <uv_pars_vertex> 2373#include <color_pars_vertex> 2374#include <displacementmap_pars_vertex> 2375#include <fog_pars_vertex> 2376#include <normal_pars_vertex> 2377#include <morphtarget_pars_vertex> 2378#include <skinning_pars_vertex> 2379#include <logdepthbuf_pars_vertex> 2380#include <clipping_planes_pars_vertex> 2381void main() { 2382 #include <uv_vertex> 2383 #include <color_vertex> 2384 #include <morphcolor_vertex> 2385 #include <beginnormal_vertex> 2386 #include <morphnormal_vertex> 2387 #include <skinbase_vertex> 2388 #include <skinnormal_vertex> 2389 #include <defaultnormal_vertex> 2390 #include <normal_vertex> 2391 #include <begin_vertex> 2392 #include <morphtarget_vertex> 2393 #include <skinning_vertex> 2394 #include <displacementmap_vertex> 2395 #include <project_vertex> 2396 #include <logdepthbuf_vertex> 2397 #include <clipping_planes_vertex> 2398 #include <fog_vertex> 2399 vViewPosition = - mvPosition.xyz; 2400}`,jg=`#define MATCAP 2401uniform vec3 diffuse; 2402uniform float opacity; 2403uniform sampler2D matcap; 2404varying vec3 vViewPosition; 2405#include <common> 2406#include <dithering_pars_fragment> 2407#include <color_pars_fragment> 2408#include <uv_pars_fragment> 2409#include <map_pars_fragment> 2410#include <alphamap_pars_fragment> 2411#include <alphatest_pars_fragment> 2412#include <fog_pars_fragment> 2413#include <normal_pars_fragment> 2414#include <bumpmap_pars_fragment> 2415#include <normalmap_pars_fragment> 2416#include <logdepthbuf_pars_fragment> 2417#include <clipping_planes_pars_fragment> 2418void main() { 2419 #include <clipping_planes_fragment> 2420 vec4 diffuseColor = vec4( diffuse, opacity ); 2421 #include <logdepthbuf_fragment> 2422 #include <map_fragment> 2423 #include <color_fragment> 2424 #include <alphamap_fragment> 2425 #include <alphatest_fragment> 2426 #include <normal_fragment_begin> 2427 #include <normal_fragment_maps> 2428 vec3 viewDir = normalize( vViewPosition ); 2429 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2430 vec3 y = cross( viewDir, x ); 2431 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2432 #ifdef USE_MATCAP
2433 vec4 matcapColor = texture2D( matcap, uv ); 2434 #else 2435 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2436 #endif 2437 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2438 #include <output_fragment> 2439 #include <tonemapping_fragment> 2440 #include <encodings_fragment> 2441 #include <fog_fragment> 2442 #include <premultiplied_alpha_fragment> 2443 #include <dithering_fragment> 2444}`,qg=`#define NORMAL 2445#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2446 varying vec3 vViewPosition; 2447#endif 2448#include <common> 2449#include <uv_pars_vertex> 2450#include <displacementmap_pars_vertex> 2451#include <normal_pars_vertex> 2452#include <morphtarget_pars_vertex> 2453#include <skinning_pars_vertex> 2454#include <logdepthbuf_pars_vertex> 2455#include <clipping_planes_pars_vertex> 2456void main() { 2457 #include <uv_vertex> 2458 #include <beginnormal_vertex> 2459 #include <morphnormal_vertex> 2460 #include <skinbase_vertex> 2461 #include <skinnormal_vertex> 2462 #include <defaultnormal_vertex> 2463 #include <normal_vertex> 2464 #include <begin_vertex> 2465 #include <morphtarget_vertex> 2466 #include <skinning_vertex> 2467 #include <displacementmap_vertex> 2468 #include <project_vertex> 2469 #include <logdepthbuf_vertex> 2470 #include <clipping_planes_vertex> 2471#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2472 vViewPosition = - mvPosition.xyz; 2473#endif 2474}`,Yg=`#define NORMAL 2475uniform float opacity; 2476#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2477 varying vec3 vViewPosition; 2478#endif 2479#include <packing> 2480#include <uv_pars_fragment> 2481#include <normal_pars_fragment> 2482#include <bumpmap_pars_fragment> 2483#include <normalmap_pars_fragment> 2484#include <logdepthbuf_pars_fragment> 2485#include <clipping_planes_pars_fragment> 2486void main() { 2487 #include <clipping_planes_fragment> 2488 #include <logdepthbuf_fragment> 2489 #include <normal_fragment_begin> 2490 #include <normal_fragment_maps> 2491 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2492 #ifdef OPAQUE 2493 gl_FragColor.a = 1.0; 2494 #endif 2495}`,$g=`#define PHONG 2496varying vec3 vViewPosition; 2497#include <common> 2498#include <uv_pars_vertex> 2499#include <uv2_pars_vertex> 2500#include <displacementmap_pars_vertex> 2501#include <envmap_pars_vertex> 2502#include <color_pars_vertex> 2503#include <fog_pars_vertex> 2504#include <normal_pars_vertex> 2505#include <morphtarget_pars_vertex> 2506#include <skinning_pars_vertex> 2507#include <shadowmap_pars_vertex> 2508#include <logdepthbuf_pars_vertex> 2509#include <clipping_planes_pars_vertex> 2510void main() { 2511 #include <uv_vertex> 2512 #include <uv2_vertex> 2513 #include <color_vertex> 2514 #include <morphcolor_vertex> 2515 #include <beginnormal_vertex> 2516 #include <morphnormal_vertex> 2517 #include <skinbase_vertex> 2518 #include <skinnormal_vertex> 2519 #include <defaultnormal_vertex> 2520 #include <normal_vertex> 2521 #include <begin_vertex> 2522 #include <morphtarget_vertex> 2523 #include <skinning_vertex> 2524 #include <displacementmap_vertex> 2525 #include <project_vertex> 2526 #include <logdepthbuf_vertex> 2527 #include <clipping_planes_vertex> 2528 vViewPosition = - mvPosition.xyz; 2529 #include <worldpos_vertex> 2530 #include <envmap_vertex> 2531 #include <shadowmap_vertex> 2532 #include <fog_vertex> 2533}`,Jg=`#define PHONG 2534uniform vec3 diffuse; 2535uniform vec3 emissive; 2536uniform vec3 specular; 2537uniform float shininess; 2538uniform float opacity; 2539#include <common> 2540#include <packing> 2541#include <dithering_pars_fragment> 2542#include <color_pars_fragment> 2543#include <uv_pars_fragment> 2544#include <uv2_pars_fragment> 2545#include <map_pars_fragment> 2546#include <alphamap_pars_fragment> 2547#include <alphatest_pars_fragment> 2548#include <aomap_pars_fragment> 2549#include <lightmap_pars_fragment> 2550#include <emissivemap_pars_fragment> 2551#include <envmap_common_pars_fragment> 2552#include <envmap_pars_fragment> 2553#include <fog_pars_fragment> 2554#include <bsdfs> 2555#include <lights_pars_begin> 2556#include <normal_pars_fragment> 2557#include <lights_phong_pars_fragment> 2558#include <shadowmap_pars_fragment> 2559#include <bumpmap_pars_fragment> 2560#include <normalmap_pars_fragment> 2561#include <specularmap_pars_fragment> 2562#include <logdepthbuf_pars_fragment> 2563#include <clipping_planes_pars_fragment> 2564void main() { 2565 #include <clipping_planes_fragment> 2566 vec4 diffuseColor = vec4( diffuse, opacity ); 2567 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2568 vec3 totalEmissiveRadiance = emissive; 2569 #include <logdepthbuf_fragment> 2570 #include <map_fragment> 2571 #include <color_fragment> 2572 #include <alphamap_fragment> 2573 #include <alphatest_fragment> 2574 #include <specularmap_fragment> 2575 #include <normal_fragment_begin> 2576 #include <normal_fragment_maps> 2577 #include <emissivemap_fragment> 2578 #include <lights_phong_fragment> 2579 #include <lights_fragment_begin> 2580 #include <lights_fragment_maps> 2581 #include <lights_fragment_end> 2582 #include <aomap_fragment> 2583 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2584 #include <envmap_fragment> 2585 #include <output_fragment> 2586 #include <tonemapping_fragment> 2587 #include <encodings_fragment> 2588 #include <fog_fragment> 2589 #include <premultiplied_alpha_fragment> 2590 #include <dithering_fragment> 2591}`,Kg=`#define STANDARD 2592varying vec3 vViewPosition; 2593#ifdef USE_TRANSMISSION 2594 varying vec3 vWorldPosition; 2595#endif 2596#include <common> 2597#include <uv_pars_vertex> 2598#include <uv2_pars_vertex> 2599#include <displacementmap_pars_vertex> 2600#include <color_pars_vertex> 2601#include <fog_pars_vertex> 2602#include <normal_pars_vertex> 2603#include <morphtarget_pars_vertex> 2604#include <skinning_pars_vertex> 2605#include <shadowmap_pars_vertex> 2606#include <logdepthbuf_pars_vertex> 2607#include <clipping_planes_pars_vertex> 2608void main() { 2609 #include <uv_vertex> 2610 #include <uv2_vertex> 2611 #include <color_vertex> 2612 #include <morphcolor_vertex> 2613 #include <beginnormal_vertex> 2614 #include <morphnormal_vertex> 2615 #include <skinbase_vertex> 2616 #include <skinnormal_vertex> 2617 #include <defaultnormal_vertex> 2618 #include <normal_vertex> 2619 #include <begin_vertex> 2620 #include <morphtarget_vertex> 2621 #include <skinning_vertex> 2622 #include <displacementmap_vertex> 2623 #include <project_vertex> 2624 #include <logdepthbuf_vertex> 2625 #include <clipping_planes_vertex> 2626 vViewPosition = - mvPosition.xyz; 2627 #include <worldpos_vertex> 2628 #include <shadowmap_vertex> 2629 #include <fog_vertex> 2630#ifdef USE_TRANSMISSION 2631 vWorldPosition = worldPosition.xyz; 2632#endif 2633}`,Qg=`#define STANDARD 2634#ifdef PHYSICAL 2635 #define IOR 2636 #define SPECULAR 2637#endif 2638uniform vec3 diffuse; 2639uniform vec3 emissive; 2640uniform float roughness; 2641uniform float metalness; 2642uniform float opacity; 2643#ifdef IOR 2644 uniform float ior; 2645#endif 2646#ifdef SPECULAR 2647 uniform float specularIntensity; 2648 uniform vec3 specularColor; 2649 #ifdef USE_SPECULARINTENSITYMAP 2650 uniform sampler2D specularIntensityMap; 2651 #endif 2652 #ifdef USE_SPECULARCOLORMAP 2653 uniform sampler2D specularColorMap; 2654 #endif 2655#endif 2656#ifdef USE_CLEARCOAT 2657 uniform float clearcoat; 2658 uniform float clearcoatRoughness; 2659#endif
2660#ifdef USE_IRIDESCENCE 2661 uniform float iridescence; 2662 uniform float iridescenceIOR; 2663 uniform float iridescenceThicknessMinimum; 2664 uniform float iridescenceThicknessMaximum; 2665#endif 2666#ifdef USE_SHEEN 2667 uniform vec3 sheenColor; 2668 uniform float sheenRoughness; 2669 #ifdef USE_SHEENCOLORMAP 2670 uniform sampler2D sheenColorMap; 2671 #endif 2672 #ifdef USE_SHEENROUGHNESSMAP 2673 uniform sampler2D sheenRoughnessMap; 2674 #endif 2675#endif 2676varying vec3 vViewPosition; 2677#include <common> 2678#include <packing> 2679#include <dithering_pars_fragment> 2680#include <color_pars_fragment> 2681#include <uv_pars_fragment> 2682#include <uv2_pars_fragment> 2683#include <map_pars_fragment> 2684#include <alphamap_pars_fragment> 2685#include <alphatest_pars_fragment> 2686#include <aomap_pars_fragment> 2687#include <lightmap_pars_fragment> 2688#include <emissivemap_pars_fragment> 2689#include <bsdfs> 2690#include <iridescence_fragment> 2691#include <cube_uv_reflection_fragment> 2692#include <envmap_common_pars_fragment> 2693#include <envmap_physical_pars_fragment> 2694#include <fog_pars_fragment> 2695#include <lights_pars_begin> 2696#include <normal_pars_fragment> 2697#include <lights_physical_pars_fragment> 2698#include <transmission_pars_fragment> 2699#include <shadowmap_pars_fragment> 2700#include <bumpmap_pars_fragment> 2701#include <normalmap_pars_fragment> 2702#include <clearcoat_pars_fragment> 2703#include <iridescence_pars_fragment> 2704#include <roughnessmap_pars_fragment> 2705#include <metalnessmap_pars_fragment> 2706#include <logdepthbuf_pars_fragment> 2707#include <clipping_planes_pars_fragment> 2708void main() { 2709 #include <clipping_planes_fragment> 2710 vec4 diffuseColor = vec4( diffuse, opacity ); 2711 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2712 vec3 totalEmissiveRadiance = emissive; 2713 #include <logdepthbuf_fragment> 2714 #include <map_fragment> 2715 #include <color_fragment> 2716 #include <alphamap_fragment> 2717 #include <alphatest_fragment> 2718 #include <roughnessmap_fragment> 2719 #include <metalnessmap_fragment> 2720 #include <normal_fragment_begin> 2721 #include <normal_fragment_maps> 2722 #include <clearcoat_normal_fragment_begin> 2723 #include <clearcoat_normal_fragment_maps> 2724 #include <emissivemap_fragment> 2725 #include <lights_physical_fragment> 2726 #include <lights_fragment_begin> 2727 #include <lights_fragment_maps> 2728 #include <lights_fragment_end> 2729 #include <aomap_fragment> 2730 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2731 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2732 #include <transmission_fragment> 2733 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2734 #ifdef USE_SHEEN 2735 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2736 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2737 #endif 2738 #ifdef USE_CLEARCOAT 2739 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2740 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2741 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2742 #endif 2743 #include <output_fragment> 2744 #include <tonemapping_fragment> 2745 #include <encodings_fragment> 2746 #include <fog_fragment> 2747 #include <premultiplied_alpha_fragment> 2748 #include <dithering_fragment> 2749}`,e0=`#define TOON 2750varying vec3 vViewPosition; 2751#include <common> 2752#include <uv_pars_vertex> 2753#include <uv2_pars_vertex> 2754#include <displacementmap_pars_vertex> 2755#include <color_pars_vertex> 2756#include <fog_pars_vertex> 2757#include <normal_pars_vertex> 2758#include <morphtarget_pars_vertex> 2759#include <skinning_pars_vertex> 2760#include <shadowmap_pars_vertex> 2761#include <logdepthbuf_pars_vertex> 2762#include <clipping_planes_pars_vertex> 2763void main() { 2764 #include <uv_vertex> 2765 #include <uv2_vertex> 2766 #include <color_vertex> 2767 #include <morphcolor_vertex> 2768 #include <beginnormal_vertex> 2769 #include <morphnormal_vertex> 2770 #include <skinbase_vertex> 2771 #include <skinnormal_vertex> 2772 #include <defaultnormal_vertex> 2773 #include <normal_vertex> 2774 #include <begin_vertex> 2775 #include <morphtarget_vertex> 2776 #include <skinning_vertex> 2777 #include <displacementmap_vertex> 2778 #include <project_vertex> 2779 #include <logdepthbuf_vertex> 2780 #include <clipping_planes_vertex> 2781 vViewPosition = - mvPosition.xyz; 2782 #include <worldpos_vertex> 2783 #include <shadowmap_vertex> 2784 #include <fog_vertex> 2785}`,t0=`#define TOON 2786uniform vec3 diffuse; 2787uniform vec3 emissive; 2788uniform float opacity; 2789#include <common> 2790#include <packing> 2791#include <dithering_pars_fragment> 2792#include <color_pars_fragment> 2793#include <uv_pars_fragment> 2794#include <uv2_pars_fragment> 2795#include <map_pars_fragment> 2796#include <alphamap_pars_fragment> 2797#include <alphatest_pars_fragment> 2798#include <aomap_pars_fragment> 2799#include <lightmap_pars_fragment> 2800#include <emissivemap_pars_fragment> 2801#include <gradientmap_pars_fragment> 2802#include <fog_pars_fragment> 2803#include <bsdfs> 2804#include <lights_pars_begin> 2805#include <normal_pars_fragment> 2806#include <lights_toon_pars_fragment> 2807#include <shadowmap_pars_fragment> 2808#include <bumpmap_pars_fragment> 2809#include <normalmap_pars_fragment> 2810#include <logdepthbuf_pars_fragment> 2811#include <clipping_planes_pars_fragment> 2812void main() { 2813 #include <clipping_planes_fragment> 2814 vec4 diffuseColor = vec4( diffuse, opacity ); 2815 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2816 vec3 totalEmissiveRadiance = emissive; 2817 #include <logdepthbuf_fragment> 2818 #include <map_fragment> 2819 #include <color_fragment> 2820 #include <alphamap_fragment> 2821 #include <alphatest_fragment> 2822 #include <normal_fragment_begin> 2823 #include <normal_fragment_maps> 2824 #include <emissivemap_fragment> 2825 #include <lights_toon_fragment> 2826 #include <lights_fragment_begin> 2827 #include <lights_fragment_maps> 2828 #include <lights_fragment_end> 2829 #include <aomap_fragment> 2830 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2831 #include <output_fragment> 2832 #include <tonemapping_fragment> 2833 #include <encodings_fragment> 2834 #include <fog_fragment> 2835 #include <premultiplied_alpha_fragment> 2836 #include <dithering_fragment> 2837}`,n0=`uniform float size; 2838uniform float scale; 2839#include <common> 2840#include <color_pars_vertex> 2841#include <fog_pars_vertex> 2842#include <morphtarget_pars_vertex> 2843#include <logdepthbuf_pars_vertex> 2844#include <clipping_planes_pars_vertex> 2845void main() { 2846 #include <color_vertex> 2847 #include <morphcolor_vertex> 2848 #include <begin_vertex> 2849 #include <morphtarget_vertex> 2850 #include <project_vertex> 2851 gl_PointSize = size; 2852 #ifdef USE_SIZEATTENUATION 2853 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2854 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 2855 #endif 2856 #include <logdepthbuf_vertex> 2857 #include <clipping_planes_vertex> 2858 #include <worldpos_vertex> 2859 #include <fog_vertex> 2860}`,i0=`uniform vec3 diffuse; 2861uniform float opacity; 2862#include <common> 2863#include <color_pars_fragment> 2864#include <map_particle_pars_fragment> 2865#include <alphatest_pars_fragment> 2866#include <fog_pars_fragment> 2867#include <logdepthbuf_pars_fragment> 2868#include <clipping_planes_pars_fragment> 2869void main() { 2870 #include <clipping_planes_fragment> 2871 vec3 outgoingLight = vec3( 0.0 ); 2872 vec4 diffuseColor = vec4( diffuse, opacity ); 2873 #include <logdepthbuf_fragment> 2874 #include <map_particle_fragment> 2875 #include <color_fragment> 2876 #include <alphatest_fragment> 2877 outgoingLight = diffuseColor.rgb; 2878 #include <output_fragment> 2879 #include <tonemapping_fragment> 2880 #include <encodings_fragment> 2881 #include <fog_fragment> 2882 #include <premultiplied_alpha_fragment> 2883}`,s0=`#include <common> 2884#include <fog_pars_vertex> 2885#include <morphtarget_pars_vertex> 2886#include <skinning_pars_vertex> 2887#include <shadowmap_pars_vertex> 2888void main() { 2889 #include <beginnormal_vertex> 2890 #include <morphnormal_vertex> 2891 #include <skinbase_vertex> 2892 #include <skinnormal_vertex> 2893 #include <defaultnormal_vertex> 2894 #include <begin_vertex> 2895 #include <morphtarget_vertex> 2896 #include <skinning_vertex> 2897 #include <project_vertex> 2898 #include <worldpos_vertex> 2899 #include <shadowmap_vertex> 2900 #include <fog_vertex> 2901}`,r0=`uniform vec3 color; 2902uniform float opacity; 2903#include <common> 2904#include <packing> 2905#include <fog_pars_fragment> 2906#include <bsdfs> 2907#include <lights_pars_begin> 2908#include <shadowmap_pars_fragment> 2909#include <shadowmask_pars_fragment> 2910void main() { 2911 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 2912 #include <tonemapping_fragment> 2913 #include <encodings_fragment> 2914 #include <fog_fragment> 2915}`,a0=`uniform float rotation; 2916uniform vec2 center; 2917#include <common> 2918#include <uv_pars_vertex> 2919#include <fog_pars_vertex> 2920#include <logdepthbuf_pars_vertex> 2921#include <clipping_planes_pars_vertex> 2922void main() { 2923 #include <uv_vertex> 2924 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 2925 vec2 scale; 2926 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 2927 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 2928 #ifndef USE_SIZEATTENUATION 2929 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2930 if ( isPerspective ) scale *= - mvPosition.z; 2931 #endif 2932 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 2933 vec2 rotatedPosition; 2934 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 2935 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 2936 mvPosition.xy += rotatedPosition; 2937 gl_Position = projectionMatrix * mvPosition; 2938 #include <logdepthbuf_vertex> 2939 #include <clipping_planes_vertex> 2940 #include <fog_vertex> 2941}`,o0=`uniform vec3 diffuse; 2942uniform float opacity; 2943#include <common> 2944#include <uv_pars_fragment> 2945#include <map_pars_fragment> 2946#include <alphamap_pars_fragment> 2947#include <alphatest_pars_fragment> 2948#include <fog_pars_fragment> 2949#include <logdepthbuf_pars_fragment> 2950#include <clipping_planes_pars_fragment> 2951void main() { 2952 #include <clipping_planes_fragment> 2953 vec3 outgoingLight = vec3( 0.0 ); 2954 vec4 diffuseColor = vec4( diffuse, opacity ); 2955 #include <logdepthbuf_fragment> 2956 #include <map_fragment> 2957 #include <alphamap_fragment> 2958 #include <alphatest_fragment> 2959 outgoingLight = diffuseColor.rgb; 2960 #include <output_fragment> 2961 #include <tonemapping_fragment> 2962 #include <encodings_fragment> 2963 #include <fog_fragment> 2964}`,Fe={alphamap_fragment:Ip,alphamap_pars_fragment:Lp,alphatest_fragment:Rp,alphatest_pars_fragment:zp,aomap_fragment:Dp,aomap_pars_fragment:Op,begin_vertex:Np,beginnormal_vertex:kp,bsdfs:Bp,iridescence_fragment:Fp,bumpmap_pars_fragment:Up,clipping_planes_fragment:Vp,clipping_planes_pars_fragment:Hp,clipping_planes_pars_vertex:Gp,clipping_planes_vertex:Wp,color_fragment:Xp,color_pars_fragment:Zp,color_pars_vertex:jp,color_vertex:qp,common:Yp,cube_uv_reflection_fragment:$p,defaultnormal_vertex:Jp,displacementmap_pars_vertex:Kp,displacementmap_vertex:Qp,emissivemap_fragment:em,emissivemap_pars_fragment:tm,encodings_fragment:nm,encodings_pars_fragment:im,envmap_fragment:sm,envmap_common_pars_fragment:rm,envmap_pars_fragment:am,envmap_pars_vertex:om,envmap_physical_pars_fragment:_m,envmap_vertex:lm,fog_vertex:cm,fog_pars_vertex:hm,fog_fragment:um,fog_pars_fragment:dm,gradientmap_pars_fragment:fm,lightmap_fragment:pm,lightmap_pars_fragment:mm,lights_lambert_fragment:gm,lights_lambert_pars_fragment:xm,lights_pars_begin:ym,lights_toon_fragment:bm,lights_toon_pars_fragment:vm,lights_phong_fragment:wm,lights_phong_pars_fragment:Sm,lights_physical_fragment:Mm,lights_physical_pars_fragment:Tm,lights_fragment_begin:Am,lights_fragment_maps:Cm,lights_fragment_end:Em,logdepthbuf_fragment:Pm,logdepthbuf_pars_fragment:Im,logdepthbuf_pars_vertex:Lm,logdepthbuf_vertex:Rm,map_fragment:zm,map_pars_fragment:Dm,map_particle_fragment:Om,map_particle_pars_fragment:Nm,metalnessmap_fragment:km,metalnessmap_pars_fragment:Bm,morphcolor_vertex:Fm,morphnormal_vertex:Um,morphtarget_pars_vertex:Vm,morphtarget_vertex:Hm,normal_fragment_begin:Gm,normal_fragment_maps:Wm,normal_pars_fragment:Xm,normal_pars_vertex:Zm,normal_vertex:jm,normalmap_pars_fragment:qm,clearcoat_normal_fragment_begin:Ym,clearcoat_normal_fragment_maps:$m,clearcoat_pars_fragment:Jm,iridescence_pars_fragment:Km,output_fragment:Qm,packing:eg,premultiplied_alpha_fragment:tg,project_vertex:ng,dithering_fragment:ig,dithering_pars_fragment:sg,roughnessmap_fragment:rg,roughnessmap_pars_fragment:ag,shadowmap_pars_fragment:og,shadowmap_pars_vertex:lg,shadowmap_vertex:cg,shadowmask_pars_fragment:hg,skinbase_vertex:ug,skinning_pars_vertex:dg,skinning_vertex:fg,skinnormal_vertex:pg,specularmap_fragment:mg,specularmap_pars_fragment:gg,tonemapping_fragment:xg,tonemapping_pars_fragment:yg,transmission_fragment:_g,transmission_pars_fragment:bg,uv_pars_fragment:vg,uv_pars_vertex:wg,uv_vertex:Sg,uv2_pars_fragment:Mg,uv2_pars_vertex:Tg,uv2_vertex:Ag,worldpos_vertex:Cg,background_vert:Eg,background_frag:Pg,backgroundCube_vert:Ig,backgroundCube_frag:Lg,cube_vert:Rg,cube_frag:zg,depth_vert:Dg,depth_frag:Og,distanceRGBA_vert:Ng,distanceRGBA_frag:kg,equirect_vert:Bg,equirect_frag:Fg,linedashed_vert:Ug,linedashed_frag:Vg,meshbasic_vert:Hg,meshbasic_frag:Gg,meshlambert_vert:Wg,meshlambert_frag:Xg,meshmatcap_vert:Zg,meshmatcap_frag:jg,meshnormal_vert:qg,meshnormal_frag:Yg,meshphong_vert:$g,meshphong_frag:Jg,meshphysical_vert:Kg,meshphysical_frag:Qg,meshtoon_vert:e0,meshtoon_frag:t0,points_vert:n0,points_frag:i0,shadow_vert:s0,shadow_frag:r0,sprite_vert:a0,sprite_frag:o0},ge={common:{diffuse:{value:new Te(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new kt},uv2Transform:{value:new kt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new se(1,1)}}
vendor: 6,274 bytes, line 2964
2964,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Te(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Te(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new kt}},sprite:{diffuse:{value:new Te(16777215)},opacity:{value:1},center:{value:new se(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new kt}}},sn={basic:{uniforms:Dt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.fog]),vertexShader:Fe.meshbasic_vert,fragmentShader:Fe.meshbasic_frag},lambert:{uniforms:Dt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Te(0)}}]),vertexShader:Fe.meshlambert_vert,fragmentShader:Fe.meshlambert_frag},phong:{uniforms:Dt([ge.common,ge.specularmap,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,ge.lights,{emissive:{value:new Te(0)},specular:{value:new Te(1118481)},shininess:{value:30}}]),vertexShader:Fe.meshphong_vert,fragmentShader:Fe.meshphong_frag},standard:{uniforms:Dt([ge.common,ge.envmap,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.roughnessmap,ge.metalnessmap,ge.fog,ge.lights,{emissive:{value:new Te(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag},toon:{uniforms:Dt([ge.common,ge.aomap,ge.lightmap,ge.emissivemap,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.gradientmap,ge.fog,ge.lights,{emissive:{value:new Te(0)}}]),vertexShader:Fe.meshtoon_vert,fragmentShader:Fe.meshtoon_frag},matcap:{uniforms:Dt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,ge.fog,{matcap:{value:null}}]),vertexShader:Fe.meshmatcap_vert,fragmentShader:Fe.meshmatcap_frag},points:{uniforms:Dt([ge.points,ge.fog]),vertexShader:Fe.points_vert,fragmentShader:Fe.points_frag},dashed:{uniforms:Dt([ge.common,ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fe.linedashed_vert,fragmentShader:Fe.linedashed_frag},depth:{uniforms:Dt([ge.common,ge.displacementmap]),vertexShader:Fe.depth_vert,fragmentShader:Fe.depth_frag},normal:{uniforms:Dt([ge.common,ge.bumpmap,ge.normalmap,ge.displacementmap,{opacity:{value:1}}]),vertexShader:Fe.meshnormal_vert,fragmentShader:Fe.meshnormal_frag},sprite:{uniforms:Dt([ge.sprite,ge.fog]),vertexShader:Fe.sprite_vert,fragmentShader:Fe.sprite_frag},background:{uniforms:{uvTransform:{value:new kt},t2D:{value:null}},vertexShader:Fe.background_vert,fragmentShader:Fe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0}},vertexShader:Fe.backgroundCube_vert,fragmentShader:Fe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fe.cube_vert,fragmentShader:Fe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fe.equirect_vert,fragmentShader:Fe.equirect_frag},distanceRGBA:{uniforms:Dt([ge.common,ge.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fe.distanceRGBA_vert,fragmentShader:Fe.distanceRGBA_frag},shadow:{uniforms:Dt([ge.lights,ge.fog,{color:{value:new Te(0)},opacity:{value:1}}]),vertexShader:Fe.shadow_vert,fragmentShader:Fe.shadow_frag}};sn.physical={uniforms:Dt([sn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new se(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Te(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new se},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Te(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Te(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Fe.meshphysical_vert,fragmentShader:Fe.meshphysical_frag};function l0(r,e,t,n,i,s,a){const o=new Te(0);let l=s===!0?0:1,c,u,f=null,p=0,g=null;function x(d,m){let v=!1,y=m.isScene===!0?m.background:null;y&&y.isTexture&&(y=(m.backgroundBlurriness>0?t:e).get(y));const _=r.xr,S=_.getSession&&_.getSession();S&&S.environmentBlendMode==="additive"&&(y=null),y===null?h(o,l):y&&y.isColor&&(h(y,1),v=!0),(r.autoClear||v)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===ds)?(u===void 0&&(u=new Tt(new Kn(1,1,1),new dn({name:"Backgroun
2964dCubeMaterial",uniforms:hs(sn.backgroundCube.uniforms),vertexShader:sn.backgroundCube.vertexShader,fragmentShader:sn.backgroundCube.fragmentShader,side:Gt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(M,C,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,(f!==y||p!==y.version||g!==r.toneMapping)&&(u.material.needsUpdate=!0,f=y,p=y.version,g=r.toneMapping),u.layers.enableAll(),d.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Tt(new ps(2,2),new dn({name:"BackgroundMaterial",uniforms:hs(sn.background.uniforms),vertexShader:sn.background.vertexShader,fragmentShader:sn.background.fragmentShader,side:wi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||p!==y.version||g!==r.toneMapping)&&(c.material.needsUpdate=!0,f=y,p=y.version,g=r.toneMapping),c.layers.enableAll(),d.unshift(c,c.geometry,c.material,0,0,null))}function h(d,m){n.buffers.color.setClear(d.r,d.g,d.b,m,a)}return{getClearColor:function(){return o},setClearColor:function(d,m=1){o.set(d),l=m,h(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(d){l=d,h(o,l)},render:x}}function c0(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,o={},l=d(null);let c=l,u=!1;function f(R,U,q,J,X){let O=!1;if(a){const N=h(J,q,U);c!==N&&(c=N,g(c.object)),O=m(R,J,q,X),O&&v(R,J,q,X)}else{const N=U.wireframe===!0;(c.geometry!==J.id||c.program!==q.id||c.wireframe!==N)&&(c.geometry=J.id,c.program=q.id,c.wireframe=N,O=!0)}X!==null&&t.update(X,34963),(O||u)&&(u=!1,b(R,U,q,J),X!==null&&r.bindBuffer(34963,t.get(X).buffer))}function p(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function g(R){return n.isWebGL2?r.bindVertexArray(R):s.bindVertexArrayOES(R)}function x(R){return n.isWebGL2?r.deleteVertexArray(R):s.deleteVertexArrayOES(R)}function h(R,U,q){const J=q.wireframe===!0;let X=o[R.id];X===void 0&&(X={},o[R.id]=X);let O=X[U.id];O===void 0&&(O={},X[U.id]=O);let N=O[J];return N===void 0&&(N=d(p()),O[J]=N),N}function d(R){const U=[],q=[],J=[];for(let X=0;X<i;X++)U[X]=0,q[X]=0,J[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:q,attributeDivisors:J,object:R,attributes:{},index:null}}function m(R,U,q,J){const X=c.attributes,O=U.attributes;let N=0;const re=q.getAttributes();for(const ee in re)if(re[ee].location>=0){const me=X[ee];let he=O[ee];if(he===void 0&&(ee==="instanceMatrix"&&R.instanceMatrix&&(he=R.instanceMatrix),ee==="instanceColor"&&R.instanceColor&&(he=R.instanceColor)),me===void 0||me.attribute!==he||he&&me.data!==he.data)return!0;N++}return c.attributesNum!==N||c.index!==J}function v(R,U,q,J){const X={},O=U.attributes;let N=0;const re=q.getAttributes();for(const ee in re)if(re[ee].location>=0){let me=O[ee];me===void 0&&(ee==="instanceMatrix"&&R.instanceMatrix&&(me=R.instanceMatrix),ee==="instanceColor"&&R.instanceColor&&(me=R.instanceColor));const he={};he.attribute=me,me&&me.data&&(he.data=me.data),X[ee]=he,N++}c.attributes=X,c.attributesNum=N,c.index=J}function y(){const R=c.newAttributes;for(let U=0,q=R.length;U<q;U++)R[U]=0}function _(R){S(R,0)}function S(R,U){const q=c.newAttributes,J=c.enabledAttributes,X=c.attributeDivisors;q[R]=1,J[R]===0&&(r.enableVertexAttribArray(R),J[R]=1),X[R]!==U&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](R,U),X[R]=U)}function M(){const R=c.newAttributes,U=c.enabledAttributes;for(let q=0,J=U.length;q<J;q++)U[q]!==R[q]&&(r.disableVertexAttribArray(q),U[q]=0)}function C(R,U,q,J,X,O){n.isWebGL2===!0&&(q===5124||q===5125)?r.vertexAttribIPointer(R,U,q,X,O):r.vertexAttribPointer(R,U,q,J,X,O)}
vendor: 5,429 bytes, line 2964
2964function b(R,U,q,J){if(n.isWebGL2===!1&&(R.isInstancedMesh||J.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();const X=J.attributes,O=q.getAttributes(),N=U.defaultAttributeValues;for(const re in O){const ee=O[re];if(ee.location>=0){let le=X[re];if(le===void 0&&(re==="instanceMatrix"&&R.instanceMatrix&&(le=R.instanceMatrix),re==="instanceColor"&&R.instanceColor&&(le=R.instanceColor)),le!==void 0){const me=le.normalized,he=le.itemSize,H=t.get(le);if(H===void 0)continue;const Ae=H.buffer,k=H.type,Y=H.bytesPerElement;if(le.isInterleavedBufferAttribute){const oe=le.data,we=oe.stride,Z=le.offset;if(oe.isInstancedInterleavedBuffer){for(let W=0;W<ee.locationSize;W++)S(ee.location+W,oe.meshPerAttribute);R.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let W=0;W<ee.locationSize;W++)_(ee.location+W);r.bindBuffer(34962,Ae);for(let W=0;W<ee.locationSize;W++)C(ee.location+W,he/ee.locationSize,k,me,we*Y,(Z+he/ee.locationSize*W)*Y)}else{if(le.isInstancedBufferAttribute){for(let oe=0;oe<ee.locationSize;oe++)S(ee.location+oe,le.meshPerAttribute);R.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let oe=0;oe<ee.locationSize;oe++)_(ee.location+oe);r.bindBuffer(34962,Ae);for(let oe=0;oe<ee.locationSize;oe++)C(ee.location+oe,he/ee.locationSize,k,me,he*Y,he/ee.locationSize*oe*Y)}}else if(N!==void 0){const me=N[re];if(me!==void 0)switch(me.length){case 2:r.vertexAttrib2fv(ee.location,me);break;case 3:r.vertexAttrib3fv(ee.location,me);break;case 4:r.vertexAttrib4fv(ee.location,me);break;default:r.vertexAttrib1fv(ee.location,me)}}}}M()}function w(){F();for(const R in o){const U=o[R];for(const q in U){const J=U[q];for(const X in J)x(J[X].object),delete J[X];delete U[q]}delete o[R]}}function P(R){if(o[R.id]===void 0)return;const U=o[R.id];for(const q in U){const J=U[q];for(const X in J)x(J[X].object),delete J[X];delete U[q]}delete o[R.id]}function T(R){for(const U in o){const q=o[U];if(q[R.id]===void 0)continue;const J=q[R.id];for(const X in J)x(J[X].object),delete J[X];delete q[R.id]}}function F(){B(),u=!0,c!==l&&(c=l,g(c.object))}function B(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:F,resetDefaultState:B,dispose:w,releaseStatesOfGeometry:P,releaseStatesOfProgram:T,initAttributes:y,enableAttribute:_,disableUnusedAttributes:M}}function h0(r,e,t,n){const i=n.isWebGL2;let s;function a(c){s=c}function o(c,u){r.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,f){if(f===0)return;let p,g;if(i)p=r,g="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),g="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[g](s,c,u,f),t.update(u,s,f)}this.setMode=a,this.render=o,this.renderInstances=l}function u0(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(C){if(C==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&r instanceof WebGL2ComputeRenderingContext;let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,f=r.getParameter(34930),p=r.getParameter(35660),g=r.getParameter(3379),x=r.getParameter(34076),h=r.getParameter(34921),d=r.getParameter(36347),m=r.getParameter(36348),v=r.getParameter(36349),y=p>0,_=a||e.has("OES_texture_float"),S=y&&_,M=a?r.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:x,maxAttributes:h,maxVertexUniforms:d,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:S,maxSamples:M}}function d0(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Vn,o=new kt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p,g){const x=f.length!==0||p||n!==0||i;return i=p,t=u(f,g,0),n=f.length,x},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(f,p,g){const x=f.clippingPlanes,h=f.clipIntersection,d=f.clipShadows,m=r.get(f);if(!i||x===null||x.length===0||s&&!d)s?u(null):c();else{const v=s?0:n,y=v*4;let _=m.clippingState||null;l.value=_,_=u(x,p,y,g);for(let S=0;S!==y;++S)_[S]=t[S];m.clippingState=_,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,g,x){const h=f!==null?f.length:0;let d=null;if(h!==0){if(d=l.value,x!==!0||d===null){const m=g+h*4,v=p.matrixWorldInverse;o.getNormalMatrix(v),(d===null||d.length<m)&&(d=new Float32Array(m));for(let y=0,_=g;y!==h;
vendor: 10,666 bytes, lines 2964-3039
2964++y,_+=4)a.copy(f[y]).applyMatrix4(v,o),a.normal.toArray(d,_),d[_+3]=a.constant}l.value=d,l.needsUpdate=!0}return e.numPlanes=h,e.numIntersection=0,d}}function f0(r){let e=new WeakMap;function t(a,o){return o===Ns?a.mapping=Xn:o===ks&&(a.mapping=Zn),a}function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const o=a.mapping;if(o===Ns||o===ks)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Iu(l.height/2);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ia extends Ea{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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,t,n,i,s,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=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,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),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const rs=4,cc=[.125,.215,.35,.446,.526,.582],di=20,fo=new Ia,hc=new Te;let po=null;const hi=(1+Math.sqrt(5))/2,$i=1/hi,uc=[new A(1,1,1),new A(-1,1,1),new A(1,1,-1),new A(-1,1,-1),new A(0,hi,$i),new A(0,hi,-$i),new A($i,0,hi),new A(-$i,0,hi),new A(hi,$i,0),new A(-hi,$i,0)];class rl{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,t=0,n=.1,i=100){po=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=pc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fc(),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(po),e.scissorTest=!1,Fr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Xn||e.mapping===Zn?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),po=this._renderer.getRenderTarget();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:ft,minFilter:ft,generateMipmaps:!1,type:cs,format:Ht,encoding:qn,depthBuffer:!1},i=dc(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dc(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=p0(s)),this._blurMaterial=m0(s,e,t)}return i}_compileMaterial(e){const t=new Tt(this._lodPlanes[0],e);this._renderer.compile(t,fo)}_sceneToCubeUV(e,t,n,i){const o=new Mt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,p=u.toneMapping;u.getClearColor(hc),u.toneMapping=hn,u.autoClear=!1;const g=new Jn({name:"PMREM.Background",side:Gt,depthWrite:!1,depthTest:!1}),x=new Tt(new Kn,g);let h=!1;const d=e.background;d?d.isColor&&(g.color.copy(d),e.background=null,h=!0):(g.color.copy(hc),h=!0);for(let m=0;m<6;m++){const v=m%3;v===0?(o.up.set(0,l[m],0),o.lookAt(c[m],0,0)):v===1?(o.up.set(0,0,l[m]),o.lookAt(0,c[m],0)):(o.up.set(0,l[m],0),o.lookAt(0,0,c[m]));const y=this._cubeSize;Fr(i,v*y,m>2?y:0,y,y),u.setRenderTarget(i),h&&u.render(x,o),u.render(e,o)}x.geometry.dispose(),x.material.dispose(),u.toneMapping=p,u.autoClear=f,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Xn||e.mapping===Zn;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=pc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fc());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new Tt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Fr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,fo)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=uc[(i-1)%uc.length];this._blur(e,i-1,i,s,a)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,f=new Tt(this._lodPlanes[i],c),p=c.uniforms,g=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*di-1),h=s/x,d=isFinite(s)?1+Math.floor(u*h):di;d>di&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${di}`);const m=[];let v=0;for(let C=0;C<di;++C){const b=C/h,w=Math.exp(-b*b/2);m.push(w),C===0?v+=w:C<d&&(v+=2*w)}for(let C=0;C<m.length;C++)m[C]=m[C]/v;p.envMap.value=e.texture,p.samples.value=d,p.weights.value=m,p.latitudinal.value=a==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:y}=this;p.dTheta.value=x,p.mipInt.value=y-n;const _=this._sizeLods[i],S=3*_*(i>y-rs?i-y+rs:0),M=4*(this._cubeSize-_);Fr(t,S,M,3*_,2*_),l.setRenderTarget(t),l.render(f,fo)}}function p0(r){const e=[],t=[],n=[];let i=r;const s=r-rs+1+cc.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);t.push(o);let l=1/o;a>r-rs?l=cc[a-r+rs-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],g=6,x=6,h=3,d=2,m=1,v=new Float32Array(h*x*g),y=new Float32Array(d*x*g),_=new Float32Array(m*x*g);for(let M=0;M<g;M++){const C=M%3*2/3-1,b=M>2?0:-1,w=[C,b,0,C+2/3,b,0,C+2/3,b+1,0,C,b,0,C+2/3,b+1,0,C,b+1,0];v.set(w,h*x*M),y.set(p,d*x*M);const P=[M,M,M,M,M,M];_.set(P,m*x*M)}const S=new Ve;S.setAttribute("position",new tt(v,h)),S.setAttribute("uv",new tt(y,d)),S.setAttribute("faceIndex",new tt(_,m)),e.push(S),i>rs&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function dc(r,e,t){const n=new Kt(r,e,t);return n.texture.mapping=ds,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Fr(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function m0(r,e,t){const n=new Float32Array(di),i=new A(0,1,0);return new dn({name:"SphericalGaussianBlur",defines:{n:di,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Sl(),fragmentShader:` 2965 2966 precision mediump float; 2967 precision mediump int; 2968 2969 varying vec3 vOutputDirection; 2970 2971 uniform sampler2D envMap; 2972 uniform int samples; 2973 uniform float weights[ n ]; 2974 uniform bool latitudinal; 2975 uniform float dTheta; 2976 uniform float mipInt; 2977 uniform vec3 poleAxis; 2978 2979 #define ENVMAP_TYPE_CUBE_UV 2980 #include <cube_uv_reflection_fragment> 2981 2982 vec3 getSample( float theta, vec3 axis ) { 2983 2984 float cosTheta = cos( theta ); 2985 // Rodrigues' axis-angle rotation 2986 vec3 sampleDirection = vOutputDirection * cosTheta 2987 + cross( axis, vOutputDirection ) * sin( theta ) 2988 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 2989 2990 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 2991 2992 } 2993 2994 void main() { 2995 2996 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 2997 2998 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 2999 3000 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3001 3002 } 3003 3004 axis = normalize( axis ); 3005 3006 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3007 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3008 3009 for ( int i = 1; i < n; i++ ) { 3010 3011 if ( i >= samples ) { 3012 3013 break; 3014 3015 } 3016 3017 float theta = dTheta * float( i ); 3018 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3019 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3020 3021 } 3022 3023 } 3024 `,blending:Tn,depthTest:!1,depthWrite:!1})}function fc(){return new dn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Sl(),fragmentShader:` 3025 3026 precision mediump float; 3027 precision mediump int; 3028 3029 varying vec3 vOutputDirection; 3030 3031 uniform sampler2D envMap; 3032 3033 #include <common> 3034 3035 void main() { 3036 3037 vec3 outputDirection = normalize( vOutputDirection ); 3038 vec2 uv = equirectUv( outputDirection ); 3039
3040 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3041 3042 } 3043 `,blending:Tn,depthTest:!1,depthWrite:!1})}function pc(){return new dn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Sl(),fragmentShader:` 3044 3045 precision mediump float; 3046 precision mediump int; 3047 3048 uniform float flipEnvMap; 3049 3050 varying vec3 vOutputDirection; 3051 3052 uniform samplerCube envMap; 3053 3054 void main() { 3055 3056 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3057 3058 } 3059 `,blending:Tn,depthTest:!1,depthWrite:!1})}function Sl(){return` 3060 3061 precision mediump float; 3062 precision mediump int; 3063 3064 attribute float faceIndex; 3065 3066 varying vec3 vOutputDirection; 3067 3068 // RH coordinate system; PMREM face-indexing convention 3069 vec3 getDirection( vec2 uv, float face ) { 3070 3071 uv = 2.0 * uv - 1.0; 3072 3073 vec3 direction = vec3( uv, 1.0 ); 3074 3075 if ( face == 0.0 ) { 3076 3077 direction = direction.zyx; // ( 1, v, u ) pos x 3078 3079 } else if ( face == 1.0 ) { 3080 3081 direction = direction.xzy; 3082 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3083 3084 } else if ( face == 2.0 ) { 3085 3086 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3087 3088 } else if ( face == 3.0 ) { 3089 3090 direction = direction.zyx; 3091 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3092 3093 } else if ( face == 4.0 ) { 3094 3095 direction = direction.xzy; 3096 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3097 3098 } else if ( face == 5.0 ) { 3099 3100 direction.z *= -1.0; // ( u, v, -1 ) neg z 3101 3102 } 3103 3104 return direction; 3105 3106 } 3107 3108 void main() { 3109 3110 vOutputDirection = getDirection( uv, faceIndex ); 3111 gl_Position = vec4( position, 1.0 ); 3112 3113 } 3114 `}function g0(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ns||l===ks,u=l===Xn||l===Zn;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let f=e.get(o);return t===null&&(t=new rl(r)),f=c?t.fromEquirectangular(o,f):t.fromCubemap(o,f),e.set(o,f),f.texture}else{if(e.has(o))return e.get(o).texture;{const f=o.image;if(c&&f&&f.height>0||u&&f&&i(f)){t===null&&(t=new rl(r));const p=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,p),o.addEventListener("dispose",s),p.texture}else return null}}}return o}function i(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function x0(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=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":i=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":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function y0(r,e,t,n){const i={},s=new WeakMap;function a(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const x in p.attributes)e.remove(p.attributes[x]);p.removeEventListener("dispose",a),delete i[p.id];const g=s.get(p);g&&(e.remove(g),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function o(f,p){return i[p.id]===!0||(p.addEventListener("dispose",a),i[p.id]=!0,t.memory.geometries++),p}function l(f){const p=f.attributes;for(const x in p)e.update(p[x],34962);const g=f.morphAttributes;for(const x in g){const h=g[x];for(let d=0,m=h.length;d<m;d++)e.update(h[d],34962)}}function c(f){const p=[],g=f.index,x=f.attributes.position;let h=0;if(g!==null){const v=g.array;h=g.version;for(let y=0,_=v.length;y<_;y+=3){const S=v[y+0],M=v[y+1],C=v[y+2];p.push(S,M,M,C,C,S)}}
vendor: 18,632 bytes, lines 3114-3131
3114else{const v=x.array;h=x.version;for(let y=0,_=v.length/3-1;y<_;y+=3){const S=y+0,M=y+1,C=y+2;p.push(S,M,M,C,C,S)}}const d=new(Au(p)?wl:vl)(p,1);d.version=h;const m=s.get(f);m&&e.remove(m),s.set(f,d)}function u(f){const p=s.get(f);if(p){const g=f.index;g!==null&&p.version<g.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:u}}function _0(r,e,t,n){const i=n.isWebGL2;let s;function a(p){s=p}let o,l;function c(p){o=p.type,l=p.bytesPerElement}function u(p,g){r.drawElements(s,g,o,p*l),t.update(g,s,1)}function f(p,g,x){if(x===0)return;let h,d;if(i)h=r,d="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",h===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[d](s,g,o,p*l,x),t.update(g,s,x)}this.setMode=a,this.setIndex=c,this.render=u,this.renderInstances=f}function b0(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case 4:t.triangles+=o*(s/3);break;case 1:t.lines+=o*(s/2);break;case 3:t.lines+=o*(s-1);break;case 2:t.lines+=o*s;break;case 0:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function v0(r,e){return r[0]-e[0]}function w0(r,e){return Math.abs(e[1])-Math.abs(r[1])}function S0(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,a=new Ke,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,u,f,p){const g=c.morphTargetInfluences;if(e.isWebGL2===!0){const x=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,h=x!==void 0?x.length:0;let d=s.get(u);if(d===void 0||d.count!==h){let U=function(){B.dispose(),s.delete(u),u.removeEventListener("dispose",U)};d!==void 0&&d.texture.dispose();const y=u.morphAttributes.position!==void 0,_=u.morphAttributes.normal!==void 0,S=u.morphAttributes.color!==void 0,M=u.morphAttributes.position||[],C=u.morphAttributes.normal||[],b=u.morphAttributes.color||[];let w=0;y===!0&&(w=1),_===!0&&(w=2),S===!0&&(w=3);let P=u.attributes.position.count*w,T=1;P>e.maxTextureSize&&(T=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const F=new Float32Array(P*T*4*h),B=new tr(F,P,T,h);B.type=Sn,B.needsUpdate=!0;const R=w*4;for(let q=0;q<h;q++){const J=M[q],X=C[q],O=b[q],N=P*T*4*q;for(let re=0;re<J.count;re++){const ee=re*R;y===!0&&(a.fromBufferAttribute(J,re),F[N+ee+0]=a.x,F[N+ee+1]=a.y,F[N+ee+2]=a.z,F[N+ee+3]=0),_===!0&&(a.fromBufferAttribute(X,re),F[N+ee+4]=a.x,F[N+ee+5]=a.y,F[N+ee+6]=a.z,F[N+ee+7]=0),S===!0&&(a.fromBufferAttribute(O,re),F[N+ee+8]=a.x,F[N+ee+9]=a.y,F[N+ee+10]=a.z,F[N+ee+11]=O.itemSize===4?a.w:1)}}d={count:h,texture:B,size:new se(P,T)},s.set(u,d),u.addEventListener("dispose",U)}let m=0;for(let y=0;y<g.length;y++)m+=g[y];const v=u.morphTargetsRelative?1:1-m;p.getUniforms().setValue(r,"morphTargetBaseInfluence",v),p.getUniforms().setValue(r,"morphTargetInfluences",g),p.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),p.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}else{const x=g===void 0?0:g.length;let h=n[u.id];if(h===void 0||h.length!==x){h=[];for(let _=0;_<x;_++)h[_]=[_,0];n[u.id]=h}for(let _=0;_<x;_++){const S=h[_];S[0]=_,S[1]=g[_]}h.sort(w0);for(let _=0;_<8;_++)_<x&&h[_][1]?(o[_][0]=h[_][0],o[_][1]=h[_][1]):(o[_][0]=Number.MAX_SAFE_INTEGER,o[_][1]=0);o.sort(v0);const d=u.morphAttributes.position,m=u.morphAttributes.normal;let v=0;for(let _=0;_<8;_++){const S=o[_],M=S[0],C=S[1];M!==Number.MAX_SAFE_INTEGER&&C?(d&&u.getAttribute("morphTarget"+_)!==d[M]&&u.setAttribute("morphTarget"+_,d[M]),m&&u.getAttribute("morphNormal"+_)!==m[M]&&u.setAttribute("morphNormal"+_,m[M]),i[_]=C,v+=C):(d&&u.hasAttribute("morphTarget"+_)===!0&&u.deleteAttribute("morphTarget"+_),m&&u.hasAttribute("morphNormal"+_)===!0&&u.deleteAttribute("morphNormal"+_),i[_]=0)}const y=u.morphTargetsRelative?1:1-v;p.getUniforms().setValue(r,"morphTargetBaseInfluence",y),p.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function M0(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,f=e.get(l,u);return i.get(f)!==c&&(e.update(f),i.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),f}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Ru=new _t,zu=new tr,Du=new Aa,Ou=new ir,mc=[],gc=[],xc=new Float32Array(16),yc=new Float32Array(9),_c=new Float32Array(4);function ms(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=mc[i];if(s===void 0&&(s=new Float32Array(i),mc[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function bt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function vt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function La(r,e){let t=gc[e];t===void 0&&(t=new Int32Array(e),gc[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function T0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function A0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bt(t,e))return;r.uniform2fv(this.addr,e),vt(t,e)}}function C0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(bt(t,e))return;r.uniform3fv(this.addr,e),vt(t,e)}}function E0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bt(t,e))return;r.uniform4fv(this.addr,e),vt(t,e)}}function P0(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),vt(t,e)}else{if(bt(t,n))return;_c.set(n),r.uniformMatrix2fv(this.addr,!1,_c),vt(t,n)}}function I0(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),vt(t,e)}else{if(bt(t,n))return;yc.set(n),r.uniformMatrix3fv(this.addr,!1,yc),vt(t,n)}}function L0(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),vt(t,e)}else{if(bt(t,n))return;xc.set(n),r.uniformMatrix4fv(this.addr,!1,xc),vt(t,n)}}function R0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function z0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bt(t,e))return;r.uniform2iv(this.addr,e),vt(t,e)}}function D0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(bt(t,e))return;r.uniform3iv(this.addr,e),vt(t,e)}}function O0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bt(t,e))return;r.uniform4iv(this.addr,e),vt(t,e)}}function N0(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function k0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bt(t,e))return;r.uniform2uiv(this.addr,e),vt(t,e)}}function B0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(bt(t,e))return;r.uniform3uiv(this.addr,e),vt(t,e)}}function F0(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bt(t,e))return;r.uniform4uiv(this.addr,e),vt(t,e)}}function U0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2D(e||Ru,i)}function V0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Du,i)}function H0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Ou,i)}function G0(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||zu,i)}function W0(r){switch(r){case 5126:return T0;case 35664:return A0;case 35665:return C0;case 35666:return E0;case 35674:return P0;case 35675:return I0;case 35676:return L0;case 5124:case 35670:return R0;case 35667:case 35671:return z0;case 35668:case 35672:return D0;case 35669:case 35673:return O0;case 5125:return N0;case 36294:return k0;case 36295:return B0;case 36296:return F0;case 35678:case 36198:case 36298:case 36306:case 35682:return U0;case 35679:case 36299:case 36307:return V0;case 35680:case 36300:case 36308:case 36293:return H0;case 36289:case 36303:case 36311:case 36292:return G0}}function X0(r,e){r.uniform1fv(this.addr,e)}function Z0(r,e){const t=ms(e,this.size,2);r.uniform2fv(this.addr,t)}function j0(r,e){const t=ms(e,this.size,3);r.uniform3fv(this.addr,t)}function q0(r,e){const t=ms(e,this.size,4);r.uniform4fv(this.addr,t)}function Y0(r,e){const t=ms(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function $0(r,e){const t=ms(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function J0(r,e){const t=ms(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function K0(r,e){r.uniform1iv(this.addr,e)}function Q0(r,e){r.uniform2iv(this.addr,e)}function ex(r,e){r.uniform3iv(this.addr,e)}function tx(r,e){r.uniform4iv(this.addr,e)}function nx(r,e){r.uniform1uiv(this.addr,e)}function ix(r,e){r.uniform2uiv(this.addr,e)}function sx(r,e){r.uniform3uiv(this.addr,e)}function rx(r,e){r.uniform4uiv(this.addr,e)}function ax(r,e,t){const n=this.cache,i=e.length,s=La(t,i);bt(n,s)||(r.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||Ru,s[a])}function ox(r,e,t){const n=this.cache,i=e.length,s=La(t,i);bt(n,s)||(r.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Du,s[a])}function lx(r,e,t){const n=this.cache,i=e.length,s=La(t,i);bt(n,s)||(r.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Ou,s[a])}function cx(r,e,t){const n=this.cache,i=e.length,s=La(t,i);bt(n,s)||(r.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||zu,s[a])}function hx(r){switch(r){case 5126:return X0;case 35664:return Z0;case 35665:return j0;case 35666:return q0;case 35674:return Y0;case 35675:return $0;case 35676:return J0;case 5124:case 35670:return K0;case 35667:case 35671:return Q0;case 35668:case 35672:return ex;case 35669:case 35673:return tx;case 5125:return nx;case 36294:return ix;case 36295:return sx;case 36296:return rx;case 35678:case 36198:case 36298:case 36306:case 35682:return ax;case 35679:case 36299:case 36307:return ox;case 35680:case 36300:case 36308:case 36293:return lx;case 36289:case 36303:case 36311:case 36292:return cx}}class ux{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=W0(t.type)}}class dx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=hx(t.type)}}class fx{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const mo=/(\w+)(\])?(\[|\.)?/g;function bc(r,e){r.seq.push(e),r.map[e.id]=e}function px(r,e,t){const n=r.name,i=n.length;for(mo.lastIndex=0;;){const s=mo.exec(n),a=mo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){bc(t,c===void 0?new ux(o,r,e):new dx(o,r,e));break}else{let f=t.map[o];f===void 0&&(f=new fx(o),bc(t,f)),t=f}}}class pa{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);px(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function vc(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}let mx=0;function gx(r,e){const t=r.split(` 3115`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(` 3116`)}function xx(r){switch(r){case qn:return["Linear","( value )"];case ot:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function wc(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` 3117 3118`+i+` 3119 3120`+gx(r.getShaderSource(e),a)}else return i}function yx(r,e){const t=xx(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function _x(r,e){let t;switch(e){case Kh:t="Linear";break;case Qh:t="Reinhard";break;case eu:t="OptimizedCineon";break;case tu:t="ACESFilmic";break;case nu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function bx(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ls).join(` 3121`)}function vx(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3122`)}function wx(r,e){const t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===35674&&(o=2),s.type===35675&&(o=3),s.type===35676&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Ls(r){return r!==""}function Sc(r,e){const t=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,t).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 Mc(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Sx=/^[ \t]*#include +<([\w\d./]+)>/gm;function al(r){return r.replace(Sx,Mx)}function Mx(r,e){const t=Fe[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return al(t)}const Tx=/#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 Tc(r){return r.replace(Tx,Ax)}function Ax(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Ac(r){let e="precision "+r.precision+` float; 3123precision `+r.precision+" int;";return r.precision==="highp"?e+=` 3124#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3125#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3126#define LOW_PRECISION`),e}function Cx(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===fl?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Ih?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===is&&(e="SHADOWMAP_TYPE_VSM"),e}function Ex(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Xn:case Zn:e="ENVMAP_TYPE_CUBE";break;case ds:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Px(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Zn:e="ENVMAP_MODE_REFRACTION";break}return e}function Ix(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case er:e="ENVMAP_BLENDING_MULTIPLY";break;case $h:e="ENVMAP_BLENDING_MIX";break;case Jh:e="ENVMAP_BLENDING_ADD";break}return e}function Lx(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Rx(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Cx(t),c=Ex(t),u=Px(t),f=Ix(t),p=Lx(t),g=t.isWebGL2?"":bx(t),x=vx(s),h=i.createProgram();let d,m,v=t.glslVersion?"#version "+t.glslVersion+` 3127`:"";t.isRawShaderMaterial?(d=[x].filter(Ls).join(` 3128`),d.length>0&&(d+=` 3129`),m=[g,x].filter(Ls).join(` 3130`),m.length>0&&(m+=` 3131`)):(d=[Ac(t),"#define SHADER_NAME "+t.shaderName,x,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3131IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3132`].filter(Ls).join(` 3133`),m=[g,Ac(t),"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==hn?"#define TONE_MAPPING":"",t.toneMapping!==hn?Fe.tonemapping_pars_fragment:"",t.toneMapping!==hn?_x("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fe.encodings_pars_fragment,yx("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3134`].filter(Ls).join(` 3135`)),a=al(a),a=Sc(a,t),a=Mc(a,t),o=al(o),o=Sc(o,t),o=Mc(o,t),a=Tc(a),o=Tc(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v=`#version 300 es 3136`,d=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3137`)+` 3138`+d,m=["#define varying in",t.glslVersion===il?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===il?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 3139`)+` 3140`+m);const y=v+d+a,_=v+m+o,S=vc(i,35633,y),M=vc(i,35632,_);if(i.attachShader(h,S),i.attachShader(h,M),t.index0AttributeName!==void 0?i.bindAttribLocation(h,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(h,0,"position"),i.linkProgram(h),r.debug.checkSha
vendor: 8,016 bytes, lines 3140-3144
3140derErrors){const w=i.getProgramInfoLog(h).trim(),P=i.getShaderInfoLog(S).trim(),T=i.getShaderInfoLog(M).trim();let F=!0,B=!0;if(i.getProgramParameter(h,35714)===!1){F=!1;const R=wc(i,S,"vertex"),U=wc(i,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(h,35715)+` 3141 3142Program Info Log: `+w+` 3143`+R+` 3144`+U)}else w!==""?console.warn("THREE.WebGLProgram: Program Info Log:",w):(P===""||T==="")&&(B=!1);B&&(this.diagnostics={runnable:F,programLog:w,vertexShader:{log:P,prefix:d},fragmentShader:{log:T,prefix:m}})}i.deleteShader(S),i.deleteShader(M);let C;this.getUniforms=function(){return C===void 0&&(C=new pa(i,h)),C};let b;return this.getAttributes=function(){return b===void 0&&(b=wx(i,h)),b},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.name=t.shaderName,this.id=mx++,this.cacheKey=e,this.usedTimes=1,this.program=h,this.vertexShader=S,this.fragmentShader=M,this}let zx=0;class Dx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Ox(e),t.set(e,n)),n}}class Ox{constructor(e){this.id=zx++,this.code=e,this.usedTimes=0}}function Nx(r,e,t,n,i,s,a){const o=new Ca,l=new Dx,c=[],u=i.isWebGL2,f=i.logarithmicDepthBuffer,p=i.vertexTextures;let g=i.precision;const x={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 h(b,w,P,T,F){const B=T.fog,R=F.geometry,U=b.isMeshStandardMaterial?T.environment:null,q=(b.isMeshStandardMaterial?t:e).get(b.envMap||U),J=q&&q.mapping===ds?q.image.height:null,X=x[b.type];b.precision!==null&&(g=i.getMaxPrecision(b.precision),g!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",g,"instead."));const O=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,N=O!==void 0?O.length:0;let re=0;R.morphAttributes.position!==void 0&&(re=1),R.morphAttributes.normal!==void 0&&(re=2),R.morphAttributes.color!==void 0&&(re=3);let ee,le,me,he;if(X){const we=sn[X];ee=we.vertexShader,le=we.fragmentShader}else ee=b.vertexShader,le=b.fragmentShader,l.update(b),me=l.getVertexShaderID(b),he=l.getFragmentShaderID(b);const H=r.getRenderTarget(),Ae=b.alphaTest>0,k=b.clearcoat>0,Y=b.iridescence>0;return{isWebGL2:u,shaderID:X,shaderName:b.type,vertexShader:ee,fragmentShader:le,defines:b.defines,customVertexShaderID:me,customFragmentShaderID:he,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:g,instancing:F.isInstancedMesh===!0,instancingColor:F.isInstancedMesh===!0&&F.instanceColor!==null,supportsVertexTextures:p,outputEncoding:H===null?r.outputEncoding:H.isXRRenderTarget===!0?H.texture.encoding:qn,map:!!b.map,matcap:!!b.matcap,envMap:!!q,envMapMode:q&&q.mapping,envMapCubeUVHeight:J,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===Su,tangentSpaceNormalMap:b.normalMapType===$n,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===ot,clearcoat:k,clearcoatMap:k&&!!b.clearcoatMap,clearcoatRoughnessMap:k&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:k&&!!b.clearcoatNormalMap,iridescence:Y,iridescenceMap:Y&&!!b.iridescenceMap,iridescenceThicknessMap:Y&&!!b.iridescenceThicknessMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,opaque:b.transparent===!1&&b.blending===xi,alphaMap:!!b.alphaMap,alphaTest:Ae,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!R.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.iridescenceMap||!!b.iridescenceThicknessMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(b.map||b.bumpMap||b.normalMap||b.specularMap||b.alphaMap||b.emissiveMap||b.roughnessMap||b.metalnessMap||b.clearcoatNormalMap||b.iridescenceMap||b.iridescenceThicknessMap||b.transmission>0||b.transmissionMap||b.thicknessMap||b.specularIntensityMap||b.specularColorMap||b.sheen>0||b.sheenColorMap||b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!B,useFog:b.fog===!0,fogExp2:B&&B.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:f,skinning:F.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:N,morphTextureStride:re,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&P.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:hn,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===wn,flipSided:b.side===Gt,useDepthPacking:!!b.depthPacking,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function d(b){const w=[];if(b.shaderID?w.push(b.shaderID):(w.push(b.customVertexShaderID),w.push(b.customFragmentShaderID)),b.defines!==void 0)for(const P in b.defines)w.push(P),w.push(b.defines[P]);return b.isRawShaderMaterial===!1&&(m(w,b),v(w,b),w.push(r.outputEncoding)),w.push(b.customProgramCacheKey),w.join()}function m(b,w){b.push(w.precision),b.push(w.outputEncoding),b.push(w.envMapMode),b.push(w.envMapCubeUVHeight),b.push(w.combine),b.push(w.vertexUvs),b.pu
vendor: 12,691 bytes, lines 3144-3150
3144sh(w.fogExp2),b.push(w.sizeAttenuation),b.push(w.morphTargetsCount),b.push(w.morphAttributeCount),b.push(w.numDirLights),b.push(w.numPointLights),b.push(w.numSpotLights),b.push(w.numSpotLightMaps),b.push(w.numHemiLights),b.push(w.numRectAreaLights),b.push(w.numDirLightShadows),b.push(w.numPointLightShadows),b.push(w.numSpotLightShadows),b.push(w.numSpotLightShadowsWithMaps),b.push(w.shadowMapType),b.push(w.toneMapping),b.push(w.numClippingPlanes),b.push(w.numClipIntersection),b.push(w.depthPacking)}function v(b,w){o.disableAll(),w.isWebGL2&&o.enable(0),w.supportsVertexTextures&&o.enable(1),w.instancing&&o.enable(2),w.instancingColor&&o.enable(3),w.map&&o.enable(4),w.matcap&&o.enable(5),w.envMap&&o.enable(6),w.lightMap&&o.enable(7),w.aoMap&&o.enable(8),w.emissiveMap&&o.enable(9),w.bumpMap&&o.enable(10),w.normalMap&&o.enable(11),w.objectSpaceNormalMap&&o.enable(12),w.tangentSpaceNormalMap&&o.enable(13),w.clearcoat&&o.enable(14),w.clearcoatMap&&o.enable(15),w.clearcoatRoughnessMap&&o.enable(16),w.clearcoatNormalMap&&o.enable(17),w.iridescence&&o.enable(18),w.iridescenceMap&&o.enable(19),w.iridescenceThicknessMap&&o.enable(20),w.displacementMap&&o.enable(21),w.specularMap&&o.enable(22),w.roughnessMap&&o.enable(23),w.metalnessMap&&o.enable(24),w.gradientMap&&o.enable(25),w.alphaMap&&o.enable(26),w.alphaTest&&o.enable(27),w.vertexColors&&o.enable(28),w.vertexAlphas&&o.enable(29),w.vertexUvs&&o.enable(30),w.vertexTangents&&o.enable(31),w.uvsVertexOnly&&o.enable(32),b.push(o.mask),o.disableAll(),w.fog&&o.enable(0),w.useFog&&o.enable(1),w.flatShading&&o.enable(2),w.logarithmicDepthBuffer&&o.enable(3),w.skinning&&o.enable(4),w.morphTargets&&o.enable(5),w.morphNormals&&o.enable(6),w.morphColors&&o.enable(7),w.premultipliedAlpha&&o.enable(8),w.shadowMapEnabled&&o.enable(9),w.physicallyCorrectLights&&o.enable(10),w.doubleSided&&o.enable(11),w.flipSided&&o.enable(12),w.useDepthPacking&&o.enable(13),w.dithering&&o.enable(14),w.specularIntensityMap&&o.enable(15),w.specularColorMap&&o.enable(16),w.transmission&&o.enable(17),w.transmissionMap&&o.enable(18),w.thicknessMap&&o.enable(19),w.sheen&&o.enable(20),w.sheenColorMap&&o.enable(21),w.sheenRoughnessMap&&o.enable(22),w.decodeVideoTexture&&o.enable(23),w.opaque&&o.enable(24),b.push(o.mask)}function y(b){const w=x[b.type];let P;if(w){const T=sn[w];P=Eu.clone(T.uniforms)}else P=b.uniforms;return P}function _(b,w){let P;for(let T=0,F=c.length;T<F;T++){const B=c[T];if(B.cacheKey===w){P=B,++P.usedTimes;break}}return P===void 0&&(P=new Rx(r,w,b,s),c.push(P)),P}function S(b){if(--b.usedTimes===0){const w=c.indexOf(b);c[w]=c[c.length-1],c.pop(),b.destroy()}}function M(b){l.remove(b)}function C(){l.dispose()}return{getParameters:h,getProgramCacheKey:d,getUniforms:y,acquireProgram:_,releaseProgram:S,releaseShaderCache:M,programs:c,dispose:C}}function kx(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,o){r.get(s)[a]=o}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Bx(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 Cc(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 Ec(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(f,p,g,x,h,d){let m=r[e];return m===void 0?(m={id:f.id,object:f,geometry:p,material:g,groupOrder:x,renderOrder:f.renderOrder,z:h,group:d},r[e]=m):(m.id=f.id,m.object=f,m.geometry=p,m.material=g,m.groupOrder=x,m.renderOrder=f.renderOrder,m.z=h,m.group=d),e++,m}function o(f,p,g,x,h,d){const m=a(f,p,g,x,h,d);g.transmission>0?n.push(m):g.transparent===!0?i.push(m):t.push(m)}function l(f,p,g,x,h,d){const m=a(f,p,g,x,h,d);g.transmission>0?n.unshift(m):g.transparent===!0?i.unshift(m):t.unshift(m)}function c(f,p){t.length>1&&t.sort(f||Bx),n.length>1&&n.sort(p||Cc),i.length>1&&i.sort(p||Cc)}function u(){for(let f=e,p=r.length;f<p;f++){const g=r[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:u,sort:c}}function Fx(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new Ec,r.set(n,[a])):i>=s.length?(a=new Ec,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function Ux(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new A,color:new Te};break;case"SpotLight":t={position:new A,direction:new A,color:new Te,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new A,color:new Te,distance:0,decay:0};break;case"HemisphereLight":t={direction:new A,skyColor:new Te,groundColor:new Te};break;case"RectAreaLight":t={color:new Te,position:new A,halfWidth:new A,halfHeight:new A};break}return r[e.id]=t,t}}}function Vx(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Hx=0;function Gx(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Wx(r,e){const t=new Ux,n=Vx(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)i.probe.push(new A);const s=new A,a=new Be,o=new Be;function l(u,f){let p=0,g=0,x=0;for(let T=0;T<9;T++)i.probe[T].set(0,0,0);let h=0,d=0,m=0,v=0,y=0,_=0,S=0,M=0,C=0,b=0;u.sort(Gx);const w=f!==!0?Math.PI:1;for(let T=0,F=u.length;T<F;T++){const B=u[T],R=B.color,U=B.intensity,q=B.distance,J=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)p+=R.r*U*w,g+=R.g*U*w,x+=R.b*U*w;else if(B.isLightProbe)for(let X=0;X<9;X++)i.probe[X].addScaledVector(B.sh.coefficients[X],U);else if(B.isDirectionalLight){const X=t.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity*w),B.castShadow){const O=B.shadow,N=n.get(B);N.shadowBias=O.bias,N.shadowNormalBias=O.normalBias,N.shadowRadius=O.radius,N.shadowMapSize=O.mapSize,i.directionalShadow[h]=N,i.directionalShadowMap[h]=J,i.directionalShadowMatrix[h]=B.shadow.matrix,_++}i.directional[h]=X,h++}else if(B.isSpotLight){const X=t.get(B);X.position.setFromMatrixPosition(B.matrixWorld),X.color.copy(R).multiplyScalar(U*w),X.distance=q,X.coneCos=Math.cos(B.angle),X.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),X.decay=B.decay,i.spot[m]=X;const O=B.shadow;if(B.map&&(i.spotLightMap[C]=B.map,C++,O.updateMatrices(B),B.castShadow&&b++),i.spotLightMatrix[m]=O.matrix,B.castShadow){const N=n.get(B);N.shadowBias=O.bias,N.shadowNormalBias=O.normalBias,N.shadowRadius=O.radius,N.shadowMapSize=O.mapSize,i.spotShadow[m]=N,i.spotShadowMap[m]=J,M++}m++}else if(B.isRectAreaLight){const X=t.get(B);X.color.copy(R).multiplyScalar(U),X.halfWidth.set(B.width*.5,0,0),X.halfHeight.set(0,B.height*.5,0),i.rectArea[v]=X,v++}else if(B.isPointLight){const X=t.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity*w),X.distance=B.distance,X.decay=B.decay,B.castShadow){const O=B.shadow,N=n.get(B);N.shadowBias=O.bias,N.shadowNormalBias=O.normalBias,N.shadowRadius=O.radius,N.shadowMapSize=O.mapSize,N.shadowCameraNear=O.camera.near,N.shadowCameraFar=O.camera.far,i.pointShadow[d]=N,i.pointShadowMap[d]=J,i.pointShadowMatrix[d]=B.shadow.matrix,S++}i.point[d]=X,d++}else if(B.isHemisphereLight){const X=t.get(B);X.skyColor.copy(B.color).multiplyScalar(U*w),X.groundColor.copy(B.groundColor).multiplyScalar(U*w),i.hemi[y]=X,y++}}v>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ge.LTC_FLOAT_1,i.rectAreaLTC2=ge.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ge.LTC_HALF_1,i.rectAreaLTC2=ge.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=g,i.ambient[2]=x;const P=i.hash;(P.directionalLength!==h||P.pointLength!==d||P.spotLength!==m||P.rectAreaLength!==v||P.hemiLength!==y||P.numDirectionalShadows!==_||P.numPointShadows!==S||P.numSpotShadows!==M||P.numSpotMaps!==C)&&(i.directional.length=h,i.spot.length=m,i.rectArea.length=v,i.point.length=d,i.hemi.length=y,i.directionalShadow.length=_,i.directionalShadowMap.length=_,i.pointShadow.length=S,i.pointShadowMap.length=S,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=_,i.pointShadowMatrix.length=S,i.spotLightMatrix.length=M+C-b,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=b,P.directionalLength=h,P.pointLength=d,P.spotLength=m,P.rectAreaLength=v,P.hemiLength=y,P.numDirectionalShadows=_,P.numPointShadows=S,P.numSpotShadows=M,P.numSpotMaps=C,i.version=Hx++)}function c(u,f){let p=0,g=0,x=0,h=0,d=0;const m=f.matrixWorldInverse;for(let v=0,y=u.length;v<y;v++){const _=u[v];if(_.isDirectionalLight){const S=i.directional[p];S.direction.setFromMatrixPosition(_.matrixWorld),s.setFromMatrixPosition(_.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(m),p++}else if(_.isSpotLight){const S=i.spot[x];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(m),S.direction.setFromMatrixPosition(_.matrixWorld),s.setFromMatrixPosition(_.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(m),x++}else if(_.isRectAreaLight){const S=i.rectArea[h];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(m),o.identity(),a.copy(_.matrixWorld),a.premultiply(m),o.extractRotation(a),S.halfWidth.set(_.width*.5,0,0),S.halfHeight.set(0,_.height*.5,0),S.halfWidth.applyMatrix4(o),S.halfHeight.applyMatrix4(o),h++}else if(_.isPointLight){const S=i.point[g];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(m),g++}else if(_.isHemisphereLight){const S=i.hemi[d];S.direction.setFromMatrixPosition(_.matrixWorld),S.direction.transformDirection(m),d++}}}return{setup:l,setupView:c,state:i}}function Pc(r,e){const t=new Wx(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(f){n.push(f)}function o(f){i.push(f)}function l(f){t.setup(n,f)}function c(f){t.setupView(n,f)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function Xx(r,e){let t=new WeakMap;function n(s,a=0){const o=t.get(s);let l;return o===void 0?(l=new Pc(r,e),t.set(s,[l])):a>=o.length?(l=new Pc(r,e),o.push(l)):l=o[a],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class Ml extends It{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=vu,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 Tl extends It{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new A,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Zx=`void main() { 3145 gl_Position = vec4( position, 1.0 ); 3146}`,jx=`uniform sampler2D shadow_pass; 3147uniform vec2 resolution; 3148uniform float radius; 3149#include <packing> 3150void main() {
3151 const float samples = float( VSM_SAMPLES ); 3152 float mean = 0.0; 3153 float squared_mean = 0.0; 3154 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3155 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3156 for ( float i = 0.0; i < samples; i ++ ) { 3157 float uvOffset = uvStart + i * uvStride; 3158 #ifdef HORIZONTAL_PASS 3159 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3160 mean += distribution.x; 3161 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3162 #else 3163 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3164 mean += depth; 3165 squared_mean += depth * depth; 3166 #endif 3167 } 3168 mean = mean / samples; 3169 squared_mean = squared_mean / samples; 3170 float std_dev = sqrt( squared_mean - mean * mean ); 3171 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3172}`;function qx(r,e,t){let n=new Pa;const i=new se,s=new se,a=new Ke,o=new Ml({depthPacking:wu}),l=new Tl,c={},u=t.maxTextureSize,f={0:Gt,1:wi,2:wn},p=new dn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new se},radius:{value:4}},vertexShader:Zx,fragmentShader:jx}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const x=new Ve;x.setAttribute("position",new tt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const h=new Tt(x,p),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=fl,this.render=function(_,S,M){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||_.length===0)return;const C=r.getRenderTarget(),b=r.getActiveCubeFace(),w=r.getActiveMipmapLevel(),P=r.state;P.setBlending(Tn),P.buffers.color.setClear(1,1,1,1),P.buffers.depth.setTest(!0),P.setScissorTest(!1);for(let T=0,F=_.length;T<F;T++){const B=_[T],R=B.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;i.copy(R.mapSize);const U=R.getFrameExtents();if(i.multiply(U),s.copy(R.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/U.x),i.x=s.x*U.x,R.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/U.y),i.y=s.y*U.y,R.mapSize.y=s.y)),R.map===null){const J=this.type!==is?{minFilter:xt,magFilter:xt}:{};R.map=new Kt(i.x,i.y,J),R.map.texture.name=B.name+".shadowMap",R.camera.updateProjectionMatrix()}r.setRenderTarget(R.map),r.clear();const q=R.getViewportCount();for(let J=0;J<q;J++){const X=R.getViewport(J);a.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),P.viewport(a),R.updateMatrices(B,J),n=R.getFrustum(),y(S,M,R.camera,B,this.type)}R.isPointLightShadow!==!0&&this.type===is&&m(R,M),R.needsUpdate=!1}d.needsUpdate=!1,r.setRenderTarget(C,b,w)};function m(_,S){const M=e.update(h);p.defines.VSM_SAMPLES!==_.blurSamples&&(p.defines.VSM_SAMPLES=_.blurSamples,g.defines.VSM_SAMPLES=_.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),_.mapPass===null&&(_.mapPass=new Kt(i.x,i.y)),p.uniforms.shadow_pass.value=_.map.texture,p.uniforms.resolution.value=_.mapSize,p.uniforms.radius.value=_.radius,r.setRenderTarget(_.mapPass),r.clear(),r.renderBufferDirect(S,null,M,p,h,null),g.uniforms.shadow_pass.value=_.mapPass.texture,g.uniforms.resolution.value=_.mapSize,g.uniforms.radius.value=_.radius,r.setRenderTarget(_.map),r.clear(),r.renderBufferDirect(S,null,M,g,h,null)}function v(_,S,M,C,b,w){let P=null;const T=M.isPointLight===!0?_.customDistanceMaterial:_.customDepthMaterial;if(T!==void 0?P=T:P=M.isPointLight===!0?l:o,r.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){const F=P.uuid,B=S.uuid;let R=c[F];R===void 0&&(R={},c[F]=R);let U=R[B];U===void 0&&(U=P.clone(),R[B]=U),P=U}return P.visible=S.visible,P.wireframe=S.wireframe,w===is?P.side=S.shadowSide!==null?S.shadowSide:S.side:P.side=S.shadowSide!==null?S.shadowSide:f[S.side],P.alphaMap=S.alphaMap,P.alphaTest=S.alphaTest,P.clipShadows=S.clipShadows,P.clippingPlanes=S.clippingPlanes,P.clipIntersection=S.clipIntersection,P.displacementMap=S.displacementMap,P.displacementScale=S.displacementScale,P.displacementBias=S.displacementBias,P.wireframeLinewidth=S.wireframeLinewidth,P.linewidth=S.linewidth,M.isPointLight===!0&&P.isMeshDistanceMaterial===!0&&(P.referencePosition.setFromMatrixPosition(M.matrixWorld),P.nearDistance=C,P.farDistance=b),P}function y(_,S,M,C,b){if(_.visible===!1)return;if(_.layers.test(S.layers)&&(_.isMesh||_.isLine||_.isPoints)&&(_.castShadow||_.receiveShadow&&b===is)&&(!_.frustumCulled||n.intersectsObject(_))){_.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,_.matrixWorld);const T=e.update(_),F=_.material;if(Array.isArray(F)){const B=T.groups;for(let R=0,U=B.length;R<U;R++){const q=B[R],J=F[q.materialIndex];if(J&&J.visible){const X=v(_,J,C,M.near,M.far,b);r.renderBufferDirect(M,null,T,X,_,q)}}}else if(F.visible){const B=v(_,F,C,M.near,M.far,b);r.renderBufferDirect(M,null,T,B,_,null)}}const P=_.children;for(let T=0,F=P.length;T<F;T++)y(P[T],S,M,C,b)}}function Yx(r,e,t){const n=t.isWebGL2;function i(){let D=!1;const $=new Ke;let ce=null;const ve=new Ke(0,0,0,0);return{setMask:function(Ce){ce!==Ce&&!D&&(r.colorMask(Ce,Ce,Ce,Ce),ce=Ce)},setLocked:function(Ce){D=Ce},setClear:function(Ce,Xe,it,ct,on){on===!0&&(Ce*=ct,Xe*=ct,it*=ct),$.set(Ce,Xe,it,ct),ve.equals($)===!1&&(r.clearColor(Ce,Xe,it,ct),ve.copy($))},reset:function(){D=!1,ce=null,ve.set(-1,0,0,0)}}}function s(){let D=!1,$=null,ce=null,ve=null;return{setTest:function(Ce){Ce?Ae(2929):k(2929)},setMask:function(Ce){$!==Ce&&!D&&(r.depthMask(Ce),$=Ce)},setFunc:function(Ce){if(ce!==Ce){switch(Ce){case Gh:r.depthFunc(512);break;case Wh:r.depthFunc(519);break;case Xh:r.depthFunc(513);break;
3172case xa:r.depthFunc(515);break;case Zh:r.depthFunc(514);break;case jh:r.depthFunc(518);break;case qh:r.depthFunc(516);break;case Yh:r.depthFunc(517);break;default:r.depthFunc(515)}ce=Ce}},setLocked:function(Ce){D=Ce},setClear:function(Ce){ve!==Ce&&(r.clearDepth(Ce),ve=Ce)},reset:function(){D=!1,$=null,ce=null,ve=null}}}function a(){let D=!1,$=null,ce=null,ve=null,Ce=null,Xe=null,it=null,ct=null,on=null;return{setTest:function(st){D||(st?Ae(2960):k(2960))},setMask:function(st){$!==st&&!D&&(r.stencilMask(st),$=st)},setFunc:function(st,Bt,Lt){(ce!==st||ve!==Bt||Ce!==Lt)&&(r.stencilFunc(st,Bt,Lt),ce=st,ve=Bt,Ce=Lt)},setOp:function(st,Bt,Lt){(Xe!==st||it!==Bt||ct!==Lt)&&(r.stencilOp(st,Bt,Lt),Xe=st,it=Bt,ct=Lt)},setLocked:function(st){D=st},setClear:function(st){on!==st&&(r.clearStencil(st),on=st)},reset:function(){D=!1,$=null,ce=null,ve=null,Ce=null,Xe=null,it=null,ct=null,on=null}}}const o=new i,l=new s,c=new a,u=new WeakMap,f=new WeakMap;let p={},g={},x=new WeakMap,h=[],d=null,m=!1,v=null,y=null,_=null,S=null,M=null,C=null,b=null,w=!1,P=null,T=null,F=null,B=null,R=null;const U=r.getParameter(35661);let q=!1,J=0;const X=r.getParameter(7938);X.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(X)[1]),q=J>=1):X.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),q=J>=2);let O=null,N={};const re=r.getParameter(3088),ee=r.getParameter(2978),le=new Ke().fromArray(re),me=new Ke().fromArray(ee);function he(D,$,ce){const ve=new Uint8Array(4),Ce=r.createTexture();r.bindTexture(D,Ce),r.texParameteri(D,10241,9728),r.texParameteri(D,10240,9728);for(let Xe=0;Xe<ce;Xe++)r.texImage2D($+Xe,0,6408,1,1,0,6408,5121,ve);return Ce}const H={};H[3553]=he(3553,3553,1),H[34067]=he(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Ae(2929),l.setFunc(xa),ue(!1),Le(Io),Ae(2884),ie(Tn);function Ae(D){p[D]!==!0&&(r.enable(D),p[D]=!0)}function k(D){p[D]!==!1&&(r.disable(D),p[D]=!1)}function Y(D,$){return g[D]!==$?(r.bindFramebuffer(D,$),g[D]=$,n&&(D===36009&&(g[36160]=$),D===36160&&(g[36009]=$)),!0):!1}function oe(D,$){let ce=h,ve=!1;if(D)if(ce=x.get($),ce===void 0&&(ce=[],x.set($,ce)),D.isWebGLMultipleRenderTargets){const Ce=D.texture;if(ce.length!==Ce.length||ce[0]!==36064){for(let Xe=0,it=Ce.length;Xe<it;Xe++)ce[Xe]=36064+Xe;ce.length=Ce.length,ve=!0}}else ce[0]!==36064&&(ce[0]=36064,ve=!0);else ce[0]!==1029&&(ce[0]=1029,ve=!0);ve&&(t.isWebGL2?r.drawBuffers(ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(ce))}function we(D){return d!==D?(r.useProgram(D),d=D,!0):!1}const Z={[ui]:32774,[Rh]:32778,[zh]:32779};if(n)Z[Do]=32775,Z[Oo]=32776;else{const D=e.get("EXT_blend_minmax");D!==null&&(Z[Do]=D.MIN_EXT,Z[Oo]=D.MAX_EXT)}const W={[Dh]:0,[Oh]:1,[Nh]:768,[pl]:770,[Hh]:776,[Uh]:774,[Bh]:772,[kh]:769,[ml]:771,[Vh]:775,[Fh]:773};function ie(D,$,ce,ve,Ce,Xe,it,ct){if(D===Tn){m===!0&&(k(3042),m=!1);return}if(m===!1&&(Ae(3042),m=!0),D!==Lh){if(D!==v||ct!==w){if((y!==ui||M!==ui)&&(r.blendEquation(32774),y=ui,M=ui),ct)switch(D){case xi:r.blendFuncSeparate(1,771,1,771);break;case Lo:r.blendFunc(1,1);break;case Ro:r.blendFuncSeparate(0,769,0,1);break;case zo:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case xi:r.blendFuncSeparate(770,771,1,771);break;case Lo:r.blendFunc(770,1);break;case Ro:r.blendFuncSeparate(0,769,0,1);break;case zo:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}_=null,S=null,C=null,b=null,v=D,w=ct}return}Ce=Ce||$,Xe=Xe||ce,it=it||ve,($!==y||Ce!==M)&&(r.blendEquationSeparate(Z[$],Z[Ce]),y=$,M=Ce),(ce!==_||ve!==S||Xe!==C||it!==b)&&(r.blendFuncSeparate(W[ce],W[ve],W[Xe],W[it]),_=ce,S=ve,C=Xe,b=it),v=D,w=null}function pe(D,$){D.side===wn?k(2884):Ae(2884);let ce=D.side===Gt;$&&(ce=!ce),ue(ce),D.blending===xi&&D.transparent===!1?ie(Tn):ie(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),o.setMask(D.colorWrite);const ve=D.stencilWrite;c.setTest(ve),ve&&(c.setMask(D.stencilWriteMask),c.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),ye(
vendor: 6,914 bytes, line 3172
3172D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?Ae(32926):k(32926)}function ue(D){P!==D&&(D?r.frontFace(2304):r.frontFace(2305),P=D)}function Le(D){D!==Eh?(Ae(2884),D!==T&&(D===Io?r.cullFace(1029):D===Ph?r.cullFace(1028):r.cullFace(1032))):k(2884),T=D}function xe(D){D!==F&&(q&&r.lineWidth(D),F=D)}function ye(D,$,ce){D?(Ae(32823),(B!==$||R!==ce)&&(r.polygonOffset($,ce),B=$,R=ce)):k(32823)}function ke(D){D?Ae(3089):k(3089)}function ze(D){D===void 0&&(D=33984+U-1),O!==D&&(r.activeTexture(D),O=D)}function L(D,$,ce){ce===void 0&&(O===null?ce=33984+U-1:ce=O);let ve=N[ce];ve===void 0&&(ve={type:void 0,texture:void 0},N[ce]=ve),(ve.type!==D||ve.texture!==$)&&(O!==ce&&(r.activeTexture(ce),O=ce),r.bindTexture(D,$||H[D]),ve.type=D,ve.texture=$)}function E(){const D=N[O];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function j(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function K(){try{r.compressedTexImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ae(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function fe(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Se(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ne(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function z(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function be(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function de(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function _e(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Pe(D){le.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),le.copy(D))}function Me(D){me.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),me.copy(D))}function Oe(D,$){let ce=f.get($);ce===void 0&&(ce=new WeakMap,f.set($,ce));let ve=ce.get(D);ve===void 0&&(ve=r.getUniformBlockIndex($,D.name),ce.set(D,ve))}function Qe(D,$){const ve=f.get($).get(D);u.get(D)!==ve&&(r.uniformBlockBinding($,ve,D.__bindingPointIndex),u.set(D,ve))}function nt(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),p={},O=null,N={},g={},x=new WeakMap,h=[],d=null,m=!1,v=null,y=null,_=null,S=null,M=null,C=null,b=null,w=!1,P=null,T=null,F=null,B=null,R=null,le.set(0,0,r.canvas.width,r.canvas.height),me.set(0,0,r.canvas.width,r.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Ae,disable:k,bindFramebuffer:Y,drawBuffers:oe,useProgram:we,setBlending:ie,setMaterial:pe,setFlipSided:ue,setCullFace:Le,setLineWidth:xe,setPolygonOffset:ye,setScissorTest:ke,activeTexture:ze,bindTexture:L,unbindTexture:E,compressedTexImage2D:j,compressedTexImage3D:K,texImage2D:de,texImage3D:_e,updateUBOMapping:Oe,uniformBlockBinding:Qe,texStorage2D:z,texStorage3D:be,texSubImage2D:ae,texSubImage3D:fe,compressedTexSubImage2D:Se,compressedTexSubImage3D:ne,scissor:Pe,viewport:Me,reset:nt}}function $x(r,e,t,n,i,s,a){const o=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,f=i.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,g=/OculusBrowser/g.test(typeof navigator>"u"?"":navigator.userAgent),x=new WeakMap;let h;const d=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(L,E){return m?new OffscreenCanvas(L,E):Xs("canvas")}function y(L,E,j,K){let ae=1;if((L.width>K||L.height>K)&&(ae=K/Math.max(L.width,L.height)),ae<1||E===!0)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap){const fe=E?va:Math.floor,Se=fe(ae*L.width),ne=fe(ae*L.height);h===void 0&&(h=v(Se,ne));const z=j?v(Se,ne):h;return z.width=Se,z.height=ne,z.getContext("2d").drawImage(L,0,0,Se,ne),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+L.width+"x"+L.height+") to ("+Se+"x"+ne+")."),z}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+L.width+"x"+L.height+")."),L;return L}function _(L){return sl(L.width)&&sl(L.height)}function S(L){return o?!1:L.wrapS!==Pt||L.wrapT!==Pt||L.minFilter!==xt&&L.minFilter!==ft}function M(L,E){return L.generateMipmaps&&E&&L.minFilter!==xt&&L.minFilter!==ft}function C(L){r.generateMipmap(L)}function b(L,E,j,K,ae=!1){if(o===!1)return E;if(L!==null){if(r[L]!==void 0)return r[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let fe=E;return E===6403&&(j===5126&&(fe=33326),j===5131&&(fe=33325),j===5121&&(fe=33321)),E===33319&&(j===5126&&(fe=33328),j===5131&&(fe=33327),j===5121&&(fe=33323)),E===6408&&(j===5126&&(fe=34836),j===5131&&(fe=34842),j===5121&&(fe=K===ot&&ae===!1?35907:32856),j===32819&&(fe=32854),j===32820&&(fe=32855)),(fe===33325||fe===33326||fe===33327||fe===33328||fe===34842||fe===34836)&&e.get("EXT_color_buffer_float"),fe}function w(L,E,j){return M(L,j)===!0||L.isFramebufferTexture&&L.minFilter!==xt&&L.minFilter!==ft?Math.log2(Math.max(E.width,E.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?E.mipmaps.length:1}function P(L){return L===xt||L===ya||L===_a?9728:9729}function T(L){const E=L.target;E.removeEventListener("dispose",T),B(E),E.isVideoTexture&&x.delete(E)}function F(L){const E=L.target;E.removeEventListener("dispose",F),U(E)}function B(L){const E=n.get(L);if(E.__webglInit===void 0)return;const j=L.source,K=d.get(j);if(K){const ae=K[E.__cacheKey];ae.usedTimes--,ae.usedTimes===0&&R(L),Object.keys(K).length===0&&d.delete(j)}n.remove(L)}function R(L){const E=n.get(L);r.deleteTexture(E.__webglTexture);const j=L.source,K=d.get(j);delete K[E.__cacheKey],a.memory.textures--}function U(L){const E=L.texture,j=n.get(L),K=n.get(E);if(K.__webglTexture!==void 0&&(r.deleteTexture(K.__webglTexture),a.memory.textures--),L.depthTexture&&L.depthTexture.dispose(),L.isWebGLCubeRen
3172derTarget)for(let ae=0;ae<6;ae++)r.deleteFramebuffer(j.__webglFramebuffer[ae]),j.__webglDepthbuffer&&r.deleteRenderbuffer(j.__webglDepthbuffer[ae]);else{if(r.deleteFramebuffer(j.__webglFramebuffer),j.__webglDepthbuffer&&r.deleteRenderbuffer(j.__webglDepthbuffer),j.__webglMultisampledFramebuffer&&r.deleteFramebuffer(j.__webglMultisampledFramebuffer),j.__webglColorRenderbuffer)for(let ae=0;ae<j.__webglColorRenderbuffer.length;ae++)j.__webglColorRenderbuffer[ae]&&r.deleteRenderbuffer(j.__webglColorRenderbuffer[ae]);j.__webglDepthRenderbuffer&&r.deleteRenderbuffer(j.__webglDepthRenderbuffer)}if(L.isWebGLMultipleRenderTargets)for(let ae=0,fe=E.length;ae<fe;ae++){const Se=n.get(E[ae]);Se.__webglTexture&&(r.deleteTexture(Se.__webglTexture),a.memory.textures--),n.remove(E[ae])}n.remove(E),n.remove(L)}let q=0;function J(){q=0}function X(){const L=q;return L>=l&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+l),q+=1,L}function O(L){const E=[];return E.push(L.wrapS),E.push(L.wrapT),E.push(L.wrapR||0),E.push(L.magFilter),E.push(L.minFilter),E.push(L.anisotropy),E.push(L.internalFormat),E.push(L.format),E.push(L.type),E.push(L.generateMipmaps),E.push(L.premultiplyAlpha),E.push(L.flipY),E.push(L.unpackAlignment),E.push(L.encoding),E.join()}function N(L,E){const j=n.get(L);if(L.isVideoTexture&&ke(L),L.isRenderTargetTexture===!1&&L.version>0&&j.__version!==L.version){const K=L.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{k(j,L,E);return}}t.bindTexture(3553,j.__webglTexture,33984+E)}function re(L,E){const j=n.get(L);if(L.version>0&&j.__version!==L.version){k(j,L,E);return}t.bindTexture(35866,j.__webglTexture,33984+E)}function ee(L,E){const j=n.get(L);if(L.version>0&&j.__version!==L.version){k(j,L,E);return}t.bindTexture(32879,j.__webglTexture,33984+E)}function le(L,E){const j=n.get(L);if(L.version>0&&j.__version!==L.version){Y(j,L,E);return}t.bindTexture(34067,j.__webglTexture,33984+E)}const me={[Bs]:10497,[Pt]:33071,[Fs]:33648},he={[xt]:9728,[ya]:9984,[_a]:9986,[ft]:9729,[gl]:9985,[Ci]:9987};function H(L,E,j){if(j?(r.texParameteri(L,10242,me[E.wrapS]),r.texParameteri(L,10243,me[E.wrapT]),(L===32879||L===35866)&&r.texParameteri(L,32882,me[E.wrapR]),r.texParameteri(L,10240,he[E.magFilter]),r.texParameteri(L,10241,he[E.minFilter])):(r.texParameteri(L,10242,33071),r.texParameteri(L,10243,33071),(L===32879||L===35866)&&r.texParameteri(L,32882,33071),(E.wrapS!==Pt||E.wrapT!==Pt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(L,10240,P(E.magFilter)),r.texParameteri(L,10241,P(E.minFilter)),E.minFilter!==xt&&E.minFilter!==ft&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const K=e.get("EXT_texture_filter_anisotropic");if(E.type===Sn&&e.has("OES_texture_float_linear")===!1||o===!1&&E.type===cs&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(L,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function Ae(L,E){let j=!1;L.__webglInit===void 0&&(L.__webglInit=!0,E.addEventListener("dispose",T));const K=E.source;let ae=d.get(K);ae===void 0&&(ae={},d.set(K,ae));const fe=O(E);if(fe!==L.__cacheKey){ae[fe]===void 0&&(ae[fe]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,j=!0),ae[fe].usedTimes++;const Se=ae[L.__cacheKey];Se!==void 0&&(ae[L.__cacheKey].usedTimes--,Se.usedTimes===0&&R(E)),L.__cacheKey=fe,L.__webglTexture=ae[fe].texture}return j}function k(L,E,j){let K=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(K=35866),E.isData3DTexture&&(K=32879);const ae=Ae(L,E),fe=E.source;t.bindTexture(K,L.__webglTexture,33984+j);const Se=n.get(fe);if(fe.version!==Se.__version||ae===!0){t.activeTexture(33984+j),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const ne=S(E)&&_(E.image)===!1;let z=y(E.image,ne,!1,u);z=ze(E,z);const be=_(z)||o,de=s.convert(E.format,E.encoding);let _e=s.convert(E.type),Pe=b(E.internalFormat,de,_e,E.encoding,E.isVideoTexture);H(K,E,be);let Me;const Oe=E.mipmaps,Qe=o&&E.isVideoTexture!==!0,nt=Se.__version===void 0||ae===!0,D=w(E,z,be);if(E.isDepthTexture)Pe=6402,o?E.type===Sn?Pe=36012:E.type===Hn?Pe=33190:E.type===yi?Pe=35056:Pe=33189:E.type===Sn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===Wn&&Pe===6402&&E.type!==xl&&E.type!==Hn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=Hn,_e=s.convert(E.type)),E.format===Si&&Pe===6402&&(Pe=34041,E.type!==yi&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=yi,_e=s.convert(E.type))),nt&&(Qe?t.texStorage2D(3553,1,Pe,z.width,z.height):t.texImage2D(3553,0,Pe,z.width,z.height,0,de,_e,null));else if(E.isDataTexture)if(Oe.length>0&&be){Qe&&nt&&t.texStorage2D(3553,D,Pe,Oe[0].width,Oe[0].height);for(let $=0,ce=Oe.length;$<ce;
vendor: 11,469 bytes, line 3172
3172$++)Me=Oe[$],Qe?t.texSubImage2D(3553,$,0,0,Me.width,Me.height,de,_e,Me.data):t.texImage2D(3553,$,Pe,Me.width,Me.height,0,de,_e,Me.data);E.generateMipmaps=!1}else Qe?(nt&&t.texStorage2D(3553,D,Pe,z.width,z.height),t.texSubImage2D(3553,0,0,0,z.width,z.height,de,_e,z.data)):t.texImage2D(3553,0,Pe,z.width,z.height,0,de,_e,z.data);else if(E.isCompressedTexture)if(E.isCompressedArrayTexture){Qe&&nt&&t.texStorage3D(35866,D,Pe,Oe[0].width,Oe[0].height,z.depth);for(let $=0,ce=Oe.length;$<ce;$++)Me=Oe[$],E.format!==Ht?de!==null?Qe?t.compressedTexSubImage3D(35866,$,0,0,0,Me.width,Me.height,z.depth,de,Me.data,0,0):t.compressedTexImage3D(35866,$,Pe,Me.width,Me.height,z.depth,0,Me.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Qe?t.texSubImage3D(35866,$,0,0,0,Me.width,Me.height,z.depth,de,_e,Me.data):t.texImage3D(35866,$,Pe,Me.width,Me.height,z.depth,0,de,_e,Me.data)}else{Qe&&nt&&t.texStorage2D(3553,D,Pe,Oe[0].width,Oe[0].height);for(let $=0,ce=Oe.length;$<ce;$++)Me=Oe[$],E.format!==Ht?de!==null?Qe?t.compressedTexSubImage2D(3553,$,0,0,Me.width,Me.height,de,Me.data):t.compressedTexImage2D(3553,$,Pe,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Qe?t.texSubImage2D(3553,$,0,0,Me.width,Me.height,de,_e,Me.data):t.texImage2D(3553,$,Pe,Me.width,Me.height,0,de,_e,Me.data)}else if(E.isDataArrayTexture)Qe?(nt&&t.texStorage3D(35866,D,Pe,z.width,z.height,z.depth),t.texSubImage3D(35866,0,0,0,0,z.width,z.height,z.depth,de,_e,z.data)):t.texImage3D(35866,0,Pe,z.width,z.height,z.depth,0,de,_e,z.data);else if(E.isData3DTexture)Qe?(nt&&t.texStorage3D(32879,D,Pe,z.width,z.height,z.depth),t.texSubImage3D(32879,0,0,0,0,z.width,z.height,z.depth,de,_e,z.data)):t.texImage3D(32879,0,Pe,z.width,z.height,z.depth,0,de,_e,z.data);else if(E.isFramebufferTexture){if(nt)if(Qe)t.texStorage2D(3553,D,Pe,z.width,z.height);else{let $=z.width,ce=z.height;for(let ve=0;ve<D;ve++)t.texImage2D(3553,ve,Pe,$,ce,0,de,_e,null),$>>=1,ce>>=1}}else if(Oe.length>0&&be){Qe&&nt&&t.texStorage2D(3553,D,Pe,Oe[0].width,Oe[0].height);for(let $=0,ce=Oe.length;$<ce;$++)Me=Oe[$],Qe?t.texSubImage2D(3553,$,0,0,de,_e,Me):t.texImage2D(3553,$,Pe,de,_e,Me);E.generateMipmaps=!1}else Qe?(nt&&t.texStorage2D(3553,D,Pe,z.width,z.height),t.texSubImage2D(3553,0,0,0,de,_e,z)):t.texImage2D(3553,0,Pe,de,_e,z);M(E,be)&&C(K),Se.__version=fe.version,E.onUpdate&&E.onUpdate(E)}L.__version=E.version}function Y(L,E,j){if(E.image.length!==6)return;const K=Ae(L,E),ae=E.source;t.bindTexture(34067,L.__webglTexture,33984+j);const fe=n.get(ae);if(ae.version!==fe.__version||K===!0){t.activeTexture(33984+j),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const Se=E.isCompressedTexture||E.image[0].isCompressedTexture,ne=E.image[0]&&E.image[0].isDataTexture,z=[];for(let $=0;$<6;$++)!Se&&!ne?z[$]=y(E.image[$],!1,!0,c):z[$]=ne?E.image[$].image:E.image[$],z[$]=ze(E,z[$]);const be=z[0],de=_(be)||o,_e=s.convert(E.format,E.encoding),Pe=s.convert(E.type),Me=b(E.internalFormat,_e,Pe,E.encoding),Oe=o&&E.isVideoTexture!==!0,Qe=fe.__version===void 0||K===!0;let nt=w(E,be,de);H(34067,E,de);let D;if(Se){Oe&&Qe&&t.texStorage2D(34067,nt,Me,be.width,be.height);for(let $=0;$<6;$++){D=z[$].mipmaps;for(let ce=0;ce<D.length;ce++){const ve=D[ce];E.format!==Ht?_e!==null?Oe?t.compressedTexSubImage2D(34069+$,ce,0,0,ve.width,ve.height,_e,ve.data):t.compressedTexImage2D(34069+$,ce,Me,ve.width,ve.height,0,ve.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Oe?t.texSubImage2D(34069+$,ce,0,0,ve.width,ve.height,_e,Pe,ve.data):t.texImage2D(34069+$,ce,Me,ve.width,ve.height,0,_e,Pe,ve.data)}}}else{D=E.mipmaps,Oe&&Qe&&(D.length>0&&nt++,t.texStorage2D(34067,nt,Me,z[0].width,z[0].height));for(let $=0;$<6;$++)if(ne){Oe?t.texSubImage2D(34069+$,0,0,0,z[$].width,z[$].height,_e,Pe,z[$].data):t.texImage2D(34069+$,0,Me,z[$].width,z[$].height,0,_e,Pe,z[$].data);for(let ce=0;ce<D.length;ce++){const Ce=D[ce].image[$].image;Oe?t.texSubImage2D(34069+$,ce+1,0,0,Ce.width,Ce.height,_e,Pe,Ce.data):t.texImage2D(34069+$,ce+1,Me,Ce.width,Ce.height,0,_e,Pe,Ce.data)}}else{Oe?t.texSubImage2D(34069+$,0,0,0,_e,Pe,z[$]):t.texImage2D(34069+$,0,Me,_e,Pe,z[$]);for(let ce=0;ce<D.length;ce++){const ve=D[ce];Oe?t.texSubImage2D(34069+$,ce+1,0,0,_e,Pe,ve.image[$]):t.texImage2D(34069+$,ce+1,Me,_e,Pe,ve.image[$])}}}M(E,de)&&C(34067),fe.__version=ae.version,E.onUpdate&&E.onUpdate(E)}L.__version=E.version}function oe(L,E,j,K,ae){const fe=s.convert(j.format,j.encoding),Se=s.convert(j.type),ne=b(j.internalFormat,fe,Se,j.encoding);n.get(E).__hasExternalTextures||(ae===32879||ae===35866?t.texImage3D(ae,0,ne,E.width,E.height,E.depth,0,fe,Se,null):t.texImage2D(ae,0,ne,E.width,E.height,0,fe,Se,null)),t.bindFramebuffer(36160,L),ye(E)?p.framebufferTexture2DMultisampleEXT(36160,K,ae,n.get(j).__webglTexture,0,xe(E)):(ae===3553||ae>=34069&&ae<=34074)&&r.framebufferTexture2D(36160,K,ae,n.get(j).__webglTexture,0),t.bindFramebuffer(36160,null)}function we(L,E,j){if(r.bindRenderbuffer(36161,L),E.depthBuffer&&!E.stencilBuffer){let K=33189;if(j||ye(E)){const ae=E.depthTexture;ae&&ae.isDepthTexture&&(ae.type===Sn?K=36012:ae.type===Hn&&(K=33190));const fe=xe(E);ye(E)?p.renderbufferStorageMultisampleEXT(36161,fe,K,E.width,E.height):r.renderbufferStorageMultisample(36161,fe,K,E.width,E.height)}else r.renderbufferStorage(36161,K,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,L)}else if(E.depthBuffer&&E.stencilBuffer){const K=xe(E);j&&ye(E)===!1?r.renderbufferStorageMultisample(36161,K,35056,E.width,E.height):ye(E)?p.renderbufferStorageMultisampleEXT(36161,K,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,L)}else{const K=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let ae=0;ae<K.length;ae++){const fe=K[ae],Se=s.convert(fe.format,fe.encoding),ne=s.convert(fe.type),z=b(fe.internalFormat,Se,ne,fe.encoding),be=xe(E);j&&ye(E)===!1?r.renderbufferStorageMultisample(36161,be,z,E.width,E.height):ye(E)?p.renderbufferStorageMultisampleEXT(36161,be,z,E.width,E.height):r.renderbufferStorage(36161,z,E.width,E.height)}}r.bindRenderbuffer(36161,null)}function Z(L,E){if(E&&E.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,L),!(E.depthTexture&&E.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(E.depthTexture).__webglTexture||E.depthTexture.image.width!==E.width||E.depthTexture.image.height!==E.height)&&(E.depthTexture.image.width=E.width,E.depthTexture.image.height=E.height,E.depthTexture.needsUpdate=!0),N(E.depthTexture,0);const K=n.get(E.depthTexture).__webglTexture,ae=xe(E);if(E.depthTexture.format===Wn)ye(E)?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,K,0,ae):r.framebufferTexture2D(36160,36096,3553,K,0);else if(E.depthTexture.format===Si)ye(E)?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,K,0,ae):r.framebufferTexture2D(36160,33306,3553,K,0);else throw new Error("Unknown depthTexture format")}function W(L){const E=n.get(L),j=L.isWebGLCubeRenderTarget===!0;if(L.depthTexture&&!E.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");Z(E.__webglFramebuffer,L)}else if(j){E.__webglDepthbuffer=[];for(let K=0;K<6;K++)t.bindFramebuffer(36160,E.__webglFramebuffer[K]),E.__webglDepthbuffer[K]=r.createRenderbuffer(),we(E.__webglDepthbuffer[K],L,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=r.createRenderbuffer(),we(E.__webglDepthbuffer,L,!1);t.bindFramebuffer(36160,null)}function ie(L,E,j){const K=n.get(L);E!==void 0&&oe(K.__webglFramebuffer,L,L.texture,36064,3553),j!==void 0&&W(L)}function pe(L){const E=L.texture,j=n.get(L),K=n.get(E);L.addEventListener("dispose",F),L.isWebGLMultipleRenderTargets!==!0&&(K.__webglTexture===void 0&&(K.__webglTexture=r.createTexture()),K.__version=E.version,a.memory.textures++);const ae=L.isWebGLCubeRenderTarget===!0,fe=L.isWebGLMultipleRenderTargets===!0,Se=_(L)||o;if(ae){j.__webglFramebuffer=[];for(let ne=0;ne<6;ne++)j.__webglFramebuffer[ne]=r.createFramebuffer()}else{if(j.__webglFramebuffer=r.createFramebuffer(),fe)if(i.drawBuffers){const ne=L.texture;for(let z=0,be=ne.length;z<be;z++){const de=n.get(ne[z]);de.__webglTexture===void 0&&(de.__webglTexture=r.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&L.samples>0&&ye(L)===!1){const ne=fe?E:[E];j.__webglMultisampledFramebuffer=r.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,j.__webglMultisampledFramebuffer);for(let z=0;z<ne.length;z++){const be=ne[z];j.__webglColorRenderbuffer[z]=r.createRenderbuffer(),r.bindRenderbuffer(36161,j.__webglColorRenderbuffer[z]);const de=s.convert(be.format,be.encoding),_e=s.convert(be.type),Pe=b(be.internalFormat,de,_e,be.encoding,L.isXRRenderTarget===!0),Me=xe(L);r.renderbufferStorageMultisample(36161,Me,Pe,L.width,L.height),r.framebufferRenderbuffer(36160,36064+z,36161,j.__webglColorRenderbuffer[z])}r.bindRenderbuffer(36161,null),L.depthBuffer&&(j.__webglDepthRenderbuffer=r.createRenderbuffer(),we(j.__webglDepthRenderbuffer,L,!0)),t.bindFramebuffer(36160,null)}}if(ae){t.bindTexture(34067,K.__webglTexture),H(34067,E,Se);for(let ne=0;ne<6;ne++)oe(j.__webglFramebuffer[ne],L,E,36064,34069+ne);M(E,Se)&&C(34067),t.unbindTexture()}else if(fe){const ne=L.texture;for(let z=0,be=ne.length;z<be;z++){const de=ne[z],_e=n.get(de);t.bindTexture(3553,_e.__webglTexture),H(3553,de,Se),oe(j.__webglFramebuffer,L,de,36064+z,3553),M(de,Se)&&C(3553)}t.unbindTexture()}else{let ne=3553;(L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(o?ne=L.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(ne,K.__webglTexture),H(ne,E,Se),oe(j.__webglFramebuffer,L,E,36064,ne),M(E,Se)&&C(ne),t.unbindTexture()}L.depthBuffer&&W(L)}function ue(L){const E=_(L)||o,j=L.isWebGLMultipleRenderTargets===!0?L.texture:[L.texture];for(let K=0,ae=j.length;K<ae;K++){const fe=j[K];if(M(fe,E)){const Se=L.isWebGLCubeRenderTarget?34067:3553,ne=n.get(fe).__webglTexture;t.bindTexture(Se,ne),C(Se),t.unbindTexture()}}}function Le(L){if(o&&L.samples>0&&ye(L)===!1){const E=L.isWebGLMultipleRenderTargets?L.texture:[L.texture],j=L.width,K=L.height;let ae=16384;const fe=[],Se=L.stencilBuffer?33306:36096,ne=n.get(L),z=L.isWebGLMultipleRenderTargets===!0;if(z)for(let be=0;be<E.length;be++)t.bindFramebuffer(36160,ne.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064+be,36161,null),t.bindFramebuffer(36160,ne.__webglFramebuffer),r.framebufferTexture2D(36009,36064+be,3553,null,0);t.bindFramebuffer(36008,ne.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ne.__webglFramebuffer);for(let be=0;be<E.length;be++){fe.push(36064+be),L.depthBuffer&&fe.push(Se);const de=ne.__ignoreDepthValues!==void 0?ne.__ignoreDepthValues:!1;if(de===!1&&(L.depthBuffer&&(ae|=256),L.stencilBuffer&&(ae|=1024)),z&&r.framebufferRenderbuffer(36008,36064,36161,ne.__webglColorRenderbuffer[be]),de===!0&&(r.invali
3172dateFramebuffer(36008,[Se]),r.invalidateFramebuffer(36009,[Se])),z){const _e=n.get(E[be]).__webglTexture;r.framebufferTexture2D(36009,36064,3553,_e,0)}r.blitFramebuffer(0,0,j,K,0,0,j,K,ae,9728),g&&r.invalidateFramebuffer(36008,fe)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),z)for(let be=0;be<E.length;be++){t.bindFramebuffer(36160,ne.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064+be,36161,ne.__webglColorRenderbuffer[be]);const de=n.get(E[be]).__webglTexture;t.bindFramebuffer(36160,ne.__webglFramebuffer),r.framebufferTexture2D(36009,36064+be,3553,de,0)}t.bindFramebuffer(36009,ne.__webglMultisampledFramebuffer)}}function xe(L){return Math.min(f,L.samples)}function ye(L){const E=n.get(L);return o&&L.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function ke(L){const E=a.render.frame;x.get(L)!==E&&(x.set(L,E),L.update())}function ze(L,E){const j=L.encoding,K=L.format,ae=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||L.format===ba||j!==qn&&(j===ot?o===!1?e.has("EXT_sRGB")===!0&&K===Ht?(L.format=ba,L.minFilter=ft,L.generateMipmaps=!1):E=bl.sRGBToLinear(E):(K!==Ht||ae!==jn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",j)),E}this.allocateTextureUnit=X,this.resetTextureUnits=J,this.setTexture2D=N,this.setTexture2DArray=re,this.setTexture3D=ee,this.setTextureCube=le,this.rebindTextures=ie,this.setupRenderTarget=pe,this.updateRenderTargetMipmap=ue,this.updateMultisampleRenderTarget=Le,this.setupDepthRenderbuffer=W,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=ye}function Nu(r,e,t){const n=t.isWebGL2;function i(s,a=null){let o;if(s===jn)return 5121;if(s===au)return 32819;if(s===ou)return 32820;if(s===iu)return 5120;if(s===su)return 5122;if(s===xl)return 5123;if(s===ru)return 5124;if(s===Hn)return 5125;if(s===Sn)return 5126;if(s===cs)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===lu)return 6406;if(s===Ht)return 6408;if(s===hu)return 6409;if(s===uu)return 6410;if(s===Wn)return 6402;if(s===Si)return 34041;if(s===du)return 6403;if(s===cu)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===ba)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===fu)return 36244;if(s===pu)return 33319;if(s===mu)return 33320;if(s===gu)return 36249;if(s===oa||s===la||s===ca||s===ha)if(a===ot)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===oa)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===la)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ca)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ha)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===oa)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===la)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ca)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ha)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===No||s===ko||s===Bo||s===Fo)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===No)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ko)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Bo)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Fo)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===xu)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Uo||s===Vo)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===Uo)return a===ot?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===Vo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Ho||s===Go||s===Wo||s===Xo||s===Zo||s===jo||s===qo||s===Yo||s===$o||s===Jo||s===Ko||s===Qo||s===el||s===tl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===Ho)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Go)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Wo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Xo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Zo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===jo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===qo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Yo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===$o)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Jo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Ko)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Qo)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===el)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===tl)return a===ot?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===nl)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===nl)return a===ot?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===yi?n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class ku extends Mt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class as extends qe{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jx={type:"move"};class go{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new as,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new as,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new as,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const h of e.hand.values()){const d=t.getJointPose(h,n);if(c.joints[h.jointName]===void 0){const v=new as;
vendor: 41,588 bytes, line 3172
3172v.matrixAutoUpdate=!1,v.visible=!1,c.joints[h.jointName]=v,c.add(v)}const m=c.joints[h.jointName];d!==null&&(m.matrix.fromArray(d.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=d.radius),m.visible=d!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),g=.02,x=.005;c.inputState.pinching&&p>g+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=g-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jx)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}}class Bu extends _t{constructor(e,t,n,i,s,a,o,l,c,u){if(u=u!==void 0?u:Wn,u!==Wn&&u!==Si)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Wn&&(n=Hn),n===void 0&&u===Si&&(n=yi),super(null,i,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:xt,this.minFilter=l!==void 0?l:xt,this.flipY=!1,this.generateMipmaps=!1}}class Kx extends Cn{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=null,c=null,u=null,f=null,p=null,g=null;const x=t.getContextAttributes();let h=null,d=null;const m=[],v=[],y=new Mt;y.layers.enable(1),y.viewport=new Ke;const _=new Mt;_.layers.enable(2),_.viewport=new Ke;const S=[y,_],M=new ku;M.layers.enable(1),M.layers.enable(2);let C=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let N=m[O];return N===void 0&&(N=new go,m[O]=N),N.getTargetRaySpace()},this.getControllerGrip=function(O){let N=m[O];return N===void 0&&(N=new go,m[O]=N),N.getGripSpace()},this.getHand=function(O){let N=m[O];return N===void 0&&(N=new go,m[O]=N),N.getHandSpace()};function w(O){const N=v.indexOf(O.inputSource);if(N===-1)return;const re=m[N];re!==void 0&&re.dispatchEvent({type:O.type,data:O.inputSource})}function P(){i.removeEventListener("select",w),i.removeEventListener("selectstart",w),i.removeEventListener("selectend",w),i.removeEventListener("squeeze",w),i.removeEventListener("squeezestart",w),i.removeEventListener("squeezeend",w),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",T);for(let O=0;O<m.length;O++){const N=v[O];N!==null&&(v[O]=null,m[O].disconnect(N))}C=null,b=null,e.setRenderTarget(h),p=null,f=null,u=null,i=null,d=null,X.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(O){l=O},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(O){if(i=O,i!==null){if(h=e.getRenderTarget(),i.addEventListener("select",w),i.addEventListener("selectstart",w),i.addEventListener("selectend",w),i.addEventListener("squeeze",w),i.addEventListener("squeezestart",w),i.addEventListener("squeezeend",w),i.addEventListener("end",P),i.addEventListener("inputsourceschange",T),x.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const N={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(i,t,N),i.updateRenderState({baseLayer:p}),d=new Kt(p.framebufferWidth,p.framebufferHeight,{format:Ht,type:jn,encoding:e.outputEncoding,stencilBuffer:x.stencil})}else{let N=null,re=null,ee=null;x.depth&&(ee=x.stencil?35056:33190,N=x.stencil?Si:Wn,re=x.stencil?yi:Hn);const le={colorFormat:32856,depthFormat:ee,scaleFactor:s};u=new XRWebGLBinding(i,t),f=u.createProjectionLayer(le),i.updateRenderState({layers:[f]}),d=new Kt(f.textureWidth,f.textureHeight,{format:Ht,type:jn,depthTexture:new Bu(f.textureWidth,f.textureHeight,re,void 0,void 0,void 0,void 0,void 0,void 0,N),stencilBuffer:x.stencil,encoding:e.outputEncoding,samples:x.antialias?4:0});const me=e.properties.get(d);me.__ignoreDepthValues=f.ignoreDepthValues}d.isXRRenderTarget=!0,this.setFoveation(1),l=null,a=await i.requestReferenceSpace(o),X.setContext(i),X.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function T(O){for(let N=0;N<O.removed.length;N++){const re=O.removed[N],ee=v.indexOf(re);ee>=0&&(v[ee]=null,m[ee].dispatchEvent({type:"disconnected",data:re}))}for(let N=0;N<O.added.length;N++){const re=O.added[N];let ee=v.indexOf(re);if(ee===-1){for(let me=0;me<m.length;me++)if(me>=v.length){v.push(re),ee=me;break}else if(v[me]===null){v[me]=re,ee=me;break}if(ee===-1)break}const le=m[ee];le&&le.dispatchEvent({type:"connected",data:re})}}const F=new A,B=new A;function R(O,N,re){F.setFromMatrixPosition(N.matrixWorld),B.setFromMatrixPosition(re.matrixWorld);const ee=F.distanceTo(B),le=N.projectionMatrix.elements,me=re.projectionMatrix.elements,he=le[14]/(le[10]-1),H=le[14]/(le[10]+1),Ae=(le[9]+1)/le[5],k=(le[9]-1)/le[5],Y=(le[8]-1)/le[0],oe=(me[8]+1)/me[0],we=he*Y,Z=he*oe,W=ee/(-Y+oe),ie=W*-Y;N.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(ie),O.translateZ(W),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const pe=he+W,ue=H+W,Le=we-ie,xe=Z+(ee-ie),ye=Ae*H/ue*pe,ke=k*H/ue*pe;O.projectionMatrix.makePerspective(Le,xe,ye,ke,pe,ue)}function U(O,N){N===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(N.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(i===null)return;M.near=_.near=y.near=O.near,M.far=_.far=y.far=O.far,(C!==M.near||b!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),C=M.near,b=M.far);const N=O.parent,re=M.cameras;U(M,N);for(let le=0;le<re.length;le++)U(re[le],N);M.matrixWorld.decompose(M.position,M.quaternion,M.scale),O.matrix.copy(M.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale);const ee=O.children;for(let le=0,me=ee.length;le<me;le++)ee[le].updateMatrixWorld(!0);re.length===2?R(M,y,_):M.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return M},this.getFoveation=function(){if(f!==null)return f.fixedFoveation;if(p!==null)return p.fixedFoveation},this.setFoveation=function(O){f!==null&&(f.fixedFoveation=O),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=O)};let q=null;function J(O,N){if(c=N.getViewerPose(l||a),g=N,c!==null){const re=c.views;p!==null&&(e.setRenderTargetFramebuffer(d,p.framebuffer),e.setRenderTarget(d));let ee=!1;re.length!==M.cameras.length&&(M.cameras.length=0,ee=!0);for(let le=0;le<re.length;le++){const me=re[le];let he=null;if(p!==null)he=p.getViewport(me);else{const Ae=u.getViewSubImage(f,me);he=Ae.viewport,le===0&&(e.setRenderTargetTextures(d,Ae.colorTexture,f.ignoreDepthValues?void 0:Ae.depthStencilTexture),e.setRenderTarget(d))}let H=S[le];H===void 0&&(H=new Mt,H.layers.enable(le),H.viewport=new Ke,S[le]=H),H.matrix.fromArray(me.transform.matrix),H.projectionMatrix.fromArray(me.projectionMatrix),H.viewport.set(he.x,he.y,he.width,he.height),le===0&&M.matrix.copy(H.matrix),ee===!0&&M.cameras.push(H)}}for(let re=0;re<m.length;re++){const ee=v[re],le=m[re];ee!==null&&le!==void 0&&le.update(ee,N,l||a)}q&&q(O,N),g=null}const X=new Lu;X.setAnimationLoop(J),this.setAnimationLoop=function(O){q=O},this.dispose=function(){}}}function Qx(r,e){function t(h,d){h.fogColor.value.copy(d.color),d.isFog?(h.fogNear.value=d.near,h.fogFar.value=d.far):d.isFogExp2&&(h.fogDensity.value=d.density)}function n(h,d,m,v,y){d.isMeshBasicMaterial||d.isMeshLambertMaterial?i(h,d):d.isMeshToonMaterial?(i(h,d),u(h,d)):d.isMeshPhongMaterial?(i(h,d),c(h,d)):d.isMeshStandardMaterial?(i(h,d),f(h,d),d.isMeshPhysicalMaterial&&p(h,d,y)):d.isMeshMatcapMaterial?(i(h,d),g(h,d)):d.isMeshDepthMaterial?i(h,d):d.isMeshDistanceMaterial?(i(h,d),x(h,d)):d.isMeshNormalMaterial?i(h,d):d.isLineBasicMaterial?(s(h,d),d.isLineDashedMaterial&&a(h,d)):d.isPointsMaterial?o(h,d,m,v):d.isSpriteMaterial?l(h,d):d.isShadowMaterial?(h.color.value.copy(d.color),h.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function i(h,d){h.opacity.value=d.opacity,d.color&&h.diffuse.value.copy(d.color),d.emissive&&h.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(h.map.value=d.map),d.alphaMap&&(h.alphaMap.value=d.alphaMap),d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale,d.side===Gt&&(h.bumpScale.value*=-1)),d.displacementMap&&(h.displacementMap.value=d.displacementMap,h.displacementScale.value=d.displacementScale,h.displacementBias.value=d.displacementBias),d.emissiveMap&&(h.emissiveMap.value=d.emissiveMap),d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale),d.side===Gt&&h.normalScale.value.negate()),d.specularMap&&(h.specularMap.value=d.specularMap),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest);const m=e.get(d).envMap;if(m&&(h.envMap.value=m,h.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,h.reflectivity.value=d.reflectivity,h.ior.value=d.ior,h.refractionRatio.value=d.refractionRatio),d.lightMap){h.lightMap.value=d.lightMap;const _=r.physicallyCorrectLights!==!0?Math.PI:1;h.lightMapIntensity.value=d.lightMapIntensity*_}d.aoMap&&(h.aoMap.value=d.aoMap,h.aoMapIntensity.value=d.aoMapIntensity);let v;d.map?v=d.map:d.specularMap?v=d.specularMap:d.displacementMap?v=d.displacementMap:d.normalMap?v=d.normalMap:d.bumpMap?v=d.bumpMap:d.roughnessMap?v=d.roughnessMap:d.metalnessMap?v=d.metalnessMap:d.alphaMap?v=d.alphaMap:d.emissiveMap?v=d.emissiveMap:d.clearcoatMap?v=d.clearcoatMap:d.clearcoatNormalMap?v=d.clearcoatNormalMap:d.clearcoatRoughnessMap?v=d.clearcoatRoughnessMap:d.iridescenceMap?v=d.iridescenceMap:d.iridescenceThicknessMap?v=d.iridescenceThicknessMap:d.specularIntensityMap?v=d.specularIntensityMap:d.specularColorMap?v=d.specularColorMap:d.transmissionMap?v=d.transmissionMap:d.thicknessMap?v=d.thicknessMap:d.sheenColorMap?v=d.sheenColorMap:d.sheenRoughnessMap&&(v=d.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),h.uvTransform.value.copy(v.matrix));let y;d.aoMap?y=d.aoMap:d.lightMap&&(y=d.lightMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),h.uv2Transform.value.copy(y.matrix))}function s(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity}function a(h,d){h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale}function o(h,d,m,v){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.size.value=d.size*m,h.scale.value=v*.5,d.map&&(h.map.value=d.map),d.alphaMap&&(h.alphaMap.value=d.alphaMap),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest);let y;d.map?y=d.map:d.alphaMap&&(y=d.alphaMap),y!==void 0&&(y.matrixAutoUpdate===!0&&y.updateMatrix(),h.uvTransform.value.copy(y.matrix))}function l(h,d){h.diffuse.value.copy(d.color),h.opacity.value=d.opacity,h.rotation.value=d.rotation,d.map&&(h.map.value=d.map),d.alphaMap&&(h.alphaMap.value=d.alphaMap),d.alphaTest>0&&(h.alphaTest.value=d.alphaTest);let m;d.map?m=d.map:d.alphaMap&&(m=d.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),h.uvTransform.value.copy(m.matrix))}function c(h,d){h.specular.value.copy(d.specular),h.shininess.value=Math.max(d.shininess,1e-4)}function u(h,d){d.gradientMap&&(h.gradientMap.value=d.gradientMap)}function f(h,d){h.roughness.value=d.roughness,h.metalness.value=d.metalness,d.roughnessMap&&(h.roughnessMap.value=d.roughnessMap),d.metalnessMap&&(h.metalnessMap.value=d.metalnessMap),e.get(d).envMap&&(h.envMapIntensity.value=d.envMapIntensity)}function p(h,d,m){h.ior.value=d.ior,d.sheen>0&&(h.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),h.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(h.sheenColorMap.value=d.sheenColorMap),d.sheenRoughnessMap&&(h.sheenRoughnessMap.value=d.sheenRoughnessMap)),d.clearcoat>0&&(h.clearcoat.value=d.clearcoat,h.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(h.clearcoatMap.value=d.clearcoatMap),d.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap),d.clearcoatNormalMap&&(h.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),h.clearcoatNormalMap.value=d.clearcoatNormalMap,d.side===Gt&&h.clearcoatNormalScale.value.negate())),d.iridescence>0&&(h.iridescence.value=d.iridescence,h.iridescenceIOR.value=d.iridescenceIOR,h.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(h.iridescenceMap.value=d.iridescenceMap),d.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=d.iridescenceThicknessMap)),d.transmission>0&&(h.transmission.value=d.transmission,h.transmissionSamplerMap.value=m.texture,h.transmissionSamplerSize.value.set(m.width,m.height),d.transmissionMap&&(h.transmissionMap.value=d.transmissionMap),h.thickness.value=d.thickness,d.thicknessMap&&(h.thicknessMap.value=d.thicknessMap),h.attenuationDistance.value=d.attenuationDistance,h.attenuationColor.value.copy(d.attenuationColor)),h.specularIntensity.value=d.specularIntensity,h.specularColor.value.copy(d.specularColor),d.specularIntensityMap&&(h.specularIntensityMap.value=d.specularIntensityMap),d.specularColorMap&&(h.specularColorMap.value=d.specularColorMap)}function g(h,d){d.matcap&&(h.matcap.value=d.matcap)}function x(h,d){h.referencePosition.value.copy(d.referencePosition),h.nearDistance.value=d.nearDistance,h.farDistance.value=d.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function ey(r,e,t,n){let i={},s={},a=[];const o=t.isWebGL2?r.getParameter(35375):0;function l(v,y){const _=y.program;n.uniformBlockBinding(v,_)}function c(v,y){let _=i[v.id];_===void 0&&(x(v),_=u(v),i[v.id]=_,v.addEventListener("dispose",d));const S=y.program;n.updateUBOMapping(v,S);const M=e.render.frame;s[v.id]!==M&&(p(v),s[v.id]=M)}function u(v){const y=f();v.__bindingPointIndex=y;const _=r.createBuffer(),S=v.__size,M=v.usage;return r.bindBuffer(35345,_),r.bufferData(35345,S,M),r.bindBuffer(35345,null),r.bindBufferBase(35345,y,_),_}function f(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(v){const y=i[v.id],_=v.uniforms,S=v.__cache;r.bindBuffer(35345,y);for(let M=0,C=_.length;M<C;M++){const b=_[M];if(g(b,M,S)===!0){const w=b.value,P=b.__offset;typeof w=="number"?(b.__data[0]=w,r.bufferSubData(35345,P,b.__data)):(b.value.isMatrix3?(b.__data[0]=b.value.elements[0],b.__data[1]=b.value.elements[1],b.__data[2]=b.value.elements[2],b.__data[3]=b.value.elements[0],b.__data[4]=b.value.elements[3],b.__data[5]=b.value.elements[4],b.__data[6]=b.value.elements[5],b.__data[7]=b.value.elements[0],b.__data[8]=b.value.elements[6],b.__data[9]=b.value.elements[7],b.__data[10]=b.value.elements[8],b.__data[11]=b.value.elements[0]):w.toArray(b.__data),r.bufferSubData(35345,P,b.__data))}}r.bindBuffer(35345,null)}function g(v,y,_){const S=v.value;if(_[y]===void 0)return typeof S=="number"?_[y]=S:_[y]=S.clone(),!0;if(typeof S=="number"){if(_[y]!==S)return _[y]=S,!0}else{const M=_[y];if(M.equals(S)===!1)return M.copy(S),!0}return!1}function x(v){const y=v.uniforms;let _=0;const S=16;let M=0;for(let C=0,b=y.length;C<b;C++){const w=y[C],P=h(w);if(w.__data=new Float32Array(P.storage/Float32Array.BYTES_PER_ELEMENT),w.__offset=_,C>0){M=_%S;const T=S-M;M!==0&&T-P.boundary<0&&(_+=S-M,w.__offset=_)}_+=P.storage}return M=_%S,M>0&&(_+=S-M),v.__size=_,v.__cache={},this}function h(v){const y=v.value,_={boundary:0,storage:0};return typeof y=="number"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function d(v){const y=v.target;y.removeEventListener("dispose",d);const _=a.indexOf(y.__bindingPointIndex);a.splice(_,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function m(){for(const v in i)r.deleteBuffer(i[v]);a=[],i={},s={}}return{bind:l,update:c,dispose:m}}function ty(){const r=Xs("canvas");return r.style.display="block",r}function Fu(r={}){this.isWebGLRenderer=!0;const e=r.canvas!==void 0?r.canvas:ty(),t=r.context!==void 0?r.context:null,n=r.depth!==void 0?r.depth:!0,i=r.stencil!==void 0?r.stencil:!0,s=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,o=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,l=r.powerPreference!==void 0?r.powerPreference:"default",c=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let u;t!==null?u=t.getContextAttributes().alpha:u=r.alpha!==void 0?r.alpha:!1;let f=null,p=null;const g=[],x=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=qn,this.physicallyCorrectLights=!1,this.toneMapping=hn,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const h=this;let d=!1,m=0,v=0,y=null,_=-1,S=null;const M=new Ke,C=new Ke;let b=null,w=e.width,P=e.height,T=1,F=null,B=null;const R=new Ke(0,0,w,P),U=new Ke(0,0,w,P);let q=!1;const J=new Pa;let X=!1,O=!1,N=null;const re=new Be,ee=new se,le=new A,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function he(){return y===null?T:1}let H=t;function Ae(I,G){for(let Q=0;Q<I.length;Q++){const V=I[Q],te=e.getContext(V,G);if(te!==null)return te}return null}try{const I={alpha:!0,depth:n,stencil:i,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:o,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Sa}`),e.addEventListener("webglcontextlost",Pe,!1),e.addEventListener("webglcontextrestored",Me,!1),e.addEventListener("webglcontextcreationerror",Oe,!1),H===null){const G=["webgl2","webgl","experimental-webgl"];if(h.isWebGL1Renderer===!0&&G.shift(),H=Ae(G,I),H===null)throw Ae(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let k,Y,oe,we,Z,W,ie,pe,ue,Le,xe,ye,ke,ze,L,E,j,K,ae,fe,Se,ne,z,be;function de(){k=new x0(H),Y=new u0(H,k,r),k.init(Y),ne=new Nu(H,k,Y),oe=new Yx(H,k,Y),we=new b0,Z=new kx,W=new $x(H,k,oe,Z,Y,ne,we),ie=new f0(h),pe=new g0(h),ue=new Pp(H,Y),z=new c0(H,k,ue,Y),Le=new y0(H,ue,we,z),xe=new M0(H,Le,ue,we),ae=new S0(H,Y,W),E=new d0(Z),ye=new Nx(h,ie,pe,k,Y,z,E),ke=new Qx(h,Z),ze=new Fx,L=new Xx(k,Y),K=new l0(h,ie,pe,oe,xe,u,a),j=new qx(h,xe,Y),be=new ey(H,we,Y,oe),fe=new h0(H,k,we,Y),Se=new _0(H,k,we,Y),we.programs=ye.programs,h.capabilities=Y,h.extensions=k,h.properties=Z,h.renderLists=ze,h.shadowMap=j,h.state=oe,h.info=we}de();const _e=new Kx(h,H);this.xr=_e,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const I=k.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=k.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return T},this.setPixelRatio=function(I){I!==void 0&&(T=I,this.setSize(w,P,!1))},this.getSize=function(I){return I.set(w,P)},this.setSize=function(I,G,Q){if(_e.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}w=I,P=G,e.width=Math.floor(I*T),e.height=Math.floor(G*T),Q!==!1&&(e.style.width=I+"px",e.style.height=G+"px"),this.setViewport(0,0,I,G)},this.getDrawingBufferSize=function(I){return I.set(w*T,P*T).floor()},this.setDrawingBufferSize=function(I,G,Q){w=I,P=G,T=Q,e.width=Math.floor(I*Q),e.height=Math.floor(G*Q),this.setViewport(0,0,I,G)},this.getCurrentViewport=function(I){return I.copy(M)},this.getViewport=function(I){return I.copy(R)},this.setViewport=function(I,G,Q,V){I.isVector4?R.set(I.x,I.y,I.z,I.w):R.set(I,G,Q,V),oe.viewport(M.copy(R).multiplyScalar(T).floor())},this.getScissor=function(I){return I.copy(U)},this.setScissor=function(I,G,Q,V){I.isVector4?U.set(I.x,I.y,I.z,I.w):U.set(I,G,Q,V),oe.scissor(C.copy(U).multiplyScalar(T).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(I){oe.setScissorTest(q=I)},this.setOpaqueSort=function(I){F=I},this.setTransparentSort=function(I){B=I},this.getClearColor=function(I){return I.copy(K.getClearColor())},this.setClearColor=function(){K.setClearColor.apply(K,arguments)},this.getClearAlpha=function(){return K.getClearAlpha()},this.setClearAlpha=function(){K.setClearAlpha.apply(K,arguments)},this.clear=function(I=!0,G=!0,Q=!0){let V=0;I&&(V|=16384),G&&(V|=256),Q&&(V|=1024),H.clear(V)},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(){e.removeEventListener("webglcontextlost",Pe,!1),e.removeEventListener("webglcontextrestored",Me,!1),e.removeEventListener("webglcontextcreationerror",Oe,!1),ze.dispose(),L.dispose(),Z.dispose(),ie.dispose(),pe.dispose(),xe.dispose(),z.dispose(),be.dispose(),ye.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",ve),_e.removeEventListener("sessionend",Ce),N&&(N.dispose(),N=null),Xe.stop()};function Pe(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),d=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),d=!1;const I=we.autoReset,G=j.enabled,Q=j.autoUpdate,V=j.needsUpdate,te=j.type;de(),we.autoReset=I,j.enabled=G,j.autoUpdate=Q,j.needsUpdate=V,j.type=te}function Oe(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function Qe(I){const G=I.target;G.removeEventListener("dispose",Qe),nt(G)}function nt(I){D(I),Z.remove(I)}function D(I){const G=Z.get(I).programs;G!==void 0&&(G.forEach(function(Q){ye.releaseProgram(Q)}),I.isShaderMaterial&&ye.releaseShaderCache(I))}this.renderBufferDirect=function(I,G,Q,V,te,Re){G===null&&(G=me);const Ne=te.isMesh&&te.matrixWorld.determinant()<0,He=Rd(I,G,Q,V,te);oe.setMaterial(V,Ne);let Ue=Q.index;const $e=Q.attributes.position;if(Ue===null){if($e===void 0||$e.count===0)return}else if(Ue.count===0)return;let We=1;V.wireframe===!0&&(Ue=Le.getWireframeAttribute(Q),We=2),z.setup(te,V,He,Q,Ue);let Ze,ht=fe;Ue!==null&&(Ze=ue.get(Ue),ht=Se,ht.setIndex(Ze));const ei=Ue!==null?Ue.count:$e.count,zi=Q.drawRange.start*We,Di=Q.drawRange.count*We,ln=Re!==null?Re.start*We:0,Je=Re!==null?Re.count*We:1/0,Oi=Math.max(zi,ln),mt=Math.min(ei,zi+Di,ln+Je)-1,Zt=Math.max(0,mt-Oi+1);if(Zt!==0){if(te.isMesh)V.wireframe===!0?(oe.setLineWidth(V.wireframeLinewidth*he()),ht.setMode(1)):ht.setMode(4);else if(te.isLine){let Pn=V.linewidth;Pn===void 0&&(Pn=1),oe.setLineWidth(Pn*he()),te.isLineSegments?ht.setMode(1):te.isLineLoop?ht.setMode(2):ht.setMode(3)}else te.isPoints?ht.setMode(0):te.isSprite&&ht.setMode(4);if(te.isInstancedMesh)ht.renderInstances(Oi,Zt,te.count);else if(Q.isInstancedBufferGeometry){const Pn=Math.min(Q.instanceCount,Q._maxInstanceCount);ht.renderInstances(Oi,Zt,Pn)}else ht.render(Oi,Zt)}},this.compile=function(I,G){function Q(V,te,Re){V.transparent===!0&&V.side===wn?(V.side=Gt,V.needsUpdate=!0,Lt(V,te,Re),V.side=wi,V.needsUpdate=!0,Lt(V,te,Re),V.side=wn):Lt(V,te,Re)}p=L.get(I),p.init(),x.push(p),I.traverseVisible(function(V){V.isLight&&V.layers.test(G.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),p.setupLights(h.physicallyCorrectLights),I.traverse(function(V){const te=V.material;if(te)if(Array.isArray(te))for(let Re=0;Re<te.length;Re++){const Ne=te[Re];Q(Ne,I,V)}else Q(te,I,V)}),x.pop(),p=null};let $=null;function ce(I){$&&$(I)}function ve(){Xe.stop()}function Ce(){Xe.start()}const Xe=new Lu;Xe.setAnimationLoop(ce),typeof self<"u"&&Xe.setContext(self),this.setAnimationLoop=function(I){$=I,_e.setAnimationLoop(I),I===null?Xe.stop():Xe.start()},_e.addEventListener("sessionstart",ve),_e.addEventListener("sessionend",Ce),this.render=function(I,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(d===!0)return;I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),_e.enabled===!0&&_e.isPresenting===!0&&(_e.cameraAutoUpdate===!0&&_e.updateCamera(G),G=_e.getCamera()),I.isScene===!0&&I.onBeforeRender(h,I,G,y),p=L.get(I,x.length),p.init(),x.push(p),re.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),J.setFromProjectionMatrix(re),O=this.localClippingEnabled,X=E.init(this.clippingPlanes,O,G),f=ze.get(I,g.length),f.init(),g.push(f),it(I,G,0,h.sortObjects),f.finish(),h.sortObjects===!0&&f.sort(F,B),X===!0&&E.beginShadows();const Q=p.state.shadowsArray;if(j.render(Q,I,G),X===!0&&E.endShadows(),this.info.autoReset===!0&&this.info.reset(),K.render(f,I),p.setupLights(h.physicallyCorrectLights),G.isArrayCamera){const V=G.cameras;for(let te=0,Re=V.length;te<Re;te++){const Ne=V[te];ct(f,I,Ne,Ne.viewport)}}else ct(f,I,G);y!==null&&(W.updateMultisampleRenderTarget(y),W.updateRenderTargetMipmap(y)),I.isScene===!0&&I.onAfterRender(h,I,G),z.resetDefaultState(),_=-1,S=null,x.pop(),x.length>0?p=x[x.length-1]:p=null,g.pop(),g.length>0?f=g[g.length-1]:f=null};function it(I,G,Q,V){if(I.visible===!1)return;if(I.layers.test(G.layers)){if(I.isGroup)Q=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(G);else if(I.isLight)p.pushLight(I),I.castShadow&&p.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||J.intersectsSprite(I)){V&&le.setFromMatrixPosition(I.matrixWorld).applyMatrix4(re);const Ne=xe.update(I),He=I.material;He.visible&&f.push(I,Ne,He,Q,le.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(I.isSkinnedMesh&&I.skeleton.frame!==we.render.frame&&(I.skeleton.update(),I.skeleton.frame=we.render.frame),!I.frustumCulled||J.intersectsObject(I))){V&&le.setFromMatrixPosition(I.matrixWorld).applyMatrix4(re);const Ne=xe.update(I),He=I.material;if(Array.isArray(He)){const Ue=Ne.groups;for(let $e=0,We=Ue.length;$e<We;$e++){const Ze=Ue[$e],ht=He[Ze.materialIndex];ht&&ht.visible&&f.push(I,Ne,ht,Q,le.z,Ze)}}else He.visible&&f.push(I,Ne,He,Q,le.z,null)}}const Re=I.children;for(let Ne=0,He=Re.length;Ne<He;Ne++)it(Re[Ne],G,Q,V)}function ct(I,G,Q,V){const te=I.opaque,Re=I.transmissive,Ne=I.transparent;p.setupLightsView(Q),Re.length>0&&on(te,G,Q),V&&oe.viewport(M.copy(V)),te.length>0&&st(te,G,Q),Re.length>0&&st(Re,G,Q),Ne.length>0&&st(Ne,G,Q),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function on(I,G,Q){const V=Y.isWebGL2;N===null&&(N=new Kt(1,1,{generateMipmaps:!0,type:k.has("EXT_color_buffer_half_float")?cs:jn,minFilter:Ci,samples:V&&s===!0?4:0})),h.getDrawingBufferSize(ee),V?N.setSize(ee.x,ee.y):N.setSize(va(ee.x),va(ee.y));const te=h.getRenderTarget();h.setRenderTarget(N),h.clear();const Re=h.toneMapping;h.toneMapping=hn,st(I,G,Q),h.toneMapping=Re,W.updateMultisampleRenderTarget(N),W.updateRenderTargetMipmap(N),h.setRenderTarget(te)}function st(I,G,Q){const V=G.isScene===!0?G.overrideMaterial:null;for(let te=0,Re=I.length;te<Re;te++){const Ne=I[te],He=Ne.object,Ue=Ne.geometry,$e=V===null?Ne.material:V,We=Ne.group;He.layers.test(Q.layers)&&Bt(He,G,Q,Ue,$e,We)}}function Bt(I,G,Q,V,te,Re){I.onBeforeRender(h,G,Q,V,te,Re),I.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),te.onBeforeRender(h,G,Q,V,I,Re),te.transparent===!0&&te.side===wn?(te.side=Gt,te.needsUpdate=!0,h.renderBufferDirect(Q,G,V,te,I,Re),te.side=wi,te.needsUpdate=!0,h.renderBufferDirect(Q,G,V,te,I,Re),te.side=wn):h.renderBufferDirect(Q,G,V,te,I,Re),I.onAfterRender(h,G,Q,V,te,Re)}function Lt(I,G,Q){G.isScene!==!0&&(G=me);const V=Z.get(I),te=p.state.lights,Re=p.state.shadowsArray,Ne=te.state.version,He=ye.getParameters(I,te.state,Re,G,Q),Ue=ye.getProgramCacheKey(He);let $e=V.programs;V.environment=I.isMeshStandardMaterial?G.environment:null,V.fog=G.fog,V.envMap=(I.isMeshStandardMaterial?pe:ie).get(I.envMap||V.environment),$e===void 0&&(I.addEventListener("dispose",Qe),$e=new Map,V.programs=$e);let We=$e.get(Ue);if(We!==void 0){if(V.currentProgram===We&&V.lightsStateVersion===Ne)return jl(I,He),We}else He.uniforms=ye.getUniforms(I),I.onBuild(Q,He,h),I.onBeforeCompile(He,h),We=ye.acquireProgram(He,Ue),$e.set(Ue,We),V.uniforms=He.uniforms;const Ze=V.uniforms;(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(Ze.clippingPlanes=E.uniform),jl(I,He),V.needsLights=Dd(I),V.lightsStateVersion=Ne,V.needsLights&&(Ze.ambientLightColor.value=te.state.ambient,Ze.lightProbe.value=te.state.probe,Ze.directionalLights.value=te.state.directional,Ze.directionalLightShadows.value=te.state.directionalShadow,Ze.spotLights.value=te.state.spot,Ze.spotLightShadows.value=te.state.spotShadow,Ze.rectAreaLights.value=te.state.rectArea,Ze.ltc_1.value=te.state.rectAreaLTC1,Ze.ltc_2.value=te.state.rectAreaLTC2,Ze.pointLights.value=te.state.point,Ze.pointLightShadows.value=te.state.pointShadow,Ze.hemisphereLights.value=te.state.hemi,Ze.directionalShadowMap.value=te.state.directionalShadowMap,Ze.directionalShadowMatrix.value=te.state.directionalShadowMatrix,Ze.spotShadowMap.value=te.state.spotShadowMap,Ze.spotLightMatrix.value=te.state.spotLightMatrix,Ze.spotLightMap.value=te.state.spotLightMap,Ze.pointShadowMap.value=te.state.pointShadowMap,Ze.pointShadowMatrix.value=te.state.pointShadowMatrix);const ht=We.getUniforms(),ei=pa.seqWithValue(ht.seq,Ze);return V.currentProgram=We,V.uniformsList=ei,We}function jl(I,G){const Q=Z.get(I);Q.outputEncoding=G.outputEncoding,Q.instancing=G.instancing,Q.skinning=G.skinning,Q.morphTargets=G.morphTargets,Q.morphNormals=G.morphNormals,Q.morphColors=G.morphColors,Q.morphTargetsCount=G.morphTargetsCount,Q.numClippingPlanes=G.numClippingPlanes,Q.numIntersection=G.numClipIntersection,Q.vertexAlphas=G.vertexAlphas,Q.vertexTangents=G.vertexTangents,Q.toneMapping=G.toneMapping}function Rd(I,G,Q,V,te){G.isScene!==!0&&(G=me),W.resetTextureUnits();const Re=G.fog,Ne=V.isMeshStandardMaterial?G.environment:null,He=y===null?h.outputEncoding:y.isXRRenderTarget===!0?y.texture.encoding:qn,Ue=(V.isMeshStandardMaterial?pe:ie).get(V.envMap||Ne),$e=V.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,We=!!V.normalMap&&!!Q.attributes.tangent,Ze=!!Q.morphAttributes.position,ht=!!Q.morphAttributes.normal,ei=!!Q.morphAttributes.color,zi=V.toneMapped?h.toneMapping:hn,Di=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,ln=Di!==void 0?Di.length:0,Je=Z.get(V),Oi=p.state.lights;if(X===!0&&(O===!0||I!==S)){const Ft=I===S&&V.id===_;E.setState(V,I,Ft)}let mt=!1;V.version===Je.__version?(Je.needsLights&&Je.lightsStateVersion!==Oi.state.version||Je.outputEncoding!==He||te.isInstancedMesh&&Je.instancing===!1||!te.isInstancedMesh&&Je.instancing===!0||te.isSkinnedMesh&&Je.skinning===!1||!te.isSkinnedMesh&&Je.skinning===!0||Je.envMap!==Ue||V.fog===!0&&Je.fog!==Re||Je.numClippingPlanes!==void 0&&(Je.numClippingPlanes!==E.numPlanes||Je.numIntersection!==E.numIntersection)||Je.vertexAlphas!==$e||Je.vertexTangents!==We||Je.morphTargets!==Ze||Je.morphNormals!==ht||Je.morphColors!==ei||Je.toneMapping!==zi||Y.isWebGL2===!0&&Je.morphTargetsCount!==ln)&&(mt=!0):(mt=!0,Je.__version=V.version);let Zt=Je.currentProgram;mt===!0&&(Zt=Lt(V,G,te));let Pn=!1,bs=!1,Va=!1;const Rt=Zt.getUniforms(),ti=Je.uniforms;if(oe.useProgram(Zt.program)&&(Pn=!0,bs=!0,Va=!0),V.id!==_&&(_=V.id,bs=!0),Pn||S!==I){if(Rt.setValue(H,"projectionMatrix",I.projectionMatrix),Y.logarithmicDepthBuffer&&Rt.setValue(H,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),S!==I&&(S=I,bs=!0,Va=!0),V.isShaderMaterial||V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshStandardMaterial||V.envMap){const Ft=Rt.map.cameraPosition;Ft!==void 0&&Ft.setValue(H,le.setFromMatrixPosition(I.matrixWorld))}(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&Rt.setValue(H,"isOrthographic",I.isOrthographicCamera===!0),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial||V.isShadowMaterial||te.isSkinnedMesh)&&Rt.setValue(H,"viewMatrix",I.matrixWorldInverse)}if(te.isSkinnedMesh){Rt.setOptional(H,te,"bindMatrix"),Rt.setOptional(H,te,"bindMatrixInverse");const Ft=te.skeleton;Ft&&(Y.floatVertexTextures?(Ft.boneTexture===null&&Ft.computeBoneTexture(),Rt.setValue(H,"boneTexture",Ft.boneTexture,W),Rt.setValue(H,"boneTextureSize",Ft.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Ha=Q.morphAttributes;if((Ha.position!==void 0||Ha.normal!==void 0||Ha.color!==void 0&&Y.isWebGL2===!0)&&ae.update(te,Q,V,Zt),(bs||Je.receiveShadow!==te.receiveShadow)&&(Je.receiveShadow=te.receiveShadow,Rt.setValue(H,"receiveShadow",te.receiveShadow)),V.isMeshGouraudMaterial&&V.envMap!==null&&(ti.envMap.value=Ue,ti.flipEnvMap.value=Ue.isCubeTexture&&Ue.isRenderTargetTexture===!1?-1:1),bs&&(Rt.setValue(H,"toneMappingExposure",h.toneMappingExposure),Je.needsLights&&zd(ti,Va),Re&&V.fog===!0&&ke.refreshFogUniforms(ti,Re),ke.refreshMaterialUniforms(ti,V,T,P,N),pa.upload(H,Je.uniformsList,ti,W)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(pa.upload(H,Je.uniformsList,ti,W),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&Rt.setValue(H,"center",te.center),Rt.setValue(H,"modelViewMatrix",te.modelViewMatrix),Rt.setValue(H,"normalMatrix",te.normalMatrix),Rt.setValue(H,"modelMatrix",te.matrixWorld),V.isShaderMaterial||V.isRawShaderMaterial){const Ft=V.uniformsGroups;for(let Ga=0,Od=Ft.length;Ga<Od;Ga++)if(Y.isWebGL2){const ql=Ft[Ga];be.update(ql,Zt),be.bind(ql,Zt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Zt}function zd(I,G){I.ambientLightColor.needsUpdate=G,I.lightProbe.needsUpdate=G,I.directionalLights.needsUpdate=G,I.directionalLightShadows.needsUpdate=G,I.pointLights.needsUpdate=G,I.pointLightShadows.needsUpdate=G,I.spotLights.needsUpdate=G,I.spotLightShadows.needsUpdate=G,I.rectAreaLights.needsUpdate=G,I.hemisphereLights.needsUpdate=G}function Dd(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return m},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return y},this.setRenderTargetTextures=function(I,G,Q){Z.get(I.texture).__webglTexture=G,Z.get(I.depthTexture).__webglTexture=Q;const V=Z.get(I);V.__hasExternalTextures=!0,V.__hasExternalTextures&&(V.__autoAllocateDepthBuffer=Q===void 0,V.__autoAllocateDepthBuffer||k.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),V.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(I,G){const Q=Z.get(I);Q.__webglFramebuffer=G,Q.__useDefaultFramebuffer=G===void 0},this.setRenderTarget=function(I,G=0,Q=0){y=I,m=G,v=Q;let V=!0,te=null,Re=!1,Ne=!1;if(I){const Ue=Z.get(I);Ue.__useDefaultFramebuffer!==void 0?(oe.bindFramebuffer(36160,null),V=!1):Ue.__webglFramebuffer===void 0?W.setupRenderTarget(I):Ue.__hasExternalTextures&&W.rebindTextures(I,Z.get(I.texture).__webglTexture,Z.get(I.depthTexture).__webglTexture);const $e=I.texture;($e.isData3DTexture||$e.isDataArrayTexture||$e.isCompressedArrayTexture)&&(Ne=!0);const We=Z.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(te=We[G],Re=!0):Y.isWebGL2&&I.samples>0&&W.useMultisampledRTT(I)===!1?te=Z.get(I).__webglMultisampledFramebuffer:te=We,M.copy(I.viewport),C.copy(I.scissor),b=I.scissorTest}else M.copy(R).multiplyScalar(T).floor(),C.copy(U).multiplyScalar(T).floor(),b=q;if(oe.bindFramebuffer(36160,te)&&Y.drawBuffers&&V&&oe.drawBuffers(I,te),oe.viewport(M),oe.scissor(C),oe.setScissorTest(b),Re){const Ue=Z.get(I.texture);H.framebufferTexture2D(36160,36064,34069+G,Ue.__webglTexture,Q)}else if(Ne){const Ue=Z.get(I.texture),$e=G||0;H.framebufferTextureLayer(36160,36064,Ue.__webglTexture,Q||0,$e)}_=-1},this.readRenderTargetPixels=function(I,G,Q,V,te,Re,Ne){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Z.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Ne!==void 0&&(He=He[Ne]),He){oe.bindFramebuffer(36160,He);try{const Ue=I.texture,$e=Ue.format,We=Ue.type;if($e!==Ht&&ne.convert($e)!==H.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=We===cs&&(k.has("EXT_color_buffer_half_float")||Y.isWebGL2&&k.has("EXT_color_buffer_float"));if(We!==jn&&ne.convert(We)!==H.getParameter(35738)&&!(We===Sn&&(Y.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=I.width-V&&Q>=0&&Q<=I.height-te&&H.readPixels(G,Q,V,te,ne.convert($e),ne.convert(We),Re)}finally{const Ue=y!==null?Z.get(y).__webglFramebuffer:null;oe.bindFramebuffer(36160,Ue)}}},this.copyFramebufferToTexture=function(I,G,Q=0){const V=Math.pow(2,-Q),te=Math.floor(G.image.width*V),Re=Math.floor(G.image.height*V);W.setTexture2D(G,0),H.copyTexSubImage2D(3553,Q,0,0,I.x,I.y,te,Re),oe.unbindTexture()},this.copyTextureToTexture=function(I,G,Q,V=0){const te=G.image.width,Re=G.image.height,Ne=ne.convert(Q.format),He=ne.convert(Q.type);W.setTexture2D(Q,0),H.pixelStorei(37440,Q.flipY),H.pixelStorei(37441,Q.premultiplyAlpha),H.pixelStorei(3317,Q.unpackAlignment),G.isDataTexture?H.texSubImage2D(3553,V,I.x,I.y,te,Re,Ne,He,G.image.data):G.isCompressedTexture?H.compressedTexSubImage2D(3553,V,I.x,I.y,G.mipmaps[0].width,G.mipmaps[0].height,Ne,G.mipmaps[0].data):H.texSubImage2D(3553,V,I.x,I.y,Ne,He,G.image),V===0&&Q.generateMipmaps&&H.generateMipmap(3553),oe.unbindTexture()},this.copyTextureToTexture3D=function(I,G,Q,V,te=0){if(h.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Re=I.max.x-I.min.x+1,Ne=I.max.y-I.min.y+1,He=I.max.z-I.min.z+1,Ue=ne.convert(V.format),$e=ne.convert(V.type);let We;if(V.isData3DTexture)W.setTexture3D(V,0),We=32879;else if(V.isDataArrayTexture)W.setTexture2DArray(V,0),We=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(37440,V.flipY),H.pixelStorei(37441,V.premultiplyAlpha),H.pixelStorei(3317,V.unpackAlignment);const Ze=H.getParameter(3314),ht=H.getParameter(32878),ei=H.getParameter(3316),zi=H.getParameter(3315),Di=H.getParameter(32877),ln=Q.isCompressedTexture?Q.mipmaps[0]:Q.image;H.pixelStorei(3314,ln.width),H.pixelStorei(32878,ln.height),H.pixelStorei(3316,I.min.x),H.pixelStorei(3315,I.min.y),H.pixelStorei(32877,I.min.z),Q.isDataTexture||Q.isData3DTexture?H.texSubImage3D(We,te,G.x,G.y,G.z,Re,Ne,He,Ue,$e,ln.data):Q.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(We,te,G.x,G.y,G.z,Re,Ne,He,Ue,ln.data)):H.texSubImage3D(We,te,G.x,G.y,G.z,Re,Ne,He,Ue,$e,ln),H.pixelStorei(3314,Ze),H.pixelStorei(32878,ht),H.pixelStorei(3316,ei),H.pixelStorei(3315,zi),H.pixelStorei(32877,Di),te===0&&V.generateMipmaps&&H.generateMipmap(We),oe.unbindTexture()},this.initTexture=function(I){I.isCubeTexture?W.setTextureCube(I,0):I.isData3DTexture?W.setTexture3D(I,0
vendor: 24,961 bytes, line 3172
3172):I.isDataArrayTexture||I.isCompressedArrayTexture?W.setTexture2DArray(I,0):W.setTexture2D(I,0),oe.unbindTexture()},this.resetState=function(){m=0,v=0,y=null,oe.reset(),z.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Uu extends Fu{}Uu.prototype.isWebGL1Renderer=!0;class Ra{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Te(e),this.density=t}clone(){return new Ra(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class za{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Te(e),this.near=t,this.far=n}clone(){return new za(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Vu extends qe{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Da{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Gs,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Wt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Wt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}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=Wt()),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 zt=new A;class Mi{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)zt.fromBufferAttribute(this,t),zt.applyMatrix4(e),this.setXYZ(t,zt.x,zt.y,zt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)zt.fromBufferAttribute(this,t),zt.applyNormalMatrix(e),this.setXYZ(t,zt.x,zt.y,zt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)zt.fromBufferAttribute(this,t),zt.transformDirection(e),this.setXYZ(t,zt.x,zt.y,zt.z);return this}setX(e,t){return this.normalized&&(t=et(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=et(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=et(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=et(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Mn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Mn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Mn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Mn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=et(t,this.array),n=et(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=et(t,this.array),n=et(n,this.array),i=et(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=et(t,this.array),n=et(n,this.array),i=et(i,this.array),s=et(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new tt(new this.array.constructor(t),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 Mi(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 deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,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}}}class Al extends It{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Te(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}}let Ji;const Ts=new A,Ki=new A,Qi=new A,es=new se,As=new se,Hu=new Be,Ur=new A,Cs=new A,Vr=new A,Ic=new se,xo=new se,Lc=new se;class Gu extends qe{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",Ji===void 0){Ji=new Ve;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Da(t,5);Ji.setIndex([0,1,2,0,2,3]),Ji.setAttribute("position",new Mi(n,3,0,!1)),Ji.setAttribute("uv",new Mi(n,2,3,!1))}this.geometry=Ji,this.material=e!==void 0?e:new Al,this.center=new se(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ki.setFromMatrixScale(this.matrixWorld),Hu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ki.multiplyScalar(-Qi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Hr(Ur.set(-.5,-.5,0),Qi,a,Ki,i,s),Hr(Cs.set(.5,-.5,0),Qi,a,Ki,i,s),Hr(Vr.set(.5,.5,0),Qi,a,Ki,i,s),Ic.set(0,0),xo.set(1,0),Lc.set(1,1);let o=e.ray.intersectTriangle(Ur,Cs,Vr,!1,Ts);if(o===null&&(Hr(Cs.set(-.5,.5,0),Qi,a,Ki,i,s),xo.set(0,1),o=e.ray.intersectTriangle(Ur,Vr,Cs,!1,Ts),o===null))return;const l=e.ray.origin.distanceTo(Ts);l<e.near||l>e.far||t.push({distance:l,point:Ts.clone(),uv:Jt.getUV(Ts,Ur,Cs,Vr,Ic,xo,Lc,new se),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Hr(r,e,t,n,i,s){es.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(As.x=s*es.x-i*es.y,As.y=i*es.x+s*es.y):As.copy(es),r.copy(e),r.x+=As.x,r.y+=As.y,r.applyMatrix4(Hu)}const Gr=new A,Rc=new A;class Wu extends qe{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Gr.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Gr);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Gr.setFromMatrixPosition(e.matrixWorld),Rc.setFromMatrixPosition(this.matrixWorld);const n=Gr.distanceTo(Rc)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}const zc=new A,Dc=new Ke,Oc=new Ke,ny=new A,Nc=new Be;class Xu extends Tt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Be,this.bindMatrixInverse=new Be}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Ke,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;Dc.fromBufferAttribute(i.attributes.skinIndex,e),Oc.fromBufferAttribute(i.attributes.skinWeight,e),zc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Oc.getComponent(s);if(a!==0){const o=Dc.getComponent(s);Nc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(ny.copy(zc).applyMatrix4(Nc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Cl extends qe{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ls extends _t{constructor(e=null,t=1,n=1,i,s,a,o,l,c=xt,u=xt,f,p){super(null,a,o,l,c,u,i,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const kc=new Be,iy=new Be;class Oa{constructor(e=[],t=[]){this.uuid=Wt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Be)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Be;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:iy;kc.multiplyMatrices(o,t[s]),kc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Oa(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Tu(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ls(t,e,e,Ht,Sn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new Cl),this.bones.push(a),this.boneInverses.push(new Be().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class us extends tt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Bc=new Be,Fc=new Be,Wr=[],sy=new Be,Es=new Tt;class Zu extends Tt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new us(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1;for(let i=0;i<n;i++)this.setMatrixAt(i,sy)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Es.geometry=this.geometry,Es.material=this.material,Es.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,Bc),Fc.multiplyMatrices(n,Bc),Es.matrixWorld=Fc,Es.raycast(e,Wr);for(let a=0,o=Wr.length;a<o;a++){const l=Wr[a];l.instanceId=s,l.object=this,t.push(l)}Wr.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new us(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class Ot extends It{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Te(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Uc=new A,Vc=new A,Hc=new Be,yo=new nr,Xr=new Pi;class Yn extends qe{constructor(e=new Ve,t=new Ot){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Uc.fromBufferAttribute(t,i-1),Vc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Uc.distanceTo(Vc);e.setAttribute("lineDistance",new Ee(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Xr.copy(n.boundingSphere),Xr.applyMatrix4(i),Xr.radius+=s,e.ray.intersectsSphere(Xr)===!1)return;Hc.copy(i).invert(),yo.copy(e.ray).applyMatrix4(Hc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new A,u=new A,f=new A,p=new A,g=this.isLineSegments?2:1,x=n.index,d=n.attributes.position;if(x!==null){const m=Math.max(0,a.start),v=Math.min(x.count,a.start+a.count);for(let y=m,_=v-1;y<_;y+=g){const S=x.getX(y),M=x.getX(y+1);if(c.fromBufferAttribute(d,S),u.fromBufferAttribute(d,M),yo.distanceSqToSegment(c,u,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(p);b<e.near||b>e.far||t.push({distance:b,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,a.start),v=Math.min(d.count,a.start+a.count);for(let y=m,_=v-1;y<_;y+=g){if(c.fromBufferAttribute(d,y),u.fromBufferAttribute(d,y+1),yo.distanceSqToSegment(c,u,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(p);M<e.near||M>e.far||t.push({distance:M,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const Gc=new A,Wc=new A;class fn extends Yn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Gc.fromBufferAttribute(t,i),Wc.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Gc.distanceTo(Wc);e.setAttribute("lineDistance",new Ee(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ju extends Yn{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class El extends It{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Te(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!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.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Xc=new Be,ol=new nr,Zr=new Pi,jr=new A;class qu extends qe{constructor(e=new Ve,t=new El){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Zr.copy(n.boundingSphere),Zr.applyMatrix4(i),Zr.radius+=s,e.ray.intersectsSphere(Zr)===!1)return;Xc.copy(i).invert(),ol.copy(e.ray).applyMatrix4(Xc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,f=n.attributes.position;if(c!==null){const p=Math.max(0,a.start),g=Math.min(c.count,a.start+a.count);for(let x=p,h=g;x<h;x++){const d=c.getX(x);jr.fromBufferAttribute(f,d),Zc(jr,d,l,i,e,t,this)}}else{const p=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let x=p,h=g;x<h;x++)jr.fromBufferAttribute(f,x),Zc(jr,x,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Zc(r,e,t,n,i,s,a){const o=ol.distanceSqToPoint(r);if(o<t){const l=new A;ol.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class ry extends _t{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:ft,this.magFilter=s!==void 0?s:ft,this.generateMipmaps=!1;const u=this;function f(){u.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class ay extends _t{constructor(e,t,n){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=n,this.magFilter=xt,this.minFilter=xt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Pl extends _t{constructor(e,t,n,i,s,a,o,l,c,u,f,p){super(null,a,o,l,c,u,i,s,f,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class oy extends Pl{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Pt}}class ly extends _t{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}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 t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const u=n[i],p=n[i+1]-u,g=(a-u)/p;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new se:new A);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new A,i=[],s=[],a=[],o=new A,l=new Be;for(let g=0;g<=e;g++){const x=g/e;i[g]=this.getTangentAt(x,new A)}s[0]=new A,a[0]=new A;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),a[g]=a[g-1].clone(),o.crossVectors(i[g-1],i[g]),o.length()>Number.EPSILON){o.normalize();const x=Math.acos(pt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(l.makeRotationAxis(o,x))}a[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(pt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(g=-g);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],g*x)),a[x].crossVectors(i[x],s[x]
vendor: 10,521 bytes, line 3172
3172)}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Na extends rn{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const n=t||new se,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,g=c-this.aY;l=p*u-g*f+this.aX,c=p*f+g*u+this.aY}return n.set(l,c)}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 Yu extends Na{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Il(){let r=0,e=0,t=0,n=0;function i(s,a,o,l){r=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,f){let p=(a-s)/c-(o-s)/(c+u)+(o-a)/u,g=(o-a)/u-(l-a)/(u+f)+(l-o)/f;p*=u,g*=u,i(a,o,p,g)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const qr=new A,_o=new Il,bo=new Il,vo=new Il;class $u extends rn{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new A){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=i[(o-1)%s]:(qr.subVectors(i[0],i[1]).add(i[0]),c=qr);const f=i[o%s],p=i[(o+1)%s];if(this.closed||o+2<s?u=i[(o+2)%s]:(qr.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=qr),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let x=Math.pow(c.distanceToSquared(f),g),h=Math.pow(f.distanceToSquared(p),g),d=Math.pow(p.distanceToSquared(u),g);h<1e-4&&(h=1),x<1e-4&&(x=h),d<1e-4&&(d=h),_o.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,x,h,d),bo.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,x,h,d),vo.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,x,h,d)}else this.curveType==="catmullrom"&&(_o.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),bo.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),vo.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(_o.calc(l),bo.calc(l),vo.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new A().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function jc(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,l=r*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*r+t}function cy(r,e){const t=1-r;return t*t*e}function hy(r,e){return 2*(1-r)*r*e}function uy(r,e){return r*r*e}function Ds(r,e,t,n){return cy(r,e)+hy(r,t)+uy(r,n)}function dy(r,e){const t=1-r;return t*t*t*e}function fy(r,e){const t=1-r;return 3*t*t*r*e}function py(r,e){return 3*(1-r)*r*r*e}function my(r,e){return r*r*r*e}function Os(r,e,t,n,i){return dy(r,e)+fy(r,t)+py(r,n)+my(r,i)}class Ll extends rn{constructor(e=new se,t=new se,n=new se,i=new se){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new se){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Os(e,i.x,s.x,a.x,o.x),Os(e,i.y,s.y,a.y,o.y)),n}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 Ju extends rn{constructor(e=new A,t=new A,n=new A,i=new A){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new A){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Os(e,i.x,s.x,a.x,o.x),Os(e,i.y,s.y,a.y,o.y),Os(e,i.z,s.z,a.z,o.z)),n}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 ka extends rn{constructor(e=new se,t=new se){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new se){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new se;return n.copy(this.v2).sub(this.v1).normalize(),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 Ku extends rn{constructor(e=new A,t=new A){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new A){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}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 Rl extends rn{constructor(e=new se,t=new se,n=new se){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new se){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ds(e,i.x,s.x,a.x),Ds(e,i.y,s.y,a.y)),n}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 zl extends rn{constructor(e=new A,t=new A,n=new A){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new A){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ds(e,i.x,s.x,a.x),Ds(e,i.y,s.y,a.y),Ds(e,i.z,s.z,a.z)),n}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 Dl extends rn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new se){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],u=i[a>i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return n.set(jc(o,l.x,c.x,u.x,f.x),jc(o,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new se().fromArray(i))}return this}}var Ol=Object.freeze({__proto__:null,ArcCurve:Yu,CatmullRomCurve3:$u,CubicBezierCurve:Ll,CubicBezierCurve3:Ju,EllipseCurve:Na,LineCurve:ka,LineCurve3:Ku,QuadraticBezierCurve:Rl,QuadraticBezierCurve3:zl,SplineCurve:Dl});class Qu extends rn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ka(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isS
vendor: 6,309 bytes, line 3172
3172plineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Ol[i.type]().fromJSON(i))}return this}}class Zs extends Qu{constructor(e){super(),this.type="Path",this.currentPoint=new se,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new ka(this.currentPoint.clone(),new se(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Rl(this.currentPoint.clone(),new se(e,t),new se(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new Ll(this.currentPoint.clone(),new se(e,t),new se(n,i),new se(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Dl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,a,o,l),this}absellipse(e,t,n,i,s,a,o,l){const c=new Na(e,t,n,i,s,a,o,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class gs extends Ve{constructor(e=[new se(0,-.5),new se(.5,0),new se(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=pt(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,f=new A,p=new se,g=new A,x=new A,h=new A;let d=0,m=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:d=e[v+1].x-e[v].x,m=e[v+1].y-e[v].y,g.x=m*1,g.y=-d,g.z=m*0,h.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(h.x,h.y,h.z);break;default:d=e[v+1].x-e[v].x,m=e[v+1].y-e[v].y,g.x=m*1,g.y=-d,g.z=m*0,x.copy(g),g.x+=h.x,g.y+=h.y,g.z+=h.z,g.normalize(),l.push(g.x,g.y,g.z),h.copy(x)}for(let v=0;v<=t;v++){const y=n+v*u*i,_=Math.sin(y),S=Math.cos(y);for(let M=0;M<=e.length-1;M++){f.x=e[M].x*_,f.y=e[M].y,f.z=e[M].x*S,a.push(f.x,f.y,f.z),p.x=v/t,p.y=M/(e.length-1),o.push(p.x,p.y);const C=l[3*M+0]*_,b=l[3*M+1],w=l[3*M+0]*S;c.push(C,b,w)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const _=y+v*e.length,S=_,M=_+e.length,C=_+e.length+1,b=_+1;s.push(S,M,b),s.push(C,b,M)}this.setIndex(s),this.setAttribute("position",new Ee(a,3)),this.setAttribute("uv",new Ee(o,2)),this.setAttribute("normal",new Ee(c,3))}static fromJSON(e){return new gs(e.points,e.segments,e.phiStart,e.phiLength)}}class sr extends gs{constructor(e=1,t=1,n=4,i=8){const s=new Zs;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new sr(e.radius,e.length,e.capSegments,e.radialSegments)}}class rr extends Ve{constructor(e=1,t=8,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new A,u=new se;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){const g=n+f/t*i;c.x=e*Math.cos(g),c.y=e*Math.sin(g),a.push(c.x,c.y,c.z),o.push(0,0,1),u.x=(a[p]/e+1)/2,u.y=(a[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ee(a,3)),this.setAttribute("normal",new Ee(o,3)),this.setAttribute("uv",new Ee(l,2))}static fromJSON(e){return new rr(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ii extends Ve{constructor(e=1,t=1,n=1,i=8,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],f=[],p=[],g=[];let x=0;const h=[],d=n/2;let m=0;v(),a===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new Ee(f,3)),this.setAttribute("normal",new Ee(p,3)),this.setAttribute("uv",new Ee(g,2));function v(){const _=new A,S=new A;let M=0;const C=(t-e)/n;for(let b=0;b<=s;b++){const w=[],P=b/s,T=P*(t-e)+e;for(let F=0;F<=i;F++){const B=F/i,R=B*l+o,U=Math.sin(R),q=Math.cos(R);S.x=T*U,S.y=-P*n+d,S.z=T*q,f.push(S.x,S.y,S.z),_.set(U,C,q).normalize(),p.push(_.x,_.y,_.z),g.push(B,1-P),w.push(x++)}h.push(w)}for(let b=0;b<i;b++)for(let w=0;w<s;w++){const P=h[w][b],T=h[w+1][b],F=h[w+1][b+1],B=h[w][b+1];u.push(P,T,B),u.push(T,F,B),M+=6}c.addGroup(m,M,0),m+=M}function y(_){const S=x,M=new se,C=new A;let b=0;const w=_===!0?e:t,P=_===!0?1:-1;for(let F=1;F<=i;F++)f.push(0,d*P,0),p.push(0,P,0),g.push(.5,.5),x++;const T=x;for(let F=0;F<=i;F++){const R=F/i*l+o,U=Math.cos(R),q=Math.sin(R);C.x=w*q,C.y=d*P,C.z=w*U,f.push(C.x,C.y,C.z),p.push(0,P,0),M.x=U*.5+.5,M.y=q*.5*P+.5,g.push(M.x,M.y),x++}for(let F=0;F<i;F++){const B=S+F,R=T+F;_===!0?u.push(R,R+1,B):u.push(R+1,R,B),b+=3}c.addGroup(m,b,_===!0?1:2),m+=b}}static fromJSON(e){return new Ii(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ar extends Ii{constructor(e=1,t=1,n=8,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,i,s,a,o),this.type="C
3172oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new ar(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class En extends Ve{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];o(i),c(n),u(),this.setAttribute("position",new Ee(s,3)),this.setAttribute("normal",new Ee(s.slice(),3)),this.setAttribute("uv",new Ee(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(v){const y=new A,_=new A,S=new A;for(let M=0;M<t.length;M+=3)g(t[M+0],y),g(t[M+1],_),g(t[M+2],S),l(y,_,S,v)}function l(v,y,_,S){const M=S+1,C=[];for(let b=0;b<=M;b++){C[b]=[];const w=v.clone().lerp(_,b/M),P=y.clone().lerp(_,b/M),T=M-b;for(let F=0;F<=T;F++)F===0&&b===M?C[b][F]=w:C[b][F]=w.clone().lerp(P,F/T)}for(let b=0;b<M;b++)for(let w=0;w<2*(M-b)-1;w++){const P=Math.floor(w/2);w%2===0?(p(C[b][P+1]),p(C[b+1][P]),p(C[b][P])):(p(C[b][P+1]),p(C[b+1][P+1]),p(C[b+1][P]))}}function c(v){const y=new A;for(let _=0;_<s.length;_+=3)y.x=s[_+0],y.y=s[_+1],y.z=s[_+2],y.normalize().multiplyScalar(v),s[_+0]=y.x,s[_+1]=y.y,s[_+2]=y.z}function u(){const v=new A;for(let y=0;y<s.length;y+=3){v.x=s[y+0],v.y=s[y+1],v.z=s[y+2];const _=d(v)/2/Math.PI+.5,S=m(v)/Math.PI+.5;a.push(_,1-S)}x(),f()}function f(){for(let v=0;v<a.length;v+=6){const y=a[v+0],_=a[v+2],S=a[v+4],M=Math.max(y,_,S),C=Math.min(y,_,S);M>.9&&C<.1&&(y<.2&&(a[v+0]+=1),_<.2&&(a[v+2]+=1),S<.2&&(a[v+4]+=1))}}function p(v){s.push(v.x,v.y,v.z)}function g(v,y){const _=v*3;y.x=e[_+0],y.y=e[_+1],y.z=e[_+2]}function x(){const v=new A,y=new A,_=new A,S=new A,M=new se,C=new se,b=new se;for(let w=0,P=0;w<s.length;w+=9,P+=6){v.set(s[w+0],s[w+1],s[w+2]),y.set(s[w+3],s[w+4],s[w+5]),_.set(s[w+6],s[w+7],s[w+8]),M.set(a[P+0],a[P+1]),C.set(a[P+2],a[P+3]),b.set(a[P+4],a[P+5]),S.copy(v).add(y).add(_).divideScalar(3);const T=d(S);h(M,P+0,v,T),h(C,P+2,y,T),h(b,P+4,_,T)}}function h(v,y,_,S){S<0&&v.x===1&&(a[y]=v.x-1),_.x===0&&_.z===0&&(a[y]=S/2/Math.PI+.5)}function d(v){return Math.atan2(v.z,-v.x)}function m(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}static fromJSON(e){return new En(e.vertices,e.indices,e.radius,e.details)}}class or extends En{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 25,861 bytes, line 3172
317219,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new or(e.radius,e.detail)}}const Yr=new A,$r=new A,wo=new A,Jr=new Jt;class ed extends Ve{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(_i*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],f=new Array(3),p={},g=[];for(let x=0;x<l;x+=3){a?(c[0]=a.getX(x),c[1]=a.getX(x+1),c[2]=a.getX(x+2)):(c[0]=x,c[1]=x+1,c[2]=x+2);const{a:h,b:d,c:m}=Jr;if(h.fromBufferAttribute(o,c[0]),d.fromBufferAttribute(o,c[1]),m.fromBufferAttribute(o,c[2]),Jr.getNormal(wo),f[0]=`${Math.round(h.x*i)},${Math.round(h.y*i)},${Math.round(h.z*i)}`,f[1]=`${Math.round(d.x*i)},${Math.round(d.y*i)},${Math.round(d.z*i)}`,f[2]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let v=0;v<3;v++){const y=(v+1)%3,_=f[v],S=f[y],M=Jr[u[v]],C=Jr[u[y]],b=`${_}_${S}`,w=`${S}_${_}`;w in p&&p[w]?(wo.dot(p[w].normal)<=s&&(g.push(M.x,M.y,M.z),g.push(C.x,C.y,C.z)),p[w]=null):b in p||(p[b]={index0:c[v],index1:c[y],normal:wo.clone()})}}for(const x in p)if(p[x]){const{index0:h,index1:d}=p[x];Yr.fromBufferAttribute(o,h),$r.fromBufferAttribute(o,d),g.push(Yr.x,Yr.y,Yr.z),g.push($r.x,$r.y,$r.z)}this.setAttribute("position",new Ee(g,3))}}}class vi extends Zs{constructor(e){super(e),this.uuid=Wt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Zs().fromJSON(i))}return this}}const gy={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=td(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,u,f,p,g;if(n&&(s=vy(r,e,s,t)),r.length>80*t){o=c=r[0],l=u=r[1];for(let x=t;x<i;x+=t)f=r[x],p=r[x+1],f<o&&(o=f),p<l&&(l=p),f>c&&(c=f),p>u&&(u=p);g=Math.max(c-o,u-l),g=g!==0?32767/g:0}return js(s,a,t,o,l,g,0),a}};function td(r,e,t,n,i){let s,a;if(i===Ry(r,e,t,n)>0)for(s=e;s<t;s+=n)a=qc(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=qc(s,r[s],r[s+1],a);return a&&Ba(a,a.next)&&(Ys(a),a=a.next),a}function Ti(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Ba(t,t.next)||lt(t.prev,t,t.next)===0)){if(Ys(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function js(r,e,t,n,i,s,a){if(!r)return;!a&&s&&Ay(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?yy(r,n,i,s):xy(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Ys(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=_y(Ti(r),e,t),js(r,e,t,n,i,s,2)):a===2&&by(r,e,t,n,i,s):js(Ti(r),e,t,n,i,s,1);break}}}function xy(r){const e=r.prev,t=r,n=r.next;if(lt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,u=i<s?i<a?i:a:s<a?s:a,f=o<l?o<c?o:c:l<c?l:c,p=i>s?i>a?i:a:s>a?s:a,g=o>l?o>c?o:c:l>c?l:c;let x=n.next;for(;x!==e;){if(x.x>=u&&x.x<=p&&x.y>=f&&x.y<=g&&os(i,o,s,l,a,c,x.x,x.y)&<(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function yy(r,e,t,n){const i=r.prev,s=r,a=r.next;if(lt(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,u=i.y,f=s.y,p=a.y,g=o<l?o<c?o:c:l<c?l:c,x=u<f?u<p?u:p:f<p?f:p,h=o>l?o>c?o:c:l>c?l:c,d=u>f?u>p?u:p:f>p?f:p,m=ll(g,x,e,t,n),v=ll(h,d,e,t,n);let y=r.prevZ,_=r.nextZ;for(;y&&y.z>=m&&_&&_.z<=v;){if(y.x>=g&&y.x<=h&&y.y>=x&&y.y<=d&&y!==i&&y!==a&&os(o,u,l,f,c,p,y.x,y.y)&<(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=g&&_.x<=h&&_.y>=x&&_.y<=d&&_!==i&&_!==a&&os(o,u,l,f,c,p,_.x,_.y)&<(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=m;){if(y.x>=g&&y.x<=h&&y.y>=x&&y.y<=d&&y!==i&&y!==a&&os(o,u,l,f,c,p,y.x,y.y)&<(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=g&&_.x<=h&&_.y>=x&&_.y<=d&&_!==i&&_!==a&&os(o,u,l,f,c,p,_.x,_.y)&<(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function _y(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Ba(i,s)&&nd(i,n,n.next,s)&&qs(i,s)&&qs(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),Ys(n),Ys(n.next),n=r=s),n=n.next}while(n!==r);return Ti(n)}function by(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Py(a,o)){let l=id(a,o);a=Ti(a,a.next),l=Ti(l,l.next),js(a,e,t,n,i,s,0),js(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function vy(r,e,t,n){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*n,l=s<a-1?e[s+1]*n:r.length,c=td(r,o,l,n,!1),c===c.next&&(c.steiner=!0),i.push(Ey(c));for(i.sort(wy),s=0;s<i.length;s++)t=Sy(i[s],t);return t}function wy(r,e){return r.x-e.x}function Sy(r,e){const t=My(r,e);if(!t)return e;const n=id(t,r);return Ti(n,n.next),Ti(t,t.next)}function My(r,e){let t=e,n=-1/0,i;const s=r.x,a=r.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const p=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>n&&(n=p,i=t.x<t.next.x?t:t.next,p===s))return i}t=t.next}while(t!==e);if(!i)return null;const o=i,l=i.x,c=i.y;let u=1/0,f;t=i;do s>=t.x&&t.x>=l&&s!==t.x&&os(a<c?s:n,a,l,c,a<c?n:s,a,t.x,t.y)&&(f=Math.abs(a-t.y)/(s-t.x),qs(t,r)&&(f<u||f===u&&(t.x>i.x||t.x===i.x&&Ty(i,t)))&&(i=t,u=f)),t=t.next;while(t!==o);return i}function Ty(r,e){return lt(r.prev,r,e.prev)<0&<(e.next,r,r.next)<0}function Ay(r,e,t,n){let i=r;do i.z===0&&(i.z=ll(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Cy(i)}function Cy(r){let e,t,n,i,s,a,o,l,c=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e<c&&(o++,n=n.nextZ,!!n);e++);for(l=c;o>0||l>0&&n;)o!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(a>1);return r}function ll(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Ey(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function os(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function Py(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Iy(r,e)&&(qs(r,e)&&qs(e,r)&&Ly(r,e)&&(lt(r.prev,r,e.prev)||lt(r,e.prev,e))||Ba(r,e)&<(r.prev,r,r.next)>0&<(e.prev,e,e.next)>0)}function lt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Ba(r,e){return r.x===e.x&&r.y===e.y}function nd(r,e,t,n){const i=Qr(lt(r,e,t)),s=Qr(lt(r,e,n)),a=Qr(lt(t,n,r)),o=Qr(lt(t,n,e));return!!(i!==s&&a!==o||i===0&&Kr(r,t,e)||s===0&&Kr(r,n,e)||a===0&&Kr(t,r,n)||o===0&&Kr(t,e,n))}function Kr(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Qr(r){return r>0?1:r<0?-1:0}function Iy(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&nd(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function qs(r,e){return lt(r.prev,r,r.next)<0?lt(r,e,r.next)>=0&<(r,r.prev,e)>=0:lt(r,e,r.prev)<0||lt(r,r.next,e)<0}function Ly(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function id(r,e){const t=new cl(r.i,r.x,r.y),n=new cl(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function qc(r,e,t,n){const i=new cl(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ys(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function cl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ry(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class un{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return un.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];Yc(e),$c(n,e);let a=e.length;t.forEach(Yc);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,$c(n,t[l]);const o=gy.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Yc(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function $c(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class lr extends Ve{constructor(e=new vi([new se(.5,.5),new se(-.5,.5),new se(-.5,-.5),new se(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Ee(i,3)),this.setAttribute("uv",new Ee(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:g-.1,h=t.bevelOffset!==void 0?t.bevelOffset:0,d=t.bevelSegments!==void 0?t.bevelSegments:3;const m=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:zy;let y,_=!1,S,M,C,b;m&&(y=m.getSpacedPoints(u),_=!0,p=!1,S=m.computeFrenetFrames(u,!1),M=new A,C=new A,b=new A),p||(d=0,g=0,x=0,h=0);const w=o.extractPoints(c);let P=w.shape;const T=w.holes;if(!un.isClockWise(P)){P=P.reverse();for(let Z=0,W=T.length;Z<W;Z++){const ie=T[Z];un.isClockWise(ie)&&(T[Z]=ie.reverse())}}const B=un.triangulateShape(P,T),R=P;for(let Z=0,W=T.length;Z<W;Z++){const ie=T[Z];P=P.concat(ie)}function U(Z,W,ie){return W||console.error("THREE.ExtrudeGeometry: vec does not exist"),W.clone().multiplyScalar(ie).add(Z)}const q=P.length,J=B.length;function X(Z,W,ie){let pe,ue,Le;const xe=Z.x-W.x,ye=Z.y-W.y,ke=ie.x-Z.x,ze=ie.y-Z.y,L=xe*xe+ye*ye,E=xe*ze-ye*ke;if(Math.abs(E)>Number.EPSILON){const j=Math.sqrt(L),K=Math.sqrt(ke*ke+ze*ze),ae=W.x-ye/j,fe=W.y+xe/j,Se=ie.x-ze/K,ne=ie.y+ke/K,z=((Se-ae)*ze-(ne-fe)*ke)/(xe*ze-ye*ke);pe=ae+xe*z-Z.x,ue=fe+ye*z-Z.y;const be=pe*pe+ue*ue;if(be<=2)return new se(pe,ue);Le=Math.sqrt(be/2)}else{let j=!1;xe>Number.EPSILON?ke>Number.EPSILON&&(j=!0):xe<-Number.EPSILON?ke<-Number.EPSILON&&(j=!0):Math.sign(ye)===Math.sign(ze)&&(j=!0),j?(pe=-ye,ue=xe,Le=Math.sqrt(L)):(pe=xe,ue=ye,Le=Math.sqrt(L/2))}return new se(pe/Le,ue/Le)}const O=[];for(let Z=0,W=R.length,ie=W-1,pe=Z+1;Z<W;Z++,ie++,pe++)ie===W&&(ie=0),pe===W&&(pe=0),O[Z]=X(R[Z],R[ie],R[pe]);const N=[];let re,ee=O.concat();for(let Z=0,W=T.length;Z<W;Z++){const ie=T[Z];re=[];for(let pe=0,ue=ie.length,Le=ue-1,xe=pe+1;pe<ue;pe++,Le++,xe++)Le===ue&&(Le=0),xe===ue&&(xe=0),re[pe]=X(ie[pe],ie[Le],ie[xe]);N.push(re),ee=ee.concat(re)}for(let Z=0;Z<d;Z++){const W=Z/d,ie=g*Math.cos(W*Math.PI/2),pe=x*Math.sin(W*Math.PI/2)+h;for(let ue=0,Le=R.length;ue<Le;ue++){const xe=U(R[ue],O[ue],pe);Ae(xe.x,xe.y,-ie)}for(let ue=0,Le=T.length;ue<Le;ue++){const xe=T[ue];re=N[ue];for(let ye=0,ke=xe.length;ye<ke;ye++){const ze=U(xe[ye],re[ye],pe);Ae(ze.x,ze.y,-ie)}}}const le=x+h;for(let Z=0;Z<q;Z++){const W=p?U(P[Z],ee[Z],le):P[Z];_?(C.copy(S.normals[0]).multiplyScalar(W.x),M.copy(S.binormals[0]).multiplyScalar(W.y),b.copy(y[0]).add(C).add(M),Ae(b.x,b.y,b.z)):Ae(W.x,W.y,0)}for(let Z=1;Z<=u;Z++)for(let W=0;W<q;W++){const ie=p?U(P[W],ee[W],le):P[W];_?(C.copy(S.normals[Z]).multiplyScalar(ie.x),M.copy(S.binormals[Z]).multiplyScalar(ie.y),b.copy(y[Z]).add(C).add(M),Ae(b.x,b.y,b.z)):Ae(ie.x,ie.y,f/u*Z)}for(let Z=d-1;Z>=0;Z--){const W=Z/d,ie=g*Math.cos(W*Math.PI/2),pe=x*Math.sin(W*Math.PI/2)+h;for(let ue=0,Le=R.length;ue<Le;ue++){const xe=U(R[ue],O[ue],pe);Ae(xe.x,xe.y,f+ie)}for(let ue=0,Le=T.length;ue<Le;ue++){const xe=T[ue];re=N[ue];for(let ye=0,ke=xe.length;ye<ke;ye++){const ze=U(xe[ye],re[ye],pe);_?Ae(ze.x,ze.y+y[u-1].y,y[u-1].x+ie):Ae(ze.x,ze.y,f+ie)}}}me(),he();function me(){const Z=i.length/3;if(p){let W=0,ie=q*W;for(let pe=0;pe<J;pe++){const ue=B[pe];k(ue[2]+ie,ue[1]+ie,ue[0]+ie)}W=u+d*2,ie=q*W;for(let pe=0;pe<J;pe++){const ue=B[pe];k(ue[0]+ie,ue[1]+ie,ue[2]+ie)}}else{for(let W=0;W<J;W++){const ie=B[W];k(ie[2],ie[1],ie[0])}for(let W=0;W<J;W++){const ie=B[W];k(ie[0]+q*u,ie[1]+q*u,ie[2]+q*u)}}n.addGroup(Z,i.length/3-Z,0)}function he(){const Z=i.length/3;let W=0;H(R,W),W+=R.length;for(let ie=0,pe=T.length;ie<pe;ie++){const ue=T[ie];H(ue,W),W+=ue.length}n.addGroup(Z,i.length/3-Z,1)}function H(Z,W){let ie=Z.length;for(;--ie>=0;){const pe=ie;let ue=ie-1;ue<0&&(ue=Z.length-1);for(let Le=0,xe=u+d*2;Le<xe;Le++){const ye=q*Le,ke=q*(Le+1),ze=W+pe+ye,L=W+ue+ye,E=W+ue+ke,j=W+pe+ke;Y(ze,L,E,j)}}}function Ae(Z,W,ie){l.push(Z),l.push(W),l.push(ie)}function k(Z,W,ie){oe(Z),oe(W),oe(ie);const pe=i.length/3,ue=v.generateTopUV(n,i,pe-3,pe-2,pe-1);we(ue[0]),we(ue[1]),we(ue[2])}function Y(Z,W,ie,pe){oe(Z),oe(W),oe(pe),oe(W),oe(ie),oe(pe);const ue=i.length/3,Le=v.generateSideWallUV(n,i,ue-6,ue-3,ue-2,ue-1);we(Le[0]),we(Le[1]),we(Le[3]),we(Le[1]),we(Le[2]),we(Le[3])}function oe(Z){i.push(l[Z*3+0]),i.push(l[Z*3+1]),i.push(l[Z*3+2])}function we(Z){s.push(Z.x),s.push(Z.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Dy(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Ol[i.type]().fromJSON(i)),new lr(n,e.options)}}const zy={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new se(s,a),new se(o,l),new se(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[i*3],g=e[i*3+1],x=e[i*3+2],h=e[s*3],d=e[s*3+1],m=e[s*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new se(a,1-l),new se(c,1-f),new se(p,1-x),new se(h,1-m)]:[new se(o,1-l),new se(u,1-f),new se(g,1-x),new se(d,1-m)]}};function Dy(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class cr extends En{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new cr(e.radius,e.detail)}}class xs extends En{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xs(e.radius,e.detail)}}class hr extends Ve{constructor(e=.5,t=1,n=8,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],l=[],c=[],u=[];let f=e;const p=(t-e)/i,g=new A,x=new se;for(let h=0;h<=i;h++){for(let d=0;d<=n;d++){const m=s+d/n*a;g.x=f*Math.cos(m),g.y=f*Math.sin(m),l.push(g.x,g.y,g.z),c.push(0,0,1),x.x=(g.x/t+1)/2,x.y=(g.y/t+1)/2,u.push(x.x,x.y)}f+=p}for(let h=0;h<i;h++){const d=h*(n+1);for(let m=0;m<n;m++){const v=m+d,y=v,_=v+n+1,S=v+n+2,M=v+1;o.push(y,_,M),o.push(_,S,M)}}this.setIndex(o),this.setAttribute("position",new Ee(l,3)),this.setAttribute("normal",new Ee(c,3)),this.setAttribute("uv",new Ee(u,2))}static fromJSON(e){return new hr(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ur extends Ve{constructor(e=new vi([new se(0,.5),new se(-.5,-.5),new se(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(o,l,u),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new Ee(i,3)),this.setAttribute("normal",new Ee(s,3)),this.setAttribute("uv",new Ee(a,2));function c(u){const f=i.length/3,p=u.extractPoints(t);let g=p.shape;const x=p.holes;un.isClockWise(g)===!1&&(g=g.reverse());for(let d=0,m=x.length;d<m;d++){const v=x[d];un.isClockWise(v)===!0&&(x[d]=v.reverse())}const h=un.triangulateShape(g,x);for(let d=0,m=x.length;d<m;d++){const v=x[d];g=g.concat(v)}for(let d=0,m=g.length;d<m;d++){const v=g[d];i.push(v.x,v.y,0),s.push(0,0,1),a.push(v.x,v.y)}for(let d=0,m=h.length;d<m;d++){const v=h[d],y=v[0]+f,_=v[1]+f,S=v[2]+f;n.push(y,_,S),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Oy(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new ur(n,e.curveSegments)}}function Oy(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class ys extends Ve{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],f=new A,p=new A,g=[],x=[],h=[],d=[];for(let m=0;m<=n;m++){const v=[],y=m/n;let _=0;m==0&&a==0?_=.5/t:m==n&&l==Math.PI&&(_=-.5/t);for(let S=0;S<=t;S++){const M=S/t;f.x=-e*Math.cos(i+M*s)*Math.sin(a+y*o),f.y=e*Math.cos(a+y*o),f.z=e*Math.sin(i+M*s)*Math.sin(a+y*o),x.push(f.x,f.y,f.z),p.copy(f).normalize(),h.push(p.x,p.y,p.z),d.push(M+_,1-y),v.push(c++)}u.push(v)}for(let m=0;m<n;m++)for(let v=0;v<t;v++){const y=u[m][v+1],_=u[m][v],S=u[m+1][v],M=u[m+1][v+1];(m!==0||a>0)&&g.push(y,_,M),(m!==n-1||l<Math.PI)&&g.push(_,S,M)}this.setIndex(g),this.setAttribute("position",new Ee(x,3)),this.setAttribute("normal",new Ee(h,3)),this.setAttribute("uv",new Ee(d,2))}static fromJSON(e){return new ys(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class dr extends En{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new dr(e.radius,e.detail)}}class fr extends Ve{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],u=new A,f=new A,p=new A;for(let g=0;g<=n;g++)for(let x=0;x<=i;x++){const h=x/i*s,d=g/n*Math.PI*2;f.x=(e+t*Math.cos(d))*Math.cos(h),f.y=(e+t*Math.cos(d))*Math.sin(h),f.z=t*Math.sin(d),o.push(f.x,f.y,f.z),u.x=e*Math.cos(h),u.y=e*Math.sin(h),p.subVectors(f,u).normalize(),l.push(p.x,p.y,p.z),c.push(x/i),c.push(g/n)}for(let g=1;g<=n;g++)for(let x=1;x<=i;x++){const h=(i+1)*g+x-1,d=(i+1)*(g-1)+x-1,m=(i+1)*(g-1)+x,v=(i+1)*g+x;a.push(h,d,v),a.push(d,m,v)}this.setIndex(a),this.setAttribute("position",new Ee(o,3)),this.setAttribute("normal",new Ee(l,3)),this.setAttribute("uv",new Ee(c,2))}static fromJSON(e){return new fr(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class pr extends Ve{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],u=[],f=new A,p=new A,g=new A,x=new A,h=new A,d=new A,m=new A;for(let y=0;y<=n;++y){const _=y/n*s*Math.PI*2;v(_,s,a,e,g),v(_+.01,s,a,e,x),d.subVectors(x,g),m.addVectors(x,g),h.crossVectors(d,m),m.crossVectors(h,d),h.normalize(),m.normalize();for(let S=0;S<=i;++S){const M=S/i*Math.PI*2,C=-t*Math.cos(M),b=t*Math.sin(M);f.x=g.x+(C*m.x+b*h.x),f.y=g.y+(C*m.y+b*h.y),f.z=g.z+(C*m.z+b*h.z),l.push(f.x,f.y,f.z),p.subVectors(f,g).normalize(),c.push(p.x,p.y,p.z),u.push(y/n),u.push(S/i)}}for(let y=1;y<=n;y++)for(let _=1;_<=i;_++){const S=(i+1)*(y-1)+(_-1),M=(i+1)*y+(_-1),C=(i+1)*y+_,b=(i+1)*(y-1)+_;o.push(S,M,b),o.push(M,C,b)}this.setIndex(o),this.setAttribute("position",new Ee(l,3)),this.setAttribute("normal",new Ee(c,3)),this.setAttribute("uv",new Ee(u,2));function v(y,_,S,M,C){const b=Math.cos(y),w=Math.sin(y),P=S/_*y,T=Math.cos(P);C.x=M*(2+T)*.5*b,C.y=M*(2+T)*w*.5,C.z=M*Math.sin(P)*.5}}static fromJSON(e){return new pr(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class mr extends Ve{constructor(e=new zl(new A(-1,-1,0),new A(-1,1,0),new A(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new A,l=new A,c=new se;let u=new A;const f=[],p=[],g=[],x=[];h(),this.setIndex(x),this.setAttribute("position",new Ee(f,3)),this.setAttribute("normal",new Ee(p,3)),this.setAttribute("uv",new Ee(g,2));function h(){for(let y=0;y<t;y++)d(y);d(s===!1?t:0),v(),m()}function d(y){u=e.getPointAt(y/t,u);const _=a.normals[y],S=a.binormals[y];for(let M=0;M<=i;M++){const C=M/i*Math.PI*2,b=Math.sin(C),w=-Math.cos(C);l.x=w*_.x+b*S.x,l.y=w*_.y+b*S.y,l.z=w*_.z+b*S.z,l.normalize(),p.push(l.x,l.y,l.z),o.x=u.x+n*l.x,o.y=u.y+n*l.y,o.z=u.z+n*l.z,f.push(o.x,o.y,o.z)}}function m(){for(let y=1;y<=t;y++)for(let _=1;_<=i;_++){const S=(i+1)*(y-1)+(_-1),M=(i+1)*y+(_-1),C=(i+1)*y+_,b=(i+1)*(y-1)+_;x.push(S,M,b),x.push(M,C,b)}}function v(){for(let y=0;y<=t;y++)for(let _=0;_<=i;_++)c.x=y/t,c.y=_/i,g.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new mr(new Ol[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class sd extends Ve{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new A,s=new A;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const f=l[c],p=f.start,g=f.count;for(let x=p,h=p+g;x<h;x+=3)for(let d=0;d<3;d++){const m=o.getX(x+d),v=o.getX(x+(d+1)%3);i.fromBufferAttribute(a,m),s.fromBufferAttribute(a,v),Jc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,f=3*o+(c+1)%3;i.fromBufferAttribute(a,u),s.fromBufferAttribute(a,f),Jc(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ee(t,3))}}}function Jc(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Kc=Object.freeze({__proto__:null,BoxGeometry:Kn,CapsuleGeometry:sr,CircleGeometry:rr,ConeGeometry:ar,CylinderGeometry:Ii,DodecahedronGeometry:or,EdgesGeometry:ed,ExtrudeGeometry:lr,IcosahedronGeometry:cr,LatheGeometry:gs,OctahedronGeometry:xs,PlaneGeometry:ps,PolyhedronGeometry:En,RingGeometry:hr,ShapeGeometry:ur,SphereGeometry:ys,TetrahedronGeometry:dr,TorusGeometry:fr,TorusKnotGeometry:pr,TubeGeometry:mr,WireframeGeometry:sd});class rd extends It{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Te(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class ad extends dn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Nl extends It{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Te(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,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}}
vendor: 8,379 bytes, line 3172
3172class od extends Nl{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new se(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return pt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Te(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Te(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Te(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ld extends It{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Te(16777215),this.specular=new Te(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=er,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.specular.copy(e.specular),this.shininess=e.shininess,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.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}}class cd extends It{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Te(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class hd extends It{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ud extends It{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Te(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Te(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=er,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.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}}
vendor: 89,529 bytes, line 3172
3172class dd extends It{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Te(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fd extends Ot{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function $t(r,e,t){return kl(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)}function gi(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function kl(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function pd(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function hl(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function Bl(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function Ny(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),f=[],p=[];for(let g=0;g<c.times.length;++g){const x=c.times[g]*i;if(!(x<t||x>=n)){f.push(c.times[g]);for(let h=0;h<u;++h)p.push(c.values[g*u+h])}}f.length!==0&&(c.times=gi(f,c.times.constructor),c.values=gi(p,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function ky(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(m){return m.name===o.name&&m.ValueTypeName===l});if(c===void 0)continue;let u=0;const f=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=f/3);let p=0;const g=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);const x=o.times.length-1;let h;if(s<=o.times[0]){const m=u,v=f-u;h=$t(o.values,m,v)}else if(s>=o.times[x]){const m=x*f+u,v=m+f-u;h=$t(o.values,m,v)}else{const m=o.createInterpolant(),v=u,y=f-u;m.evaluate(s),h=$t(m.resultBuffer,v,y)}l==="quaternion"&&new De().fromArray(h).normalize().conjugate().toArray(h);const d=c.times.length;for(let m=0;m<d;++m){const v=m*g+p;if(l==="quaternion")De.multiplyQuaternionsFlat(c.values,v,h,0,c.values,v);else{const y=g-p*2;for(let _=0;_<y;++_)c.values[v+_]-=h[_]}}}return r.blendMode=yl,r}var By=Object.freeze({__proto__:null,arraySlice:$t,convertArray:gi,isTypedArray:kl,getKeyframeOrder:pd,sortedArray:hl,flattenJSON:Bl,subclip:Ny,makeClipAdditive:ky});class gr{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class md extends gr{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fi,endingEnd:fi}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case pi:s=e,o=2*t-n;break;case Hs:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case pi:a=e,l=2*n-t;break;case Hs:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,g=this._weightNext,x=(n-t)/(i-t),h=x*x,d=h*x,m=-p*d+2*p*h-p*x,v=(1+p)*d+(-1.5-2*p)*h+(-.5+p)*x+1,y=(-1-g)*d+(1.5+g)*h+.5*x,_=g*d-g*h;for(let S=0;S!==o;++S)s[S]=m*a[u+S]+v*a[c+S]+y*a[l+S]+_*a[f+S];return s}}class Fl extends gr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(i-t),f=1-u;for(let p=0;p!==o;++p)s[p]=a[c+p]*f+a[l+p]*u;return s}}class gd extends gr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class an{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=gi(t,this.TimeBufferType),this.values=gi(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:gi(e.times,Array),values:gi(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new gd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Fl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new md(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Us:t=this.InterpolantFactoryMethodDiscrete;break;case Vs:t=this.InterpolantFactoryMethodLinear;break;case ua:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Us;case this.InterpolantFactoryMethodLinear:return Vs;case this.InterpolantFactoryMethodSmooth:return ua}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=$t(n,s,a),this.values=$t(this.values,s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&kl(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=$t(this.times),t=$t(this.values),n=this.getValueSize(),i=this.getInterpolation()===ua,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(i)l=!0;else{const f=o*n,p=f-n,g=f+n;for(let x=0;x!==n;++x){const h=t[f+x];if(h!==t[p+x]||h!==t[g+x]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const f=o*n,p=a*n;for(let g=0;g!==n;++g)t[p+g]=t[f+g]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=$t(e,0,a),this.values=$t(t,0,a*n)):(this.times=e,this.values=t),this}clone(){const e=$t(this.times,0),t=$t(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}an.prototype.TimeBufferType=Float32Array;an.prototype.ValueBufferType=Float32Array;an.prototype.DefaultInterpolation=Vs;class Li extends an{}Li.prototype.ValueTypeName="bool";Li.prototype.ValueBufferType=Array;Li.prototype.DefaultInterpolation=Us;Li.prototype.InterpolantFactoryMethodLinear=void 0;Li.prototype.InterpolantFactoryMethodSmooth=void 0;class Ul extends an{}Ul.prototype.ValueTypeName="color";class $s extends an{}$s.prototype.ValueTypeName="number";class xd extends gr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let u=c+o;c!==u;c+=4)De.slerpFlat(s,0,a,c-o,a,c,l);return s}}class _s extends an{InterpolantFactoryMethodLinear(e){return new xd(this.times,this.values,this.getValueSize(),e)}}_s.prototype.ValueTypeName="quaternion";_s.prototype.DefaultInterpolation=Vs;_s.prototype.InterpolantFactoryMethodSmooth=void 0;class Ri extends an{}Ri.prototype.ValueTypeName="string";Ri.prototype.ValueBufferType=Array;Ri.prototype.DefaultInterpolation=Us;Ri.prototype.InterpolantFactoryMethodLinear=void 0;Ri.prototype.InterpolantFactoryMethodSmooth=void 0;class Js extends an{}Js.prototype.ValueTypeName="vector";class Ks{constructor(e,t=-1,n,i=Ta){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Wt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Uy(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(an.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=pd(l);l=hl(l,1,u),c=hl(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new $s(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const f=u[1];let p=i[f];p||(i[f]=p=[]),p.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(f,p,g,x,h){if(g.length!==0){const d=[],m=[];Bl(g,d,m,x),d.length!==0&&h.push(new f(p,d,m))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f<c.length;f++){const p=c[f].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const g={};let x;for(x=0;x<p.length;x++)if(p[x].morphTargets)for(let h=0;h<p[x].morphTargets.length;h++)g[p[x].morphTargets[h]]=-1;for(const h in g){const d=[],m=[];for(let v=0;v!==p[x].morphTargets.length;++v){const y=p[x];d.push(y.time),m.push(y.morphTarget===h?1:0)}i.push(new $s(".morphTargetInfluence["+h+"]",d,m))}l=g.length*a}else{const g=".bones["+t[f].name+"]";n(Js,g+".position",p,"pos",i),n(_s,g+".quaternion",p,"rot",i),n(Js,g+".scale",p,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Fy(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $s;case"vector":case"vector2":case"vector3":case"vector4":return Js;case"color":return Ul;case"quaternion":return _s;case"bool":case"boolean":return Li;case"string":return Ri}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Uy(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Fy(r.type);if(r.times===void 0){const t=[],n=[];Bl(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Ai={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 Vl{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,i.onProgress!==void 0&&i.onProgress(u,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){const f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){const g=c[f],x=c[f+1];if(g.global&&(g.lastIndex=0),g.test(u))return x}return null}}}const yd=new Vl;class Xt{constructor(e){this.manager=e!==void 0?e:yd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}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}}const bn={};class Vy extends Error{constructor(e,t){super(e),this.response=t}}class An extends Xt{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ai.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(bn[e]!==void 0){bn[e].push({onLoad:t,onProgress:n,onError:i});return}bn[e]=[],bn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=bn[e],f=c.body.getReader(),p=c.headers.get("Content-Length"),g=p?parseInt(p):0,x=g!==0;let h=0;const d=new ReadableStream({start(m){v();function v(){f.read().then(({done:y,value:_})=>{if(y)m.close();else{h+=_.byteLength;const S=new ProgressEvent("progress",{lengthComputable:x,loaded:h,total:g});for(let M=0,C=u.length;M<C;M++){const b=u[M];b.onProgress&&b.onProgress(S)}m.enqueue(_),v()}})}}});return new Response(d)}else throw new Vy(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),p=f&&f[1]?f[1].toLowerCase():void 0,g=new TextDecoder(p);return c.arrayBuffer().then(x=>g.decode(x))}}}).then(c=>{Ai.add(e,c);const u=bn[e];delete bn[e];for(let f=0,p=u.length;f<p;f++){const g=u[f];g.onLoad&&g.onLoad(c)}}).catch(c=>{const u=bn[e];if(u===void 0)throw this.manager.itemError(e),c;delete bn[e];for(let f=0,p=u.length;f<p;f++){const g=u[f];g.onError&&g.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Hy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new An(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Ks.parse(e[n]);t.push(i)}return t}}class Gy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],o=new Pl,l=new An(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(f){l.load(e[f],function(p){const g=s.parse(p,!0);a[f]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},c+=1,c===6&&(g.mipmapCount===1&&(o.minFilter=ft),o.image=a,o.format=g.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(let f=0,p=e.length;f<p;++f)u(f);else l.load(e,function(f){const p=s.parse(f,!0);if(p.isCubemap){const g=p.mipmaps.length/p.mipmapCount;for(let x=0;x<g;x++){a[x]={mipmaps:[]};for(let h=0;h<p.mipmapCount;h++)a[x].mipmaps.push(p.mipmaps[x*p.mipmapCount+h]),a[x].format=p.format,a[x].width=p.width,a[x].height=p.height}o.image=a}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=ft),o.format=p.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}class Qs extends Xt{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ai.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=Xs("img");function l(){u(),Ai.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(f){u(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class Wy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=new ir,a=new Qs(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(u){s.images[c]=u,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Xy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ls,o=new An(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){const c=s.parse(l);c&&(c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Pt,a.wrapT=c.wrapT!==void 0?c.wrapT:Pt,a.magFilter=c.magFilter!==void 0?c.magFilter:ft,a.minFilter=c.minFilter!==void 0?c.minFilter:ft,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(a.encoding=c.encoding),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ci),c.mipmapCount===1&&(a.minFilter=ft),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c))},n,i),a}}class Zy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=new _t,a=new Qs(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Qn extends qe{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Te(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class _d extends Qn{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(qe.DefaultUp),this.updateMatrix(),this.groundColor=new Te(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const So=new Be,Qc=new A,eh=new A;class Hl{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new se(512,512),this.map=null,this.mapPass=null,this.matrix=new Be,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Pa,this._frameExtents=new se(1,1),this._viewportCount=1,this._viewports=[new Ke(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Qc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Qc),eh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(eh),t.updateMatrixWorld(),So.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(So),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(So)}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.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.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}}class jy extends Hl{constructor(){super(new Mt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Ws*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class bd extends Qn{constructor(e,t,n=0,i=Math.PI/3,s=0,a=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(qe.DefaultUp),this.updateMatrix(),this.target=new qe,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new jy}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const th=new Be,Ps=new A,Mo=new A;class qy extends Hl{constructor(){super(new Mt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new se(4,2),this._viewportCount=6,this._viewports=[new Ke(2,1,1,1),new Ke(0,1,1,1),new Ke(3,1,1,1),new Ke(1,1,1,1),new Ke(3,0,1,1),new Ke(1,0,1,1)],this._cubeDirections=[new A(1,0,0),new A(-1,0,0),new A(0,0,1),new A(0,0,-1),new A(0,1,0),new A(0,-1,0)],this._cubeUps=[new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,0,1),new A(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ps.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ps),Mo.copy(n.position),Mo.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Mo),n.updateMatrixWorld(),i.makeTranslation(-Ps.x,-Ps.y,-Ps.z),th.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(th)}}class vd extends Qn{constructor(e,t,n=0,i=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new qy}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Yy extends Hl{constructor(){super(new Ia(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class wd extends Qn{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(qe.DefaultUp),this.updateMatrix(),this.target=new qe,this.shadow=new Yy}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Sd extends Qn{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Md extends Qn{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Td{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new A)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Fa extends Qn{constructor(e=new Td,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ua extends Xt{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new An(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=Ua.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Te().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new Te().setHex(a.value);break;case"v2":i.uniforms[s].value=new se().fromArray(a.value);break;case"v3":i.uniforms[s].value=new A().fromArray(a.value);break;case"v4":i.uniforms[s].value=new Ke().fromArray(a.value);break;case"m3":i.uniforms[s].value=new kt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Be().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new se().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new se().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:rd,SpriteMaterial:Al,RawShaderMaterial:ad,ShaderMaterial:dn,PointsMaterial:El,MeshPhysicalMaterial:od,MeshStandardMaterial:Nl,MeshPhongMaterial:ld,MeshToonMaterial:cd,MeshNormalMaterial:hd,MeshLambertMaterial:ud,MeshDepthMaterial:Ml,MeshDistanceMaterial:Tl,MeshBasicMaterial:Jn,MeshMatcapMaterial:dd,LineDashedMaterial:fd,LineBasicMaterial:Ot,Material:It};return new t[e]}}class ul{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Ad extends Ve{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Cd extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new An(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,x){if(t[x]!==void 0)return t[x];const d=g.interleavedBuffers[x],m=s(g,d.buffer),v=ss(d.type,m),y=new Da(v,d.stride);return y.uuid=d.uuid,t[x]=y,y}function s(g,x){if(n[x]!==void 0)return n[x];const d=g.arrayBuffers[x],m=new Uint32Array(d).buffer;return n[x]=m,m}const a=e.isInstancedBufferGeometry?new Ad:new Ve,o=e.data.index;if(o!==void 0){const g=ss(o.type,o.array);a.setIndex(new tt(g,1))}const l=e.data.attributes;for(const g in l){const x=l[g];let h;if(x.isInterleavedBufferAttribute){const d=i(e.data,x.data);h=new Mi(d,x.itemSize,x.offset,x.normalized)}else{const d=ss(x.type,x.array),m=x.isInstancedBufferAttribute?us:tt;h=new m(d,x.itemSize,x.normalized)}x.name!==void 0&&(h.name=x.name),x.usage!==void 0&&h.setUsage(x.usage),x.updateRange!==void 0&&(h.updateRange.offset=x.updateRange.offset,h.updateRange.count=x.updateRange.count),a.setAttribute(g,h)}const c=e.data.morphAttributes;if(c)for(const g in c){const x=c[g],h=[];for(let d=0,m=x.length;d<m;d++){const v=x[d];let y;if(v.isInterleavedBufferAttribute){const _=i(e.data,v.data);y=new Mi(_,v.itemSize,v.offset,v.normalized)}else{const _=ss(v.type,v.array);y=new tt(_,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),h.push(y)}a.morphAttributes[g]=h}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let g=0,x=f.length;g!==x;++g){const h=f[g];a.addGroup(h.start,h.count,h.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const g=new A;p.center!==void 0&&g.fromArray(p.center),a.boundingSphere=new Pi(g,p.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class $y extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?ul.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new An(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?ul.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new An(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let f=!1;for(const p in a)if(a[p].data instanceof HTMLImageElement){f=!0;break}f===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new vi().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Oa().fromJSON(e[s],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Cd;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in Kc?o=Kc[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),o.isBufferGeometry===!0&&l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Ua;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=Ks.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(u)}else return l.data?{data:ss(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Vl(t);s=new Qs(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const f=e[c],p=f.url;if(Array.isArray(p)){const g=[];for(let x=0,h=p.length;x<h;x++){const d=p[x],m=o(d);m!==null&&(m instanceof HTMLImageElement?g.push(m):g.push(new ls(m.data,m.width,m.height)))}i[f.uuid]=new mi(g)}else{const g=o(f.url);i[f.uuid]=new mi(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:ss(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Qs(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const u=[];for(let f=0,p=c.length;f<p;f++){const g=c[f],x=await s(g);x!==null&&(x instanceof HTMLImageElement?u.push(x):u.push(new ls(x.data,x.width,x.height)))}n[l.uuid]=new mi(u)}else{const u=await s(l.url);n[l.uuid]=new mi(u)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let u;Array.isArray(c)?(u=new ir,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new ls:u=new _t,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=o.uuid,o.name!==void 0&&(u.name=o.name),o.mapping!==void 0&&(u.mapping=n(o.mapping,Jy)),o.offset!==void 0&&u.offset.fromArray(o.offset),o.repeat!==void 0&&u.repeat.fromArray(o.repeat),o.center!==void 0&&u.center.fromArray(o.center),o.rotation!==void 0&&(u.rotation=o.rotation),o.wrap!==void 0&&(u.wrapS=n(o.wrap[0],nh),u.wrapT=n(o.wrap[1],nh)),o.format!==void 0&&(u.format=o.format),o.type!==void 0&&(u.type=o.type),o.encoding!==void 0&&(u.encoding=o.encoding),o.minFilter!==void 0&&(u.minFilter=n(o.minFilter,ih)),o.magFilter!==void 0&&(u.magFilter=n(o.magFilter,ih)),o.anisotropy!==void 0&&(u.anisotropy=o.anisotropy),o.flipY!==void 0&&(u.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(u.unpackAlignment=o.unpackAlignment),o.userData!==void 0&&(u.userData=o.userData),i[o.uuid]=u}return i}parseObject(e,t,n,i,s){let a;function o(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function l(p){if(p!==void 0){if(Array.isArray(p)){const g=[];for(let x=0,h=p.length;x<h;x++){const d=p[x];n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),g.push(n[d])}return g}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}function c(p){return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),i[p]}let u,f;switch(e.type){case"Scene":a=new Vu,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Te(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new za(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Ra(e.fog.color,e.fog.density))),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness);break;case"PerspectiveCamera":a=new Mt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Ia(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Sd(e.color,e.intensity);break;case"DirectionalLight":a=new wd(e.color,e.intensity);break;case"PointLight":a=new vd(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Md(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new bd(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new _d(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new Fa().fromJSON(e);break;case"SkinnedMesh":u=o(e.geometry),f=l(e.material),a=new Xu(u,f),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":u=o(e.geometry),f=l(e.material),a=new Tt(u,f);break;case"InstancedMesh":u=o(e.geometry),f=l(e.material);const p=e.count,g=e.instanceMatrix,x=e.instanceColor;a=new Zu(u,f,p),a.instanceMatrix=new us(new Float32Array(g.array),16),x!==void 0&&(a.instanceColor=new us(new Float32Array(x.array),x.itemSize));break;case"LOD":a=new Wu;break;case"Line":a=new Yn(o(e.geometry),l(e.material));break;case"LineLoop":a=new ju(o(e.geometry),l(e.material));break;case"LineSegments":a=new fn(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new qu(o(e.geometry),l(e.material));break;case"Sprite":a=new Gu(l(e.material));break;case"Group":a=new as;break;case"Bone":a=new Cl;break;default:a=new qe}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g<p.length;g++)a.add(this.parseObject(p[g],t,n,i,s))}if(e.animations!==void 0){const p=e.animations;for(let g=0;g<p.length;g++){const x=p[g];a.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const p=e.levels;for(let g=0;g<p.length;g++){const x=p[g],h=a.getObjectByProperty("uuid",x.object);h!==void 0&&a.addLevel(h,x.distance)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}}const Jy={UVMapping:Ma,CubeReflectionMapping:Xn,CubeRefractionMapping:Zn,EquirectangularReflectionMapping:Ns,EquirectangularRefractionMapping:ks,CubeUVReflectionMapping:ds},nh={RepeatWrapping:Bs,ClampToEdgeWrapping:Pt,MirroredRepeatWrapping:Fs},ih={NearestFilter:xt,NearestMipmapNearestFilter:ya,NearestMipmapLinearFilter:_a,LinearFilter:ft,LinearMipmapNearestFilter:gl,LinearMipmapLinearFilter:Ci};class Ky extends Xt{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ai.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Ai.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let ea;class Gl{static getContext(){return ea===void 0&&(ea=new(window.AudioContext||window.webkitAudioContext)),ea}static setContext(e){ea=e}}class Qy extends Xt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new An(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{const l=o.slice(0);Gl.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}}class e_ extends Fa{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const i=new Te().set(e),s=new Te().set(t),a=new A(i.r,i.g,i.b),o=new A(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}class t_ extends Fa{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=new Te().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const sh=new Be,rh=new Be,ri=new Be;class n_{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Mt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Mt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ri.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(_i*t.fov*.5)/t.zoom;let o,l;rh.elements[12]=-i,sh.elements[12]=i,o=-a*t.aspect+s,l=a*t.aspect+s,ri.elements[0]=2*t.near/(l-o),ri.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ri),o=-a*t.aspect-s,l=a*t.aspect-s,ri.elements[0]=2*t.near/(l-o),ri.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ri)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(rh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sh)}}class Ed{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=ah(),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 t=ah();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function ah(){return(typeof performance>"u"?Date:performance).now()}const ai=new A,oh=new De,i_=new A,oi=new A;class s_ extends qe{constructor(){super(),this.type="AudioListener",this.context=Gl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ed}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ai,oh,i_),oi.set(0,0,-1).applyQuaternion(oh),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ai.x,i),t.positionY.linearRampToValueAtTime(ai.y,i),t.positionZ.linearRampToValueAtTime(ai.z,i),t.forwardX.linearRampToValueAtTime(oi.x,i),t.forwardY.linearRampToValueAtTime(oi.y,i),t.forwardZ.linearRampToValueAtTime(oi.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(ai.x,ai.y,ai.z),t.setOrientation(oi.x,oi.y,oi.z,n.x,n.y,n.z)}}class Pd extends qe{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const li=new A,lh=new De,r_=new A,ci=new A;class a_ extends Pd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(li,lh,r_),ci.set(0,0,1).applyQuaternion(lh);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(li.x,n),t.positionY.linearRampToValueAtTime(li.y,n),t.positionZ.linearRampToValueAtTime(li.z,n),t.orientationX.linearRampToValueAtTime(ci.x,n),t.orientationY.linearRampToValueAtTime(ci.y,n),t.orientationZ.linearRampToValueAtTime(ci.z,n)}else t.setPosition(li.x,li.y,li.z),t.setOrientation(ci.x,ci.y,ci.z)}}class o_{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Id{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){De.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;De.multiplyQuaternionsFlat(e,a,e,t,e,n),De.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Wl="\\[\\]\\.:\\/",l_=new RegExp("["+Wl+"]","g"),Xl="[^"+Wl+"]",c_="[^"+Wl.replace("\\.","")+"]",h_=/((?:WC+[\/:])*)/.source.replace("WC",Xl),u_=/(WCOD+)?/.source.replace("WCOD",c_),d_=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Xl),f_=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Xl),p_=new RegExp("^"+h_+u_+d_+f_+"$"),m_=["material","materials","bones","map"];class g_{constructor(e,t,n){const i=n||je.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class je{constructor(e,t,n){this.path=t,this.parsedPath=n||je.parseTrackName(t),this.node=je.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new je.Composite(e,t,n):new je(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(l_,"")}static parseTrackName(e){const t=p_.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);m_.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=je.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}je.Composite=g_;je.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};je.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};je.prototype.GetterByBindingType=[je.prototype._getValue_direct,je.prototype._getValue_array,je.prototype._getValue_arrayElement,je.prototype._getValue_toArray];je.prototype.SetterByBindingTypeAndVersioning=[[je.prototype._setValue_direct,je.prototype._setValue_direct_setNeedsUpdate,je.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[je.prototype._setValue_array,je.prototype._setValue_array_setNeedsUpdate,je.prototype._setValue_array_setMatrixWorldNeedsUpdate],[je.prototype._setValue_arrayElement,je.prototype._setValue_arrayElement_setNeedsUpdate,je.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[je.prototype._setValue_fromArray,je.prototype._setValue_fromArray_setNeedsUpdate,je.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class x_{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Wt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let u=0,f=arguments.length;u!==f;++u){const p=arguments[u],g=p.uuid;let x=t[g];if(x===void 0){x=l++,t[g]=x,e.push(p);for(let h=0,d=a;h!==d;++h)s[h].push(new je(p,n[h],i[h]))}else if(x<c){o=e[x];const h=--c,d=e[h];t[d.uuid]=x,e[x]=d,t[g]=h,e[h]=p;for(let m=0,v=a;m!==v;++m){const y=s[m],_=y[h];let S=y[x];y[x]=_,S===void 0&&(S=new je(p,n[m],i[m])),y[h]=S}}else e[x]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const f=s++,p=e[f];t[p.uuid]=u,e[u]=p,t[c]=f,e[f]=l;for(let g=0,x=i;g!==x;++g){const h=n[g],d=h[f],m=h[u];h[u]=d,h[f]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,f=t[u];if(f!==void 0)if(delete t[u],f<s){const p=--s,g=e[p],x=--a,h=e[x];t[g.uuid]=f,e[f]=g,t[h.uuid]=p,e[p]=h,e.pop();for(let d=0,m=i;d!==m;++d){const v=n[d],y=v[p],_=v[x];v[f]=y,v[p]=_,v.pop()}}else{const p=--a,g=e[p];p>0&&(t[g.uuid]=f),e[f]=g,e.pop();for(let x=0,h=i;x!==h;++x){const d=n[x];d[f]=d[p],d.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,f=new Array(c);i=s.length,n[e]=i,a.push(e),o.push(t),s.push(f);for(let p=u,g=l.length;p!==g;++p){const x=l[p];f[p]=new je(x,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class y_{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:fi,endingEnd:fi};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=_u,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case yl:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case Ta:default:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(a),c[u].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===bu;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===yu){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=pi,i.endingEnd=pi):(e?i.endingStart=this.zeroSlopeAtStart?pi:fi:i.endingStart=Hs,t?i.endingEnd=this.zeroSlopeAtEnd?pi:fi:i.endingEnd=Hs)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const __=new Float32Array(1);class b_ extends Cn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let f=0;f!==s;++f){const p=i[f],g=p.name;let x=u[g];if(x!==void 0)++x.referenceCount,a[f]=x;else{if(x=a[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,g));continue}const h=t&&t._propertyBindings[f].binding.parsedPath;x=new Id(je.create(n,g,h),p.ValueTypeName,p.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,g),a[f]=x}o[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const f=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete f[p],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Fl(new Float32Array(2),new Float32Array(2),1,__),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?Ks.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Ta),l!==void 0){const f=l.actionByRoot[s];if(f!==void 0&&f.blendMode===n)return f;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const u=new y_(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Ks.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const u=c._cacheIndex,f=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,f._cacheIndex=u,t[u]=f,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Zl{constructor(e){this.value=e}clone(){return new Zl(this.value.clone===void 0?this.value:this.value.clone())}}let v_=0;class w_ extends Cn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:v_++}),this.name="",this.usage=Gs,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++)this.uniforms.push(t[n].clone());return this}clone(){return new this.constructor().copy(this)}}class S_ extends Da{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class M_{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class T_{constructor(e,t,n=0,i=1/0){this.ray=new nr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Ca,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster:
3172Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return dl(e,this,n,t),n.sort(ch),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)dl(e[i],this,n,t);return n.sort(ch),n}}function ch(r,e){return r.distance-e.distance}function dl(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,a=i.length;s<a;s++)dl(i[s],e,t,!0)}}class A_{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,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,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(pt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class C_{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const hh=new se;class E_{constructor(e=new se(1/0,1/0),t=new se(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=hh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return hh.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const uh=new A,ta=new A;class P_{constructor(e=new A,t=new A){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){uh.subVectors(e,this.start),ta.subVectors(this.end,this.start);const n=ta.dot(ta);let s=ta.dot(uh)/n;return t&&(s=pt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const dh=new A;class I_ extends qe{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;
vendor: 17,362 bytes, line 3172
3172const n=new Ve,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,u=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ee(i,3));const s=new Ot({fog:!1,toneMapped:!1});this.cone=new fn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),dh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(dh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Fn=new A,na=new Be,To=new Be;class L_ extends fn{constructor(e){const t=Ld(e),n=new Ve,i=[],s=[],a=new Te(0,0,1),o=new Te(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}n.setAttribute("position",new Ee(i,3)),n.setAttribute("color",new Ee(s,3));const l=new Ot({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");To.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(na.multiplyMatrices(To,o.matrixWorld),Fn.setFromMatrixPosition(na),i.setXYZ(a,Fn.x,Fn.y,Fn.z),na.multiplyMatrices(To,o.parent.matrixWorld),Fn.setFromMatrixPosition(na),i.setXYZ(a+1,Fn.x,Fn.y,Fn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ld(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,Ld(r.children[t]));return e}class R_ extends Tt{constructor(e,t,n){const i=new ys(t,4,2),s=new Jn({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const z_=new A,fh=new Te,ph=new Te;class D_ extends qe{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new xs(t);i.rotateY(Math.PI*.5),this.material=new Jn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new tt(a,3)),this.add(new Tt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");fh.copy(this.light.color),ph.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?fh:ph;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(z_.setFromMatrixPosition(this.light.matrixWorld).negate())}}class O_ extends fn{constructor(e=10,t=10,n=4473924,i=8947848){n=new Te(n),i=new Te(i);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let p=0,g=0,x=-o;p<=t;p++,x+=a){l.push(-o,0,x,o,0,x),l.push(x,0,-o,x,0,o);const h=p===s?n:i;h.toArray(c,g),g+=3,h.toArray(c,g),g+=3,h.toArray(c,g),g+=3,h.toArray(c,g),g+=3}const u=new Ve;u.setAttribute("position",new Ee(l,3)),u.setAttribute("color",new Ee(c,3));const f=new Ot({vertexColors:!0,toneMapped:!1});super(u,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class N_ extends fn{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new Te(s),a=new Te(a);const o=[],l=[];if(t>1)for(let f=0;f<t;f++){const p=f/t*(Math.PI*2),g=Math.sin(p)*e,x=Math.cos(p)*e;o.push(0,0,0),o.push(g,0,x);const h=f&1?s:a;l.push(h.r,h.g,h.b),l.push(h.r,h.g,h.b)}for(let f=0;f<n;f++){const p=f&1?s:a,g=e-e/n*f;for(let x=0;x<i;x++){let h=x/i*(Math.PI*2),d=Math.sin(h)*g,m=Math.cos(h)*g;o.push(d,0,m),l.push(p.r,p.g,p.b),h=(x+1)/i*(Math.PI*2),d=Math.sin(h)*g,m=Math.cos(h)*g,o.push(d,0,m),l.push(p.r,p.g,p.b)}}const c=new Ve;c.setAttribute("position",new Ee(o,3)),c.setAttribute("color",new Ee(l,3));const u=new Ot({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const mh=new A,ia=new A,gh=new A;class k_ extends qe{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new Ve;i.setAttribute("position",new Ee([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Ot({fog:!1,toneMapped:!1});this.lightPlane=new Yn(i,s),this.add(this.lightPlane),i=new Ve,i.setAttribute("position",new Ee([0,0,0,0,0,1],3)),this.targetLine=new Yn(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){mh.setFromMatrixPosition(this.light.matrixWorld),ia.setFromMatrixPosition(this.light.target.matrixWorld),gh.subVectors(ia,mh),this.lightPlane.lookAt(ia),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ia),this.targetLine.scale.z=gh.length()}}const sa=new A,ut=new Ea;class B_ extends fn{constructor(e){const t=new Ve,n=new Ot({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(x,h){l(x),l(h)}function l(x){i.push(0,0,0),s.push(0,0,0),a[x]===void 0&&(a[x]=[]),a[x].push(i.length/3-1)}t.setAttribute("position",new Ee(i,3)),t.setAttribute("color",new Ee(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new Te(16755200),u=new Te(16711680),f=new Te(43775),p=new Te(16777215),g=new Te(3355443);this.setColors(c,u,f,p,g)}setColors(e,t,n,i,s){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;ut.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),dt("c",t,e,ut,0,0,-1),dt("t",t,e,ut,0,0,1),dt("n1",t,e,ut,-n,-i,-1),dt("n2",t,e,ut,n,-i,-1),dt("n3",t,e,ut,-n,i,-1),dt("n4",t,e,ut,n,i,-1),dt("f1",t,e,ut,-n,-i,1),dt("f2",t,e,ut,n,-i,1),dt("f3",t,e,ut,-n,i,1),dt("f4",t,e,ut,n,i,1),dt("u1",t,e,ut,n*.7,i*1.1,-1),dt("u2",t,e,ut,-n*.7,i*1.1,-1),dt("u3",t,e,ut,0,i*2,-1),dt("cf1",t,e,ut,-n,0,1),dt("cf2",t,e,ut,n,0,1),dt("cf3",t,e,ut,0,-i,1),dt("cf4",t,e,ut,0,i,1),dt("cn1",t,e,ut,-n,0,-1),dt("cn2",t,e,ut,n,0,-1),dt("cn3",t,e,ut,0,-i,-1),dt("cn4",t,e,ut,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function dt(r,e,t,n,i,s,a){sa.set(i,s,a).unproject(n);const o=e[r];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],sa.x,sa.y,sa.z)}}const ra=new Ei;class F_ extends fn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Ve;s.setIndex(new tt(n,1)),s.setAttribute("position",new tt(i,3)),super(s,new Ot({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&ra.setFromObject(this.object),ra.isEmpty())return;const t=ra.min,n=ra.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class U_ extends fn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ve;s.setIndex(new tt(n,1)),s.setAttribute("position",new Ee(i,3)),super(s,new Ot({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class V_ extends Yn{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Ve;a.setAttribute("position",new Ee(s,3)),a.computeBoundingSphere(),super(a,new Ot({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ve;l.setAttribute("position",new Ee(o,3)),l.computeBoundingSphere(),this.add(new Tt(l,new Jn({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const xh=new A;let aa,Ao;class H_ extends qe{constructor(e=new A(0,0,1),t=new A(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",aa===void 0&&(aa=new Ve,aa.setAttribute("position",new Ee([0,0,0,0,1,0],3)),Ao=new Ii(0,.5,1,5,1),Ao.translate(0,-.5,0)),this.position.copy(t),this.line=new Yn(aa,new Ot({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Tt(Ao,new Jn({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{xh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(xh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class G_ extends fn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ve;i.setAttribute("position",new Ee(t,3)),i.setAttribute("color",new Ee(n,3));const s=new Ot({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Te,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class W_{constructor(){this.type="ShapePath",this.color=new Te,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Zs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const v=[];for(let y=0,_=m.length;y<_;y++){const S=m[y],M=new vi;M.curves=S.curves,v.push(M)}return v}function n(m,v){const y=v.length;let _=!1;for(let S=y-1,M=0;M<y;S=M++){let C=v[S],b=v[M],w=b.x-C.x,P=b.y-C.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(C=v[M],w=-w,b=v[S],P=-P),m.y<C.y||m.y>b.y)continue;if(m.y===C.y){if(m.x===C.x)return!0}else{const T=P*(m.x-C.x)-w*(m.y-C.y);if(T===0)return!0;if(T<0)continue;_=!_}}else{if(m.y!==C.y)continue;if(b.x<=m.x&&m.x<=C.x||C.x<=m.x&&m.x<=b.x)return!0}}return _}const i=un.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new vi,l.curves=o.curves,c.push(l),c;let u=!i(s[0].getPoints());u=e?!u:u;const f=[],p=[];let g=[],x=0,h;p[x]=void 0,g[x]=[];for(let m=0,v=s.length;m<v;m++)o=s[m],h=o.getPoints(),a=i(h),a=e?!a:a,a?(!u&&p[x]&&x++,p[x]={s:new vi,p:h},p[x].s.curves=o.curves,u&&x++,g[x]=[]):g[x].push({h:o,p:h[0]});if(!p[0])return t(s);if(p.length>1){let m=!1,v=0;for(let y=0,_=p.length;y<_;y++)f[y]=[];for(let y=0,_=p.length;y<_;y++){const S=g[y];for(let M=0;M<S.length;M++){const C=S[M];let b=!0;for(let w=0;w<p.length;w++)n(C.p,p[w].p)&&(y!==w&&v++,b?(b=!1,f[w].push(C)):m=!0);b&&f[y].push(C)}}v>0&&m===!1&&(g=f)}let d;for(let m=0,v=p.length;m<v;m++){l=p[m].s,c.push(l),d=g[m];for(let y=0,_=d.length;y<_;y++)l.holes.push(d[y].h)}return c}}const vn=X_();function X_(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Z_(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=pt(r,-65504,65504),vn.floatView[0]=r;const e=vn.uint32View[0],t=e>>23&511;return vn.baseTable[t]+((e&8388607)>>vn.shiftTable[t])}function j_(r){const e=r>>10;return vn.uint32View[0]=vn.mantissaTable[vn.offsetTable[e]+(r&1023)]+vn.exponentTable[e],vn.floatView[0]}var q_=Object.freeze({__proto__:null,toHalfFloat:Z_,fromHalfFloat:j_});function Y_(){console.error("THREE.ImmediateRenderObject has been removed.")}class $_ extends Kt{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class J_ extends tr{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class K_ extends Aa{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}class Q_ extends Kn{constructor(e,t,n,i,s,a){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,n,i,s,a)}}class eb extends sr{constructor(e,t,n,i){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.C
3172apsuleGeometry."),super(e,t,n,i)}}class tb extends rr{constructor(e,t,n,i){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,n,i)}}class nb extends ar{constructor(e,t,n,i,s,a,o){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,n,i,s,a,o)}}class ib extends Ii{constructor(e,t,n,i,s,a,o,l){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,n,i,s,a,o,l)}}class sb extends or{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class rb extends lr{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class ab extends cr{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class ob extends gs{constructor(e,t,n,i){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,n,i)}}class lb extends xs{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class cb extends ps{constructor(e,t,n,i){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,n,i)}}class hb extends En{constructor(e,t,n,i){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,n,i)}}class ub extends hr{constructor(e,t,n,i,s,a){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,n,i,s,a)}}class db extends ur{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class fb extends ys{constructor(e,t,n,i,s,a,o){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,n,i,s,a,o)}}class pb extends dr{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class mb extends fr{constructor(e,t,n,i,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,n,i,s)}}class gb extends pr{constructor(e,t,n,i,s,a){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,n,i,s,a)}}class xb extends mr{constructor(e,t,n,i,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,n,i,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sa}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sa);const Cb=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:tu,AddEquation:ui,AddOperation:Jh,AdditiveAnimationBlendMode:yl,AdditiveBlending:Lo,AlphaFormat:lu,AlwaysDepth:Wh,AlwaysStencilFunc:Mu,AmbientLight:Sd,AmbientLightProbe:t_,AnimationClip:Ks,AnimationLoader:Hy,AnimationMixer:b_,AnimationObjectGroup:x_,AnimationUtils:By,ArcCurve:Yu,ArrayCamera:ku,ArrowHelper:H_,Audio:Pd,AudioAnalyser:o_,AudioContext:Gl,AudioListener:s_,AudioLoader:Qy,AxesHelper:G_,BackSide:Gt,BasicDepthPacking:vu,BasicShadowMap:hf,Bone:Cl,BooleanKeyframeTrack:Li,Box2:E_,Box3:Ei,Box3Helper:U_,BoxBufferGeometry:Q_,BoxGeometry:Kn,BoxHelper:F_,BufferAttribute:tt,BufferGeometry:Ve,BufferGeometryLoader:Cd,ByteType:iu,Cache:Ai,Camera:Ea,CameraHelper:B_,CanvasTexture:ly,CapsuleBufferGeometry:eb,CapsuleGeometry:sr,CatmullRomCurve3:$u,CineonToneMapping:eu,CircleBufferGeometry:tb,CircleGeometry:rr,ClampToEdgeWrapping:Pt,Clock:Ed,Color:Te,ColorKeyframeTrack:Ul,ColorManagement:Yt,CompressedArrayTexture:oy,CompressedTexture:Pl,CompressedTextureLoader:Gy,ConeBufferGeometry:nb,ConeGeometry:ar,CubeCamera:Pu,CubeReflectionMapping:Xn,CubeRefractionMapping:Zn,CubeTexture:ir,CubeTextureLoader:Wy,CubeUVReflectionMapping:ds,CubicBezierCurve:Ll,CubicBezierCurve3:Ju,CubicInterpolant:md,CullFaceBack:Io,CullFaceFront:Ph,CullFaceFrontBack:cf,CullFaceNone:Eh,Curve:rn,CurvePath:Qu,CustomBlending:Lh,CustomToneMapping:nu,CylinderBufferGeometry:ib,CylinderGeometry:Ii,Cylindrical:C_,Data3DTexture:Aa,DataArrayTexture:tr,DataTexture:ls,DataTexture2DArray:J_,DataTexture3D:K_,DataTextureLoader:Xy,DataUtils:q_,DecrementStencilOp:wf,DecrementWrapStencilOp:Mf,DefaultLoadingManager:yd,DepthFormat:Wn,DepthStencilFormat:Si,DepthTexture:Bu,DirectionalLight:wd,DirectionalLightHelper:k_,DiscreteInterpolant:gd,DodecahedronBufferGeometry:sb,DodecahedronGeometry:or,DoubleSide:wn,DstAlphaFactor:Bh,DstColorFactor:Uh,DynamicCopyUsage:Ff,DynamicDrawUsage:zf,DynamicReadUsage:Nf,EdgesGeometry:ed,EllipseCurve:Na,EqualDepth:Zh,EqualStencilFunc:Ef,EquirectangularReflectionMapping:Ns,EquirectangularRefractionMapping:ks,Euler:fs,EventDispatcher:Cn,ExtrudeBufferGeometry:rb,ExtrudeGeometry:lr,FileLoader:An,Float16BufferAttribute:bp,Float32BufferAttribute:Ee,Float64BufferAttribute:vp,FloatType:Sn,Fog:za,FogExp2:Ra,FramebufferTexture:ay,FrontSide:wi,Frustum:Pa,GLBufferAttribute:M_,GLSL1:Vf,GLSL3:il,GreaterDepth:qh,GreaterEqualDepth:jh,GreaterEqualStencilFunc:Rf,GreaterStencilFunc:If,GridHelper:O_,Group:as,HalfFloatType:cs,HemisphereLight:_d,HemisphereLightHelper:D_,HemisphereLightProbe:e_,IcosahedronBufferGeometry:ab,IcosahedronGeometry:cr,ImageBitmapLoader:Ky,ImageLoader:Qs,ImageUtils:bl,ImmediateRenderObject:Y_,IncrementStencilOp:vf,IncrementWrapStencilOp:Sf,InstancedBufferAttribute:us,InstancedBufferGeometry:Ad,InstancedInterleavedBuffer:S_,InstancedMesh:Zu,Int16BufferAttribute:yp,Int32BufferAttribute:_p,Int8BufferAttribute:mp,IntType:ru,InterleavedBuffer:Da,InterleavedBufferAttribute:Mi,Interpolant:gr,InterpolateDiscrete:Us,InterpolateLinear:Vs,InterpolateSmooth:ua,InvertStencilOp:Tf,KeepStencilOp:da,KeyframeTrack:an,LOD:Wu,LatheBufferGeometry:ob,LatheGeometry:gs,Layers:Ca,LessDepth:Xh,LessEqualDepth:xa,LessEqualStencilFunc:Pf,LessStencilFunc:Cf,Light:Qn,LightProbe:Fa,Line:Yn,Line3:P_,LineBasicMaterial:Ot,LineCurve:ka,LineCurve3:Ku,LineDashedMaterial:fd,LineLoop:ju,LineSegments:fn,LinearEncoding:qn,LinearFilter:ft,LinearInterpolant:Fl,LinearMipMapLinearFilter:pf,LinearMipMapNearestFilter:ff,LinearMipmapLinearFilter:Ci,LinearMipmapNearestFilter:gl,LinearSRGBColorSpace:Gn,LinearToneMapping:Kh,Loader:Xt,
3172LoaderUtils:ul,LoadingManager:Vl,LoopOnce:yu,LoopPingPong:bu,LoopRepeat:_u,LuminanceAlphaFormat:uu,LuminanceFormat:hu,MOUSE:of,Material:It,MaterialLoader:Ua,MathUtils:tp,Matrix3:kt,Matrix4:Be,MaxEquation:Oo,Mesh:Tt,MeshBasicMaterial:Jn,MeshDepthMaterial:Ml,MeshDistanceMaterial:Tl,MeshLambertMaterial:ud,MeshMatcapMaterial:dd,MeshNormalMaterial:hd,MeshPhongMaterial:ld,MeshPhysicalMaterial:od,MeshStandardMaterial:Nl,MeshToonMaterial:cd,MinEquation:Do,MirroredRepeatWrapping:Fs,MixOperation:$h,MultiplyBlending:zo,MultiplyOperation:er,NearestFilter:xt,NearestMipMapLinearFilter:df,NearestMipMapNearestFilter:uf,NearestMipmapLinearFilter:_a,NearestMipmapNearestFilter:ya,NeverDepth:Gh,NeverStencilFunc:Af,NoBlending:Tn,NoColorSpace:yf,NoToneMapping:hn,NormalAnimationBlendMode:Ta,NormalBlending:xi,NotEqualDepth:Yh,NotEqualStencilFunc:Lf,NumberKeyframeTrack:$s,Object3D:qe,ObjectLoader:$y,ObjectSpaceNormalMap:Su,OctahedronBufferGeometry:lb,OctahedronGeometry:xs,OneFactor:Oh,OneMinusDstAlphaFactor:Fh,OneMinusDstColorFactor:Vh,OneMinusSrcAlphaFactor:ml,OneMinusSrcColorFactor:kh,Orthogra
3172phicCamera:Ia,PCFShadowMap:fl,PCFSoftShadowMap:Ih,PMREMGenerator:rl,Path:Zs,PerspectiveCamera:Mt,Plane:Vn,PlaneBufferGeometry:cb,PlaneGeometry:ps,PlaneHelper:V_,PointLight:vd,PointLightHelper:R_,Points:qu,PointsMaterial:El,PolarGridHelper:N_,PolyhedronBufferGeometry:hb,PolyhedronGeometry:En,PositionalAudio:a_,PropertyBinding:je,PropertyMixer:Id,QuadraticBezierCurve:Rl,QuadraticBezierCurve3:zl,Quaternion:De,QuaternionKeyframeTrack:_s,QuaternionLinearInterpolant:xd,REVISION:Sa,RGBADepthPacking:wu,RGBAFormat:Ht,RGBAIntegerFormat:gu,RGBA_ASTC_10x10_Format:Qo,RGBA_ASTC_10x5_Format:$o,RGBA_ASTC_10x6_Format:Jo,RGBA_ASTC_10x8_Format:Ko,RGBA_ASTC_12x10_Format:el,RGBA_ASTC_12x12_Format:tl,RGBA_ASTC_4x4_Format:Ho,RGBA_ASTC_5x4_Format:Go,RGBA_ASTC_5x5_Format:Wo,RGBA_ASTC_6x5_Format:Xo,RGBA_ASTC_6x6_Format:Zo,RGBA_ASTC_8x5_Format:jo,RGBA_ASTC_8x6_Format:qo,RGBA_ASTC_8x8_Format:Yo,RGBA_BPTC_Format:nl,RGBA_ETC2_EAC_Format:Vo,RGBA_PVRTC_2BPPV1_Format:Fo,RGBA_PVRTC_4BPPV1_Format:Bo,RGBA_S3TC_DXT1_Format:la,RGBA_S3TC_DXT3_Format:ca,RGBA_S3TC_DXT5_Format:ha,RGBFormat:cu,RGB_ETC1_Format:xu,RGB_ETC2_Format:Uo,RGB_PVRTC_2BPPV1_Format:ko,RGB_PVRTC_4BPPV1_Format:No,RGB_S3TC_DXT1_Format:oa,RGFormat:pu,RGIntegerFormat:mu,RawShaderMaterial:ad,Ray:nr,Raycaster:T_,RectAreaLight:Md,RedFormat:du,RedIntegerFormat:fu,ReinhardToneMapping:Qh,RepeatWrapping:Bs,ReplaceStencilOp:bf,ReverseSubtractEquation:zh,RingBufferGeometry:ub,RingGeometry:hr,SRGBColorSpace:cn,Scene:Vu,ShaderChunk:Fe,ShaderLib:sn,ShaderMaterial:dn,ShadowMaterial:rd,Shape:vi,ShapeBufferGeometry:db,ShapeGeometry:ur,ShapePath:W_,ShapeUtils:un,ShortType:su,Skeleton:Oa,SkeletonHelper:L_,SkinnedMesh:Xu,Source:mi,Sphere:Pi,SphereBufferGeometry:fb,SphereGeometry:ys,Spherical:A_,SphericalHarmonics3:Td,SplineCurve:Dl,SpotLight:bd,SpotLightHelper:I_,Sprite:Gu,SpriteMaterial:Al,SrcAlphaFactor:pl,SrcAlphaSaturateFactor:Hh,SrcColorFactor:Nh,StaticCopyUsage:Bf,StaticDrawUsage:Gs,StaticReadUsage:Of,StereoCamera:n_,StreamCopyUsage:Uf,StreamDrawUsage:Df,StreamReadUsage:kf,StringKeyframeTrack:Ri,SubtractEquation:Rh,SubtractiveBlending:Ro,TOUCH:lf,TangentSpaceNormalMap:$n,TetrahedronBufferGeometry:pb,TetrahedronGeometry:dr,Texture:_t,TextureLoader:Zy,TorusBufferGeometry:mb,TorusGeometry:fr,TorusKnotBufferGeometry:gb,TorusKnotGeometry:pr,Triangle:Jt,TriangleFanDrawMode:xf,TriangleStripDrawMode:gf,TrianglesDrawMode:mf,TubeBufferGeometry:xb,TubeGeometry:mr,UVMapping:Ma,Uint16BufferAttribute:vl,Uint32BufferAttribute:wl,Uint8BufferAttribute:gp,Uint8ClampedBufferAttribute:xp,Uniform:Zl,UniformsGroup:w_,UniformsLib:ge,UniformsUtils:Eu,UnsignedByteType:jn,UnsignedInt248Type:yi,UnsignedIntType:Hn,UnsignedShort4444Type:au,UnsignedShort5551Type:ou,UnsignedShortType:xl,VSMShadowMap:is,Vector2:se,Vector3:A,Vector4:Ke,VectorKeyframeTrack:Js,VideoTexture:ry,WebGL1Renderer:Uu,WebGL3DRenderTarget:rp,WebGLArrayRenderTarget:sp,WebGLCubeRenderTarget:Iu,WebGLMultipleRenderTargets:ap,WebGLMultisampleRenderTarget:$_,WebGLRenderTarget:Kt,WebGLRenderer:Fu,WebGLUtils:Nu,WireframeGeometry:sd,WrapAroundEnding:Hs,ZeroCurvatureEnding:fi,ZeroFactor:Dh,ZeroSlopeEnding:pi,ZeroStencilOp:_f,_SRGBAFormat:ba,sRGBEncoding:ot},Symbol.toStringTag,{value:"Module"}));class yb{constructor(e){Ye(this,"disposables",[]);Ye(this,"inputs",{width:1,height:1,depth:1,color:65280,localScale:{x:1,y:1,z:1},localPosition:{x:0,y:0,z:0},localRotation:{x:0,y:0,z:0},quatW:1,quatX:0,quatY:0,quatZ:0,visible:!0,opacity:.3});Ye(this,"events",{"INTERACTION.CLICK":!0,"INTERACTION.DRAG":!1,"INTERACTION.DRAG_BEGIN":!1,"INTERACTION.DRAG_END":!1,"INTERACTION.HOVER":!0,"INTERACTION.KEY":!0,"INTERACTION.LONG_PRESS_END":!0,"INTERACTION.LONG_PRESS_START":!0,"INTERACTION.MULTI_SWIPE":!0,"INTERACTION.MULTI_SWIPE_END":!0,"INTERACTION.PINCH":!0,"INTERACTION.PINCH_END":!0,"INTERACTION.POINTER_BUTTON":!0,"INTERACTION.POINTER_MOVE":!0,"INTERACTION.ROTATE":!0,"INTERACTION.ROTATE_END":!0,"INTERACTION.SCROLL":!0});Ye(this,"onInit",()=>{const e=this.context.three,t=new e.BoxGeometry(this.inputs.width,this.inputs.height,this.inputs.depth);let n=new e.Color(this.inputs.color);const i=new e.MeshBasicMaterial({color:n,transparent:!0,opacity:this.inputs.opacity,depthWrite:!this.inputs.transparent}),s=new e.Mesh(t,i);s.scale.set(this.inputs.localScale.x,this.inputs.localScale.y,this.inputs.localScale.z),s.position.set(this.inputs.localPosition.x,this.inputs.localPosition.y,this.inputs.localPosition.z),s.rotation.set(this.inputs.localRotation.x,this.inputs.localRotation.y,this.inputs.localRotation.z),this.outputs.objectRoot=s,console.log("added mesh box",s)});Ye(this,"emits",{gltfevents:!0});Ye(this,"onDestroy",()=>{this.outputs.objectRoot.material.dispose(),this.outputs.objectRoot.geometry.dispose(),this.outputs.objectRoot=null});this.onEvent=this.onEvent.bind(this),this.sdk=e}onEvent(e,t){e&&this.notify("gltfevents",t),e==="INTERACTION.CLICK"&&(console.log("GLTF Clicked notify"),t.input.type="click",this.notify("gltfevents",t)),e=="INTERACTION.CLICK"&&console.log("Clicked onEvent in GLTF")}onInputsUpdated(){console.log("Inputs updated",this),this.outputs.objectRoot.visible=this.inputs.visible,this.outputs.objectRoot.scale.set(this.inputs.localScale.x,this.inputs.localScale.y,this.inputs.localScale.z),this.outputs.objectRoot.position.set(this.inputs.localPosition.x,this.inputs.localPosition.y,this.inputs.localPosition.z),this.outputs.objectRoot.rotation.set(this.inputs.localRotation.x,this.inputs.localRotation.y,this.inputs.localRotation.z);const e=this.context.three,t=new e.BoxGeometry(this.inputs.width,this.inputs.height,this.inputs.depth);this.outputs.objectRoot.geometry.dispose(),this.outputs.objectRoot.geometry=t,console.log("Inputs updated",this.inputs.visible)}}const ts="mp.box",ns=function(r){return function(){return new yb(r)}},yh={vertexShader:` 3173 varying vec3 vPos; 3174 3175 void main() { 3176 vPos = position; 3177 vec4 mvPosition = modelViewMatrix * vec4( vPos, 1.0 ); 3178 gl_Position = projectionMatrix * mvPosition; 3179 } 3180 3181 `,fragmentShader:` 3182 vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);} 3183 vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;} 3184 vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);} 3185 3186 float cnoise(vec3 P){ 3187 vec3 Pi0 = floor(P); // Integer part for indexing 3188 vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1 3189 Pi0 = mod(Pi0, 289.0); 3190 Pi1 = mod(Pi1, 289.0); 3191 vec3 Pf0 = fract(P); // Fractional part for interpolation 3192 vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 3193 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 3194 vec4 iy = vec4(Pi0.yy, Pi1.yy); 3195 vec4 iz0 = Pi0.zzzz; 3196 vec4 iz1 = Pi1.zzzz; 3197 3198 vec4 ixy = permute(permute(ix) + iy); 3199 vec4 ixy0 = permute(ixy + iz0); 3200 vec4 ixy1 = permute(ixy + iz1); 3201 3202 vec4 gx0 = ixy0 / 7.0; 3203 vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; 3204 gx0 = fract(gx0); 3205 vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); 3206 vec4 sz0 = step(gz0, vec4(0.0)); 3207 gx0 -= sz0 * (step(0.0, gx0) - 0.5); 3208 gy0 -= sz0 * (step(0.0, gy0) - 0.5); 3209 3210 vec4 gx1 = ixy1 / 7.0; 3211 vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; 3212 gx1 = fract(gx1); 3213 vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); 3214 vec4 sz1 = step(gz1, vec4(0.0)); 3215 gx1 -= sz1 * (step(0.0, gx1) - 0.5); 3216 gy1 -= sz1 * (step(0.0, gy1) - 0.5); 3217 3218 vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); 3219 vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); 3220 vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); 3221 vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); 3222 vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); 3223 vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); 3224 vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); 3225 vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); 3226 3227 vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 3228 g000 *= norm0.x; 3229 g010 *= norm0.y; 3230 g100 *= norm0.z; 3231 g110 *= norm0.w; 3232 vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 3233 g001 *= norm1.x; 3234 g011 *= norm1.y; 3235 g101 *= norm1.z; 3236 g111 *= norm1.w; 3237 3238 float n000 = dot(g000, Pf0); 3239 float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); 3240 float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); 3241 float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); 3242 float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); 3243 float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); 3244 float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); 3245 float n111 = dot(g111, Pf1); 3246 3247 vec3 fade_xyz = fade(Pf0); 3248 vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); 3249 vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); 3250 float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 3251 return 2.2 * n_xyz; 3252 } 3253 3254 varying vec3 vPos; 3255 uniform float skyRadius; 3256 uniform vec3 noiseOffset; 3257 3258 uniform vec3 env_c1; 3259 uniform vec3 env_c2; 3260 3261 uniform float clusterSize; 3262 uniform float clusterStrength; 3263 3264 uniform float starSize; 3265 uniform float starDensity; 3266 3267 void main() { 3268 float freq = 1.1/skyRadius; 3269 float noise = cnoise(vPos * freq); 3270 vec4 backgroundColor = vec4(mix(env_c1, env_c2, noise), 1.0); 3271 3272 float scaledClusterSize = (1.0/clusterSize)/skyRadius; 3273 float scaledStarSize = (1.0/starSize)/skyRadius; 3274 3275 float cs = pow(cnoise(scaledClusterSize*vPos+noiseOffset),1.0/clusterStrength) + cnoise(scaledStarSize*vPos); 3276 3277 float c =clamp(pow(cs, 1.0/starDensity),0.0,1.0); 3278 vec4 starColor = 0.5*vec4(c, c, c, 1.0); 3279 3280 gl_FragColor = backgroundColor; 3281 gl_FragColor += starColor; 3282 } 3283 `};class _b{constructor(e){Ye(this,"disposables",[]);
3283Ye(this,"inputs",{url:"",type:"",seats:0,name:"",animation:0,castShadow:!1,boundingBox:!1,loader:"",visible:!0,clickEventsInteraction:!1,tintGreen:!1,aspectRatio:1,wallRepeat:1,rows:1,columns:1,width:10,depth:10,rowSpace:1,colSpace:1,materialColor:"#8f8f8f",materialColor2:"#8f8f8f",highlightColor:"#ff0066",localScale:{x:1,y:1,z:1},localPosition:{x:0,y:0,z:0},localRotation:{x:0,y:0,z:0},diagramArray:[]});Ye(this,"instancedMesh",null);Ye(this,"raycaster",null);Ye(this,"pointer",null);Ye(this,"camera",null);Ye(this,"isShiftDown",!1);Ye(this,"isCtrlDown",!1);Ye(this,"isAltDown",!1);Ye(this,"isMetaDown",!1);Ye(this,"events",{"INTERACTION.CLICK":this.inputs.clickEventsInteraction,"INTERACTION.DRAG":!1,"INTERACTION.DRAG_BEGIN":!1,"INTERACTION.DRAG_END":!1,"INTERACTION.HOVER":!0,"INTERACTION.KEY":!0,"INTERACTION.LONG_PRESS_END":!0,"INTERACTION.LONG_PRESS_START":!0,"INTERACTION.MULTI_SWIPE":!0,"INTERACTION.MULTI_SWIPE_END":!0,"INTERACTION.PINCH":!0,"INTERACTION.PINCH_END":!0,"INTERACTION.POINTER_BUTTON":!0,"INTERACTION.POINTER_MOVE":!0,"INTERACTION.ROTATE":!0,"INTERACTION.ROTATE_END":!0,"INTERACTION.SCROLL":!0});Ye(this,"totalSeats",0);Ye(this,"onInit",()=>{const e=this.context.three,t=new e.GLTFLoader;if(this.events["INTERACTION.CLICK"]=this.inputs.clickEventsInteraction,this.raycaster=new e.Raycaster,this.pointer=new e.Vector2,this.camera=this.context.camera,this.inputs.loader&&this.inputs.loader=="draco"){console.log("DRACO LOADER");const n=new e.DRACOLoader;n.setDecoderPath("/bundle/vendors/three/0.146.0/libs/draco/"),n.setDecoderConfig({type:"js"}),t.setDRACOLoader(n)}t.load(this.inputs.url,this.onLoaded,function(n){console.log("GLTF Loading Error:",n)})});Ye(this,"onLoaded",e=>{const t=this.context.three;let n=null;if(e.scene.traverse(g=>{!n&&g.isMesh&&(n=g)}),n)this.mesh=n;else{console.error("No mesh found in GLTF");return}n.geometry.computeBoundingBox();const i=n.geometry.boundingBox,s=new t.Vector3;i.getSize(s),n.geometry instanceof t.BufferGeometry||(n.geometry=new t.BufferGeometry().fromGeometry(n.geometry));const a=this.inputs.diagramArray,o=a.length,l=n.material.clone();let c;this.inputs.tintGreen?(l.color.set(new t.Color(this.inputs.highlightColor)),c=new t.InstancedMesh(n.geometry,l,o)):c=new t.InstancedMesh(n.geometry,n.material,o),new t.Matrix4;const u=new t.Vector3,f=new t.Quaternion,p=new t.Vector3(1,1,1);for(let g=0;g<o;g++){const x=a[g];u.set(x.position.x,x.position.y,x.position.z),f.set(x.quaternion.x,x.quaternion.y,x.quaternion.z,x.quaternion.w),p.set(x.scale.x,x.scale.y,x.scale.z);const h=new t.Matrix4().compose(u,f,p);c.setMatrixAt(g,h)}c.instanceMatrix.needsUpdate=!0,this.context.scene.add(c),this.instancedMesh=c,this.outputs.objectRoot=c,this.outputs.collider=c,c.name="GLTF"});Ye(this,"emits",{gltfevents:!0,gltfevents2:!0});Ye(this,"onTick",e=>{this.mixer&&this.mixer.update(e*.001)});this.onEvent=this.onEvent.bind(this),this.sdk=e}updateInstances(){const e=this.context.three,t=this.inputs.diagramArray,n=t.length,i=this.outputs.objectRoot;if(!i)return;const s=new e.Vector3,a=new e.Quaternion,o=new e.Vector3(1,1,1);for(let l=0;l<n;l++){const c=t[l];s.set(c.position.x,c.position.y,c.position.z),a.set(c.quaternion.x,c.quaternion.y,c.quaternion.z,c.quaternion.w),o.set(c.scale.x,c.scale.y,c.scale.z);const u=new e.Matrix4().compose(s,a,o);i.setMatrixAt(l,u)}i.instanceMatrix.needsUpdate=!0}onEvent(e,t){e==="INTERACTION.CLICK"&&(console.log("GLTF Clicked notify",t),t.input.type="click",this.notify("gltfevents",t)),e=="INTERACTION.CLICK"&&(t&&t.input.position?(console.log("glt4 pos click",t.input.position),this.pointer.x=t.input.position.x,this.pointer.y=t.input.position.y,this.handlePointerClick()):console.warn("INTERACTION.CLICK event missing necessary data (position/domContainer)."),console.log("Clicked onEvent in GLTF5",t))}handlePointerClick(){if(!this.inputs.clickEventsInteraction)return;if(!this.raycaster||!this.camera||!this.instancedMesh||!this.instancedMesh.visible){console.warn("Raycast prerequisites not met in handlePointerClick.");return}console.log("[handlePointerClick] Attempting raycast..."),this.camera.updateMatrixWorld(),this.raycaster.setFromCamera(this.pointer,this.camera);const e=this.raycaster.intersectObject(this.instancedMesh);if(e.length>0&&e[0].instanceId!==void 0){const t=e[0].instanceId;console.log(`>>>>>>>> Raycast SUCCESS: Clicked instance index: ${t} <<<<<<<<`);const n=this.getDiagramItemData(t);this.notify("gltfevents",{type:"click",instanceId:t,itemData:n,point:e[0].point})}else e.length>0?console.log("Raycast MISSED: Hit the mesh object, but NO instanceId found."):console.log("Raycast MISSED: Click did not intersect with this instanced mesh.")}getDiagramItemData(e){const t=this.inputs.diagramArray;return t&&e>=0&&e<t.length?t[e]:null}onInputsUpdated(){console.log("Inputs updated",this),this.inputs.diagramArray&&this.inputs.diagramArray.length>0&&this.updateInstances()}onDestroy(){this.mesh&&(this.mesh.material&&this.mesh.material.dispose(),this.mesh.geometry&&this.mesh.geometry.dispose()),this.outputs.collider=null,this.outputs.objectRoot=null}}const _h="mp.gltfInstanceGlobal",bb=function(r){return function(){return new _b(r)}},vb=Ch("storeMaxSets",{state:()=>({servicePerimeter:0,spaceBetweenBlocksHor:24,spaceBetweenBlocksVert:24,spaceBetweenRow:24,spaceBetweenColumn:24,numObjInBlockHor:1,numObjInBlockVert:1,gltfUrl:{name:"roundsOf6LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2F003_SelfWalk_BasicRoundTable_Asset_LOD2.gltf?alt=media&token=e5335755-ab25-4065-832d-51e3dce062be",loader:"",tableType:"round",tableChairs:6,type:"",seats:0,size:{x:2.969,y:.749,z:2.995}},diagramSet:[],maxSetArray:[],wallNodeArray:[],setRequested:null,xPosition:5,zPosition:-10,yRotation:0,setRotation:0,isDragging:!1,avOn:!0,activeSet:null,activeDiagram:"",currentTemplate:{},dragPoint:null,pointOneX:null,pointOneZ:null,pointTwoX:null,pointTwoZ:null,diagramBox:null,
3283selectedDir:"N",previewSetSeatCount:0,areaSubmitted:!1,areaModal:!1,editingArea:{},sourceArea:{},sourceSubmitted:!1,sourceAreaModal:!1,areaClicked:!1,myBoxControl:null,screenSceneObject:null,starSceneObject:null,subscriptions:[],setTemplates:[{diagramType:"theaterDiagram",largeRoomType:!0,smallRoomType:!0,av:!1,gltfName:"grayChairLOD2",aisleHor:60,aisleVert:48,objSpaceHori:20,objSpaceVert:0,objPerBlockHori:7,objPerBlockVert:14},{diagramType:"classroom2per6Diagram",largeRoomType:!0,smallRoomType:!0,av:!1,gltfName:"classroomtablexblend",aisleHor:60,aisleVert:46,objSpaceHori:36,objSpaceVert:0,objPerBlockHori:5,objPerBlockVert:5},{diagramType:"crescent6Diagram",largeRoomType:!0,smallRoomType:!0,av:!1,gltfName:"crescentOf6LOD2",aisleHor:0,aisleVert:0,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"rounds10Diagram",largeRoomType:!0,smallRoomType:!0,av:!1,gltfName:"roundsOf10LOD2",aisleHor:60,aisleVert:60,objSpaceHori:24,objSpaceVert:24,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"receptionDiagram",largeRoomType:!0,smallRoomType:!0,av:!1,gltfName:"cocktail",aisleHor:120,aisleVert:120,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4},{diagramType:"ushapeDiagram",largeRoomType:!1,smallRoomType:!0,av:!1,gltfName:"ushape",aisleHor:60,aisleVert:60,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4},{diagramType:"conferenceDiagram",largeRoomType:!1,smallRoomType:!0,av:!1,gltfName:"conferencetablexblend",aisleHor:0,aisleVert:0,objSpaceHori:0,objSpaceVert:0,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"hollowsquareDiagram",largeRoomType:!1,smallRoomType:!0,av:!1,gltfName:"hollowsquare",aisleHor:60,aisleVert:60,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4},{diagramType:"theaterDiagramAV",largeRoomType:!0,smallRoomType:!0,av:!0,gltfName:"grayChairLOD2",aisleHor:60,aisleVert:48,objSpaceHori:20,objSpaceVert:0,objPerBlockHori:7,objPerBlockVert:14},{diagramType:"classroom2per6DiagramAV",largeRoomType:!0,smallRoomType:!0,av:!0,gltfName:"classroomtablexblend",aisleHor:60,aisleVert:36,objSpaceHori:36,objSpaceVert:0,objPerBlockHori:5,objPerBlockVert:5},{diagramType:"crescent6DiagramAV",largeRoomType:!0,smallRoomType:!0,av:!0,gltfName:"crescentOf6LOD2",aisleHor:0,aisleVert:0,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"rounds10DiagramAV",largeRoomType:!0,smallRoomType:!0,av:!0,gltfName:"roundsOf10LOD2",aisleHor:60,aisleVert:60,objSpaceHori:24,objSpaceVert:24,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"receptionDiagramAV",largeRoomType:!0,smallRoomType:!1,av:!0,gltfName:"cocktail",aisleHor:120,aisleVert:120,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4},{diagramType:"ushapeDiagramAV",largeRoomType:!1,smallRoomType:!0,av:!0,gltfName:"ushape",aisleHor:60,aisleVert:60,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4},{diagramType:"conferenceDiagramAV",largeRoomType:!1,smallRoomType:!0,av:!0,gltfName:"conferencetablexblend",aisleHor:0,aisleVert:0,objSpaceHori:0,objSpaceVert:0,objPerBlockHori:1,objPerBlockVert:1},{diagramType:"hollowsquareDiagramAV",largeRoomType:!1,smallRoomType:!0,av:!0,gltfName:"hollowsquare",aisleHor:60,aisleVert:60,objSpaceHori:60,objSpaceVert:60,objPerBlockHori:5,objPerBlockVert:4}],editedSetTemplates:[],setTemplatesAV:[],screenBranding:[],screenNodeArray:[],screenPos:[],screenControlAir:null,airControl:0,showSetModal:!1,setModalResolve:null,diagramSettings:{direction:"N",stageGLTF:null}}),actions:{async dynamicMaxSet(r,e,t,n,i,s,a,o){at();let l=[];this.diagramSet=[],this.maxSetArray=[];let c=t.widthX*t.depthZ*10.76391042;c>6e3&&(s=60),c>3e3&&c<6e3&&(s=40),c<=3e3&&(s=20);let u=this.setTemplates.find(f=>f.diagramType===e);r.setTemplate&&r.setTemplate[e]&&(u.aisleHor=r.setTemplate[e].aisleHor,u.aisleVert=r.setTemplate[e].aisleVert,u.objSpaceHori=r.setTemplate[e].objSpaceHori,u.objSpaceVert=r.setTemplate[e].objSpaceVert,u.objPerBlockHori=r.setTemplate[e].objPerBlockHori,u.objPerBlockVert=r.setTemplate[e].objPerBlockVert,u.serPer=r.setTemplate[e].serPer,console.log("room ser per",r.setTemplate[e].serPer,s),(r.setTemplate[e].serPer!=null||r.setTemplate[e].serPer!=null)&&(s=r.setTemplate[e].serPer),console.log("room ser per",r.setTemplate[e].serPer,s)),this.findGltfObj(e),u.gltfObj=this.gltfUrl,await this.setTemplate(u.gltfObj,s,u.aisleHor,u.aisleVert,u.objSpaceHori,u.objSpaceVert,u.objPerBlockHori,u.objPerBlockVert),console.log("debug GLTF",this.gltfUrl),l=await this.addDiagram(r,r.id,`${e}`,t,n,!0,a),console.log("showing Dynamic set",l),o||await this.showDynamicDiagramming(l),this.screenSceneObject&&(console.log("Stopping and clearing current diagramming scene..."),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.length>0&&(this.subscriptions.forEach(f=>f.cancel()),this.subscriptions=[]))},async showDynamicDiagramming(r){const e=at();e.subscriptions||(e.subscriptions=[]),e.diagrammingSceneObject&&(console.log("Stopping and clearing current diagramming scene..."),e.diagrammingSceneObject.stop(),e.diagrammingSceneObject=null,e.subscriptions.length>0&&(e.subscriptions.forEach(n=>n.cancel()),e.subscriptions=[]));let t=r;if(console.log("wall time",t),console.log("showDiagramming1",t),this.wallNodeArray=[],e.diagrammingSceneObject)console.log("diagrammingSceneObject.stop()"),e.diagrammingSceneObject.stop(),e.diagrammingSceneObject=null,e.subscriptions.forEach(n=>n.cancel()),e.subscriptions=[];else{await e.mpSdk.Scene.registerComponents([{factory:bb(e.mpSdk),name:_h}]),e.diagrammingSceneObject=(await e.mpSdk.Scene.createObjects(1))[0];const n={};t.forEach((a,o)=>{const l=a.url;n[l]||(n[l]=[]),n[l].push(a)});let i=0;
3283for(const[a,o]of Object.entries(n)){console.log(`URL item: ${a}`);let l=[];o.forEach(m=>{l.push(m)});let c=e.diagrammingSceneObject.addNode(),u=c.addComponent(_h,{url:a,diagramArray:l});class f{constructor(){Ye(this,"path",g)}onEvent(v){console.log("click evnet12 log"),v.input.type=="hover",v.input.type=="unhover"&&(console.log("userNavigationEnabled = true"),e.inputComponent.inputs.userNavigationEnabled=!0),v.input.type=="click"&&(console.log("click evnet log"),e.inputComponent.inputs.userNavigationEnabled=!0)}}class p{constructor(v,y){this.path=v,this.node=y}onEvent(v){v.input.type=="hover",v.input.type=="unhover"?e.inputComponent.inputs.userNavigationEnabled=!0:v.input.type=="click"?console.log("Clicked emit"):v.input.type==="dragend"&&console.log("Drag ended")}}console.log("registered gltf");const g=await e.diagrammingSceneObject.addEmitPath(u,"gltfevents","urlInstanceComp_"+i),x=e.diagrammingSceneObject.spyOnEvent(new f);e.subscriptions.push(x);const h=await e.diagrammingSceneObject.addEmitPath(u,"gltfevents"),d=e.diagrammingSceneObject.spyOnEvent(new p(h,c));e.subscriptions.push(d),i+=1}e.diagrammingSceneObject.addNode().addComponent("mp.ambientLight",{intensity:1,color:{r:1,g:1,b:1}}),e.diagrammingSceneObject.start()}},async turnOffDiagram(){const r=at();console.log("diagrammingSceneObject.stop()"),r.diagrammingSceneObject.stop(),r.diagrammingSceneObject=null,r.subscriptions.forEach(e=>e.cancel()),r.subscriptions=[],this.screenSceneObject&&(console.log("Stopping and clearing current diagramming scene..."),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.length>0&&(this.subscriptions.forEach(e=>e.cancel()),this.subscriptions=[]))},async showBranding(){const r=at();let e=this.screenBranding;console.log("screen branding",e),this.screenNodeArray=[],this.subscriptions||(this.subscriptions=[]),this.screenSceneObject&&(console.log("Stopping and clearing current diagramming scene..."),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.length>0&&(this.subscriptions.forEach(n=>n.cancel()),this.subscriptions=[]));class t{constructor(i,s){this.path=i,this.node=s}onEvent(i){i.input.type=="hover",i.input.type=="unhover"?r.inputComponent.inputs.userNavigationEnabled=!0:i.input.type=="click"?console.log("Clicked emit"):i.input.type==="dragend"&&console.log("Drag ended")}}if(this.screenSceneObject)console.log("brandingSceneObject.stop()"),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.forEach(n=>n.cancel()),this.subscriptions=[];else{await r.mpSdk.Scene.registerComponents([{factory:Yl(r.mpSdk),name:_r}]),console.log("creating wallsceneobj"),this.screenSceneObject=(await r.mpSdk.Scene.createObjects(1))[0],console.log("creating wallsceneobj");for(let s=0;s<e.length;s++){this.screenNodeArray[s]=this.screenSceneObject.addNode();const a=e[s];a.type="image",this.screenNodeArray[s].obj3D.position.set(a.position.x,a.position.y+2,a.position.z),this.screenNodeArray[s].obj3D.scale.set(a.scale.x*2,a.scale.y*1.5,a.scale.z*2);let o=new De(a.quaternion.x,a.quaternion.y,a.quaternion.z,a.quaternion.w),l=new De;l.setFromAxisAngle(new A(0,1,0),Math.PI/2),o.multiplyQuaternions(l,o),this.screenNodeArray[s].obj3D.quaternion.copy(o);let c=new A(0,0,1);c.applyQuaternion(o);let u=.15;this.screenNodeArray[s].obj3D.position.add(c.multiplyScalar(u)),this.screenPos[s]={pos:this.screenNodeArray[s].obj3D.position,quat:this.screenNodeArray[s].obj3D.quaternion,scale:this.screenNodeArray[s].obj3D.scale},console.log("wall"+s,this.screenPos[s]),console.log("registering gltf");let f;r.siteProInfo.complex&&r.siteProInfo.complex.length>0&&r.siteProInfo.complex[r.selectedComplex].landingLogoUrl&&(f=r.siteProInfo.complex[r.selectedComplex].landingLogoUrl),(!r.siteProInfo.complex||r.siteProInfo.complex.length==0)&&(f=r.siteProInfo.landingLogoUrl),a.type=="image"?f=f:a.type==="video"?f=r.siteProInfo.curatedProposal.textureSrcVideo:f=a.textureSrc,console.log("screen branding",this.screenPos[s],f);const p=this.screenNodeArray[s].addComponent(_r,{type:a.type,textureSrc:f,aspectRatio:1});console.log("wallnodecomp",p);const g=await this.screenSceneObject.addEmitPath(p,"planeEvents"),x=this.screenSceneObject.spyOnEvent(new t(g,this.screenNodeArray[s]));this.subscriptions.push(x);const h=await this.screenSceneObject.addEmitPath(p,"planeEvents","wallNodeComp_"+s);class d{constructor(){Ye(this,"path",h)}onEvent(y){console.log("click evnet12 log"),y.input.type=="hover",y.input.type=="unhover"&&(console.log("userNavigationEnabled = true"),r.inputComponent.inputs.userNavigationEnabled=!0)}}const m=this.screenSceneObject.spyOnEvent(new d);this.subscriptions.push(m),console.log("registered gltf")}const n=this.screenSceneObject.addNode();this.screenControlAir=n.addComponent("mp.transformControls",{mode:"scale",selection:null,size:1}),this.screenSceneObject.addNode().addComponent("mp.ambientLight",{intensity:1,color:{r:1,g:1,b:1}}),this.screenSceneObject.start()}this.screenControlAir.inputs.selection=null,this.airControl=0},async showBranding2(){const r=at();let e=this.screenBranding;console.log("screen branding",e),this.screenNodeArray=[],this.subscriptions||(this.subscriptions=[]),this.screenSceneObject&&(console.log("Stopping and clearing current diagramming scene..."),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.length>0&&(this.subscriptions.forEach(n=>n.cancel()),this.subscriptions=[]));class t{constructor(i,s){this.path=i,this.node=s}onEvent(i){i.input.type=="hover",i.input.type=="unhover"?r.inputComponent.inputs.userNavigationEnabled=!0:i.input.type=="click"?console.log("Clicked emit"):i.input.type==="dragend"&&c
3283onsole.log("Drag ended")}}if(this.screenSceneObject)console.log("brandingSceneObject.stop()"),this.screenSceneObject.stop(),this.screenSceneObject=null,this.subscriptions.forEach(n=>n.cancel()),this.subscriptions=[];else{await r.mpSdk.Scene.registerComponents([{factory:Yl(r.mpSdk),name:_r}]),console.log("creating wallsceneobj"),this.screenSceneObject=(await r.mpSdk.Scene.createObjects(1))[0],console.log("creating wallsceneobj");for(let s=0;s<e.length;s++){const a=e[s];if(this.screenNodeArray[s]=this.screenSceneObject.addNode(),a.type="image",a.brandPos){let v=new A(a.brandPos.oX,a.brandPos.oY,a.brandPos.oZ);const y=new De(a.quaternion.x,a.quaternion.y,a.quaternion.z,a.quaternion.w);v.applyQuaternion(y);let _=new A(a.position.x+v.x,a.position.y+v.y,a.position.z+v.z);this.screenNodeArray[s].obj3D.position.set(_.x,_.y,_.z),this.screenNodeArray[s].obj3D.scale.set(a.scale.x*a.brandPos.sX,a.scale.y*a.brandPos.sY,a.scale.z*a.brandPos.sZ)}else this.screenNodeArray[s].obj3D.position.set(a.position.x,a.position.y+2,a.position.z),this.screenNodeArray[s].obj3D.scale.set(a.scale.x*2,a.scale.y*1.5,a.scale.z*2);let o=new De(a.quaternion.x,a.quaternion.y,a.quaternion.z,a.quaternion.w),l=new De;l.setFromAxisAngle(new A(0,1,0),Math.PI/2),o.multiplyQuaternions(l,o),this.screenNodeArray[s].obj3D.quaternion.copy(o);let c=new A(0,0,1);c.applyQuaternion(o);let u=.15;this.screenNodeArray[s].obj3D.position.add(c.multiplyScalar(u)),this.screenPos[s]={pos:this.screenNodeArray[s].obj3D.position,quat:this.screenNodeArray[s].obj3D.quaternion,scale:this.screenNodeArray[s].obj3D.scale},console.log("wall"+s,this.screenPos[s]),console.log("registering gltf");let f;r.siteProInfo.complex&&r.siteProInfo.complex.length>0&&r.siteProInfo.complex[r.selectedComplex].landingLogoUrl&&(f=r.siteProInfo.complex[r.selectedComplex].landingLogoUrl),(!r.siteProInfo.complex||r.siteProInfo.complex.length==0)&&(f=r.siteProInfo.landingLogoUrl),a.type=="image"?f=f:a.type==="video"?f=r.siteProInfo.curatedProposal.textureSrcVideo:f=a.textureSrc,console.log("screen branding",this.screenPos[s],f);const p=this.screenNodeArray[s].addComponent(_r,{type:a.type,textureSrc:f,aspectRatio:1});console.log("wallnodecomp",p);const g=await this.screenSceneObject.addEmitPath(p,"planeEvents"),x=this.screenSceneObject.spyOnEvent(new t(g,this.screenNodeArray[s]));this.subscriptions.push(x);const h=await this.screenSceneObject.addEmitPath(p,"planeEvents","wallNodeComp_"+s);class d{constructor(){Ye(this,"path",h)}onEvent(y){console.log("click evnet12 log"),y.input.type=="hover",y.input.type=="unhover"&&(console.log("userNavigationEnabled = true"),r.inputComponent.inputs.userNavigationEnabled=!0)}}const m=this.screenSceneObject.spyOnEvent(new d);this.subscriptions.push(m),console.log("registered gltf")}const n=this.screenSceneObject.addNode();this.screenControlAir=n.addComponent("mp.transformControls",{mode:"scale",selection:null,size:1}),this.screenSceneObject.addNode().addComponent("mp.ambientLight",{intensity:1,color:{r:1,g:1,b:1}}),this.screenSceneObject.start()}this.screenControlAir.inputs.selection=null,this.airControl=0},async defineAreaOG(r,e){return new Promise((t,n)=>{const i=at();console.log("usernavigation: ",i.inputComponent.inputs.userNavigationEnabled),i.inputComponent.inputs.userNavigationEnabled=!1,console.log("usernavigation: ",i.inputComponent.inputs.userNavigationEnabled),console.log("nav disabled");let s=0,a=!1,o=!1;this.pointOneX=null,this.pointOneZ=null,this.pointOneY=null,this.pointTwoX=null,this.pointTwoZ=null,this.pointTwoY=null,console.log("Intersection count:",s);const l=Is(()=>i.showcaseClickCount,(u,f)=>{u>f&&(a||(this.isDragging=!0,console.log("isDragging:",i.showcaseClickCount),console.log("DragPoint",this.dragPoint,"count",s)),a&&!o&&(o=!0,l(),console.log("isDragging stopped click watch:",i.showcaseClickCount)),a=!0)});this.dragPoint=i.mpSdk.Pointer.intersection.subscribe(u=>{if(a&&!o&&!this.pointOneX)console.log("Point 1 first:",u.position),this.pointOneX=u.position.x,this.pointOneZ=u.position.z,this.pointOneY=u.position.y,c(this.pointOneX,this.pointOneZ,u.position.x,u.position.z,!1,r,e);else if(a&&!o&&this.pointOneX)console.log("Point 1:",this.pointOneX,"Dragging Point 2:",u.position),c(this.pointOneX,this.pointOneZ,u.position.x,u.position.z,!1,r,e);else if(a&&o&&!this.pointTwoX){this.pointTwoX=u.position.x,this.pointTwoZ=u.position.z,this.pointTwoY=u.position.y,console.log("Point 1:",this.pointOneX,this.pointOneZ,"Point 2:",this.pointTwoX,this.pointTwoZ),this.dragPoint.cancel(),c(this.pointOneX,this.pointOneZ,this.pointTwoX,this.pointTwoZ,!0,r,e),i.inputComponent.inputs.userNavigationEnabled=!0,console.log("usernavigation: ",i.inputComponent.inputs.userNavigationEnabled);const f=this.pointTwoZ-this.pointOneZ,p=this.pointTwoX-this.pointOneX,g=Math.atan2(f,p),x=Math.round(g*(180/Math.PI)),h=Math.round(x/90)*90;console.log("normalizedAngle",h);let d={startX:this.pointOneX,startZ:this.pointOneZ,endX:this.pointTwoX,endZ:this.pointTwoZ,widthX:Math.abs(this.pointTwoX-this.pointOneX),depthZ:Math.abs(this.pointTwoZ-this.pointOneZ)};this.pointOneX<this.pointTwoX?(d.startX=this.pointOneX,d.endX=this.pointTwoX):(d.startX=this.pointTwoX,d.endX=this.pointOneX),this.pointOneZ<this.pointTwoZ?(d.startZ=this.pointOneZ,d.endZ=this.pointTwoZ):(d.startZ=this.pointTwoZ,d.endZ=this.pointOneZ),console.log("arealog",d),console.log("diagramtemplatenode1",i.diagramtemplatenode),console.log("diagramtemplatenode2",i.diagramtemplatenode),t(d)}});async function c(u,f,p,g,x,h,d){await i.mpSdk.Scene.registerComponents([{factory:ns(i.mpSdk),name:ts}]);try{i.diagramtemplateobject!=null&&(console.log("checking if obj null",i.diagramtemplateobject),i.diagramtemplateobject.stop(),i.diagramtemplateobject=null),i.diagramtemplateobject=(await i.mpSdk.Scene.createObjects(1))[0],i.diagramtemplatenode=await i.diagramtemplateobject.addNode(),console.log("trying to add box"),this.diagramBox=i.diagramtemplatenode.addComponent("mp.box",{width:Math.abs(p-u),height:.4,depth:Math.abs(g-f),color:h,opacity:d??.3,localScale:{x:1,y:1,z:1},localPosition:{x:(p+u)/2,y:.1,z:(g+f)/2},localRotation:{x:0,y:0,z:0}}),console.log("component added",i.diagramtemplatenode,this.diagramBox),i.diagramtemplateobject.start()}catch(m){console.error("Error adding box to Matterport scene:",m)}x&&(i.diagramtemplatenode.stop(),i.diagramtemplatenode=null)}})},async defineArea(r,e){return console.log("storeMaxSets defineArea"),new Promise((t,n)=>{const i=at();this.areaModal=!0,i.inputComponent.inputs.userNavigationEnabled=!1;let s=!1,a=!1,o=null,l=null,c=null,u=null,f=null,p=null,g=null;const x=Is(()=>i.showcaseClickCount,(m,v)=>{m>
3283v&&(s||(this.isDragging=!0),s&&!a&&(a=!0,x()),s=!0)}),h=i.mpSdk.Pointer.intersection.subscribe(m=>{if(s&&!a&&!o)this.areaClicked=!1,o=m.position.x,l=m.position.z,c=m.position.y,console.log("clicking area"),d(o,l,m.position.x,m.position.z,c,!1,r,e);else if(s&&!a&&o)d(o,l,m.position.x,m.position.z,c,!1,r,e);else if(s&&a&&!u){u=m.position.x,f=m.position.z,p=m.position.y,h.cancel(),d(o,l,u,f,c,!0,r,e),i.inputComponent.inputs.userNavigationEnabled=!0;let v={startX:o,startZ:l,endX:u,endZ:f,startY:c,endY:p,widthX:Math.abs(u-o),depthZ:Math.abs(f-l),heightY:4};o<u?(v.startX=o,v.endX=u):(v.startX=u,v.endX=o),l<f?(v.startZ=l,v.endZ=f):(v.startZ=f,v.endZ=l),v.quat||(v.quat={x:0,y:0,z:0,w:1}),t(v)}});async function d(m,v,y,_,S,M,C,b){await i.mpSdk.Scene.registerComponents([{factory:ns(i.mpSdk),name:ts}]);try{i.diagramtemplateobject!=null&&(i.diagramtemplateobject.stop(),i.diagramtemplateobject=null),i.diagramtemplateobject=(await i.mpSdk.Scene.createObjects(1))[0],i.diagramtemplatenode=await i.diagramtemplateobject.addNode(),g=i.diagramtemplatenode.addComponent("mp.box",{width:Math.abs(y-m),height:.4,depth:Math.abs(_-v),color:C,opacity:b??.3,localScale:{x:1,y:1,z:1},localPosition:{x:(y+m)/2,y:S,z:(_+v)/2},localRotation:{x:0,y:0,z:0}}),i.diagramtemplateobject.start()}catch(w){console.error("Error adding box to Matterport scene:",w)}M&&(i.diagramtemplatenode.stop(),i.diagramtemplatenode=null)}})},async addAreaByPoints(r,e){return new Promise((t,n)=>{const i=at();i.inputComponent.inputs.userNavigationEnabled=!1;let s=0;const a=[],o=3;let l=null;console.log("Starting point selection...");const c=Is(()=>i.showcaseClickCount,(g,x)=>{g>x&&(s++,console.log(`Click ${s} detected.`),s>=o&&(c(),console.log("Maximum number of clicks reached.")))}),u=i.mpSdk.Pointer.intersection.subscribe(g=>{if(s>a.length&&(a.push({x:g.position.x,z:g.position.z}),console.log(`Point ${a.length} recorded:`,g.position),a.length>=o)){u.cancel(),console.log("All points have been recorded.");const x=f(a);p(x.startX,x.startZ,x.endX,x.endZ,x.quat,r,e),i.inputComponent.inputs.userNavigationEnabled=!0,t(x)}});function f(g){const[x,h,d]=g,m={x:h.x-x.x,z:h.z-x.z},v=Math.atan2(m.z,m.x),y={x:0,y:Math.sin(v/2),z:0,w:Math.cos(v/2)},_={x:-m.z,z:m.x},S=((d.x-x.x)*_.x+(d.z-x.z)*_.z)/(_.x**2+_.z**2),M=x.x+m.x+S*_.x,C=x.z+m.z+S*_.z;return{startX:x.x,startZ:x.z,endX:M,endZ:C,quat:y,widthX:Math.sqrt(m.x**2+m.z**2),depthZ:Math.abs(S)}}async function p(g,x,h,d,m,v,y){await i.mpSdk.Scene.registerComponents([{factory:ns(i.mpSdk),name:ts}]);try{i.diagramtemplateobject!=null&&(i.diagramtemplateobject.stop(),i.diagramtemplateobject=null),i.diagramtemplateobject=(await i.mpSdk.Scene.createObjects(1))[0],i.diagramtemplatenode=await i.diagramtemplateobject.addNode(),l=i.diagramtemplatenode.addComponent("mp.box",{width:Math.abs(h-g),height:.4,depth:Math.abs(d-x),color:v,opacity:y??.3,localScale:{x:1,y:1,z:1},localPosition:{x:(h+g)/2,y:.1,z:(d+x)/2},localRotation:m}),i.diagramtemplateobject.start()}catch(_){console.error("Error adding box to Matterport scene:",_)}}})},async visualBox(r,e,t,n,i,s,a,o,l,c){const u=at();await u.mpSdk.Scene.registerComponents([{factory:ns(u.mpSdk),name:ts}]);try{u.diagramtemplateobject!=null&&(u.diagramtemplateobject.stop(),u.diagramtemplateobject=null),u.diagramtemplateobject=(await u.mpSdk.Scene.createObjects(1))[0],u.diagramtemplatenode=await u.diagramtemplateobject.addNode(),console.log("added node for box",u.diagramtemplatenode),await u.diagramtemplatenode.position.set((t+r)/2,i,(n+e)/2),await u.diagramtemplatenode.scale.set(Math.abs(t-r),Math.max(Math.abs(s-i),2.75),Math.abs(n-e));let f={x:0,y:0,z:0,w:1},p=c||f;console.log("quat",c," to set is",p,"default quat is",f),await u.diagramtemplatenode.quaternion.set(p.x,p.y,p.z,p.w),console.log("nodequat",u.diagramtemplatenode.quaternion,"quat to set is",p,"default quat is",f),console.log("Node quaternion after setting:",u.diagramtemplatenode.quaternion),this.diagramBox=u.diagramtemplatenode.addComponent("mp.box",{width:1,height:1,depth:1,color:o,opacity:l??.3,localScale:{x:1,y:1,z:1},localPosition:{x:0,y:0,z:0},localRotation:{x:0,y:0,z:0}}),u.controlBoxNode=await u.diagramtemplateobject.addNode(),u.myBoxControl=u.controlBoxNode.addComponent("mp.transformControls",{mode:"scale",selection:null,size:1}),u.myBoxControl.inputs.selection=u.diagramtemplatenode,Is(()=>u.currentMpMode,g=>{g==="mode.floorplan"?(console.log("new scene mode",g),u.myBoxControl.inputs.size=.01):u.myBoxControl.inputs.size=1}),u.diagramtemplateobject.start()}catch(f){console.error("Error adding box to Matterport scene:",f)}a&&(u.diagramtemplatenode.stop(),u.diagramtemplatenode=null)},deepClone(r){if(r===null||typeof r!="object")return r;let e=Array.isArray(r)?[]:{};for(let t in r)r.hasOwnProperty(t)&&(e[t]=this.deepClone(r[t]));return e},async addDiagram(r,e,t,n,i,s,a,o){const l=at();console.log("adding diagram with",r,e,t,n,i,"gltf val1",this.gltfUrl);let c;o||(o=n),n?c=this.deepClone(n):c=await this.defineArea("0x00ff00",.7,30);let u=this.servicePerimeter*.0254;console.log("serPer",u,this.servicePerimeter,c,"area start",c.startX,c.startZ),c.quat||(c.quat={x:0,y:0,z:0,w:1}),c.startX=c.startX+u,c.startZ=c.startZ+u,c.endZ=c.endZ-u,c.endX=c.endX-u,console.log(c,"area with serPer",c.startX,c.startZ),console.log("area1",c,"square area",c.widthX*c.depthZ),c.widthX=Math.abs(c.startX-c.endX),c.depthZ=Math.abs(c.startZ-c.endZ),console.log("area2",c,"square area",c.widthX*c.depthZ),console.log("add diagram",r,e,t);let f=Ct();console.log("diagramID",f),this.diagramSet=[],console.log("maxsetarray",this.maxSetArray,"diagramset",this.diagramSet),this.maxSetArray||(this.maxSetArray=[]),this.maxSetArray?this.diagramSet=this.maxSetArray:this.diagramSet=[],console.log("maxsetarray2",this.maxSetArray,"diagramset2",this.diagramSet);let p=c.startX,g=c.startZ,x=c.startY;this.yRotation*(Math.PI/180);let h=c.widthX,d=c.depthZ;try{let X=function(k,Y){return{w:k.w*Y.w-k.x*Y.x-k.y*Y.y-k.z*Y.z,x:k.w*Y.x+k.x*Y.w+k.y*Y.z-k.z*Y.y,y:k.w
3283*Y.y-k.x*Y.z+k.y*Y.w+k.z*Y.x,z:k.w*Y.z+k.x*Y.y-k.y*Y.x+k.z*Y.w}},O=function(k,Y){let{x:oe,y:we,z:Z,w:W}=Y,{x:ie,y:pe,z:ue}=k,Le=W*ie+we*ue-Z*pe,xe=W*pe+Z*ie-oe*ue,ye=W*ue+oe*pe-we*ie,ke=-oe*ie-we*pe-Z*ue;return{x:Le*W+ke*-oe+xe*-Z-ye*-we,y:xe*W+ke*-we+ye*-oe-Le*-Z,z:ye*W+ke*-Z+Le*-we-xe*-oe}},N=function(k,Y,oe){let we={x:k.x-Y.x,y:k.y-Y.y,z:k.z-Y.z},Z=O(we,oe);return{x:Z.x+Y.x,y:Z.y+Y.y,z:Z.z+Y.z}},m=this.spaceBetweenColumn*.0254,v=this.spaceBetweenRow*.0254,y=this.spaceBetweenBlocksHor*.0254,_=this.spaceBetweenBlocksVert*.0254,S;i?S=i:S=prompt("Please enter the direction of the area (N, S, E, W)","N"),c.direction=S,console.log("area",c,"roomdir",i,"roomarea",n);let M,C,b,w,P;console.log(c.direction),(c.direction=="N"||c.direction=="n")&&(M=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),C=this.gltfUrl.size.z+m,w=this.gltfUrl.size.x+v),(c.direction=="S"||c.direction=="s")&&(M=new De().setFromAxisAngle(new A(0,1,0),Math.PI/2),C=this.gltfUrl.size.z+m,w=this.gltfUrl.size.x+v),(c.direction=="E"||c.direction=="e")&&(M=new De().setFromAxisAngle(new A(0,1,0),Math.PI),m=this.spaceBetweenRow*.0254,v=this.spaceBetweenColumn*.0254,y=this.spaceBetweenBlocksVert*.0254,_=this.spaceBetweenBlocksHor*.0254,C=this.gltfUrl.size.x+m,w=this.gltfUrl.size.z+v),(c.direction=="W"||c.direction=="w")&&(M=new De().setFromAxisAngle(new A(0,1,0),0),m=this.spaceBetweenRow*.0254,v=this.spaceBetweenColumn*.0254,y=this.spaceBetweenBlocksVert*.0254,_=this.spaceBetweenBlocksHor*.0254,C=this.gltfUrl.size.x+m,w=this.gltfUrl.size.z+v),(this.numObjInBlockHor*C>h||this.numObjInBlockVert*w>d)&&console.log("Too many objects for the area");let T=h/(this.numObjInBlockHor*C+y),F=d/(this.numObjInBlockVert*w+_),B=T-Math.floor(T),R=F-Math.floor(F),U=Math.max(1,h/(this.numObjInBlockHor*C+y)),q=Math.max(1,d/(this.numObjInBlockVert*w+_));console.log("requested hori",this.numObjInBlockHor,"blockCountHor",U,"blockCountVert",q,"remainHor",B,"remainVert",R),b=this.numObjInBlockHor,P=this.numObjInBlockVert;let J=[];if(console.log("adding diagram tableType",this.gltfUrl.tableType),this.gltfUrl.tableType=="roun
3283d"||this.gltfUrl.tableType=="classroom"||this.gltfUrl.tableType=="crescent"||this.gltfUrl.tableType=="theater")for(let k=0;k<q;k++)for(let Y=0;Y<U;Y++)for(let oe=0;oe<P;oe++)for(let we=0;we<b;we++){let Z=M,W=Ct(),ie={position:{x:we*C+y*Y+b*C*Y+(p+C/2),y:x,z:oe*w+_*k+P*w*k+(g+w/2)},scale:{x:1,y:1,z:1},quaternion:{x:Z.x,y:Z.y,z:Z.z,w:Z.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},materialColor:"white",diagramID:W};J.push(ie),ie={}}if(this.gltfUrl.tableType=="conference"||this.gltfUrl.tableType=="ushape"||this.gltfUrl.tableType=="hollowsquare"){let ue=function(xe){if(xe=="n"||xe=="s")return xe="e";if(xe=="e"||xe=="w")return xe="n"},k,Y;switch(c.direction.toLowerCase()){case"n":Y=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),k=Math.max(Math.floor(d/this.gltfUrl.size.z),1);break;case"s":Y=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),k=Math.max(Math.floor(d/this.gltfUrl.size.z),1);break;case"e":Y=new De().setFromAxisAngle(new A(0,1,0),Math.PI),k=Math.max(Math.floor(h/this.gltfUrl.size.z),1);break;case"w":Y=new De().setFromAxisAngle(new A(0,1,0),Math.PI),k=Math.max(Math.floor(h/this.gltfUrl.size.z),1);break}let oe=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),we=new De().setFromAxisAngle(new A(0,1,0),Math.PI/2),Z=new De().setFromAxisAngle(new A(0,1,0),Math.PI),W=Y.clone().multiply(Z),ie=Y.clone().multiply(oe),pe=Y.clone().multiply(we);const Le=(xe,ye,ke)=>{let ze,L,E=p+h/2,j=g+d/2;return ye==="n"||ye==="s"?(ze=E-this.gltfUrl.size.x/2*ke,L=g+this.gltfUrl.size.z/2+xe*this.gltfUrl.size.z):(ze=p+this.gltfUrl.size.z/2+xe*this.gltfUrl.size.z,L=j-this.gltfUrl.size.x/2*ke),{x:ze,y:x,z:L}};if(this.gltfUrl.tableType=="conference")for(let xe=0;xe<k;xe++){const ye=Le(xe,c.direction.toLowerCase(),1);let ke=Ct(),ze={position:{x:ye.x,y:ye.y,z:ye.z},scale:{x:1,y:1,z:1},quaternion:{x:ie.x,y:ie.y,z:ie.z,w:ie.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},materialColor:"white",diagramID:ke};J.push(ze),console.log("new con params",ze),ze={}}if(this.gltfUrl.tableType=="conference")for(let xe=0;xe<k;xe++){const ye=Le(xe,c.direction.toLowerCase(),-1);let ke=Ct(),ze={position:{x:ye.x,y:ye.y,z:ye.z},scale:{x:1,y:1,z:1},quaternion:{x:pe.x,y:pe.y,z:pe.z,w:pe.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},materialColor:"white",diagramID:ke};J.push(ze),console.log("new con params",ze),ze={}}if(this.gltfUrl.tableType=="ushape"||this.gltfUrl.tableType=="hollowsquare"){let L=function(ne){let z=ne;if(z=="n")return z="s",z;if(z=="e")return z="w",z;if(z=="s")return z="n",z;if(z=="w")return z="e",z;console.log("settingDir180",z)},E=function(ne){let z=ne;if(z=="n")return z="e",z;if(z=="e")return z="s",z;if(z=="s")return z="w",z;if(z=="w")return z="n",z;console.log("settingDir90",z)},j=function(ne){let z=ne;if(z=="n")return z="w",z;if(z=="w")return z="s",z;if(z=="s")return z="e",z;if(z=="e")return z="n",z};console.log("setPos check",this.gltfUrl);let xe,ye=Math.floor(h/this.gltfUrl.size.z),ke=Math.floor((d-this.gltfUrl.size.x*2)/this.gltfUrl.size.z);this.gltfUrl.tableType=="ushape"?xe=3:xe=4;const ze=(ne,z,be)=>{console.log("setPos",z,this.gltfUrl);let de,_e;return z=="n"&&(de=p+this.gltfUrl.size.z/2+ne*this.gltfUrl.size.z,_e=g+this.gltfUrl.size.z*ke+this.gltfUrl.size.x*1.5,console.log("myX, myZ, initX, initZ, maxInside, maxoutside",de,_e,p,g,ke,ye)),z=="e"&&(de=p+this.gltfUrl.size.x/2,_e=g+this.gltfUrl.size.x+this.gltfUrl.size.z/2+ne*this.gltfUrl.size.z),z=="w"&&(de=p+this.gltfUrl.size.z*ye-this.gltfUrl.size.x/2,_e=g+this.gltfUrl.size.x+this.gltfUrl.size.z/2+ne*this.gltfUrl.size.z),z=="s"&&(de=p+this.gltfUrl.size.z/2+ne*this.gltfUrl.size.z,_e=g+this.gltfUrl.size.x/2),{x:de,y:x,z:_e}};let K=!1,ae=!1,fe=!1,Se=!1;if(c.direction.toLowerCase()=="n"&&this.gltfUrl.tableType=="ushape"&&(Se=!0),c.direction.toLowerCase()=="e"&&this.gltfUrl.tableType=="ushape"&&(ae=!0),c.direction.toLowerCase()=="w"&&this.gltfUrl.tableType=="ushape"&&(fe=!0),c.direction.toLowerCase()=="s"&&this.gltfUrl.tableType=="ushape"&&(K=!0),Y=ne
3283w De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),W=Y.clone().multiply(Z),ie=Y.clone().multiply(oe),pe=Y.clone().multiply(we),!K)for(let ne=0;ne<ye;ne++){let z=Ct(),be=ze(ne,"n"),de={position:{x:be.x,y:x,z:be.z},scale:{x:1,y:1,z:1},quaternion:{x:Y.x,y:Y.y,z:Y.z,w:Y.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},overFlowBound:{x:this.gltfUrl.size.z,y:this.gltfUrl.size.y,z:this.gltfUrl.size.x},materialColor:"white",diagramID:z};J.push(de),console.log("new params",de),de={}}if(!ae)for(let ne=0;ne<ke;ne++){let z=Ct(),be=ze(ne,"w"),de={position:{x:be.x,y:x,z:be.z},scale:{x:1,y:1,z:1},quaternion:{x:pe.x,y:pe.y,z:pe.z,w:pe.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},materialColor:"white",diagramID:z};J.push(de),console.log("new params",de),de={}}if(!fe)for(let ne=0;ne<ke;ne++){let z=Ct(),be=ze(ne,"e"),de={position:{x:be.x,y:x,z:be.z},scale:{x:1,y:1,z:1},quaternion:{x:ie.x,y:ie.y,z:ie.z,w:ie.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},materialColor:"white",diagramID:z};J.push(de),console.log("new params",de),de={}}if(!Se)for(let ne=0;ne<ye;ne++){let z=Ct(),be=ze(ne,"s"),de={position:{x:be.x,y:x,z:be.z},scale:{x:1,y:1,z:1},quaternion:{x:W.x,y:W.y,z:W.z,w:W.w},boundingBox:!1,url:this.gltfUrl.url,seats:this.gltfUrl.seats,tableType:this.gltfUrl.tableType,tableChairs:this.gltfUrl.tableChairs,size:{x:this.gltfUrl.size.x,y:this.gltfUrl.size.y,z:this.gltfUrl.size.z},overFlowBound:{x:this.gltfUrl.size.z,y:this.gltfUrl.size.y,z:this.gltfUrl.size.x},materialColor:"white",diagramID:z};J.push(de),console.log("new params",de),de={}}}}let re={x:o.startX+o.widthX/2,y:0,z:o.startZ+o.depthZ/2},ee=null,le=null,me=null,he=null,H=0,Ae=0;for(let k=J.length-1;k>=0;k--){let Y=J[k].position,oe=J[k].quaternion,we=J[k].overFlowBound||J[k].size;Y.x+we.x/2-1e-4>c.startX+c.widthX||Y.z+we.z/2-1e-4>c.startZ+c.depthZ||Y.x-we.x/2+1e-4<c.startX||Y.z-we.z/2+1e-4<c.startZ?(console.log("splicing because overflow","pos x",Y.x,">",c.startX+c.widthX," or pos z",Y.z,">",c.startZ+c.depthZ,"or pos.x",Y.x,"<",c.startX,"or pos.z",Y.z,"<",c.startZ),J.splice(k,1)):((le==null||Y.x>le)&&(le=Y.x),(ee==null||Y.x<ee)&&(ee=Y.x),(he==null||Y.z>he)&&(he=Y.z),(me==null||Y.z<me)&&(me=Y.z))}J.forEach(k=>{this.diagramSet.push(k)});for(let k=this.diagramSet.length-1;k>=0;k--){let Y=ee-c.startX,oe=c.startX+c.widthX-le,we=me-c.startZ,Z=c.startZ+c.depthZ-he;H=(oe-Y)/2,Ae=(Z-we)/2,console.log("itemspace","stx, minx, maxx, enx",c.startX,ee,le,c.startX+c.widthX,"stz, minz, mazz, enz",c.startZ,me,he,c.startZ+c.depthZ),this.diagramSet[k].position.x=this.diagramSet[k].position.x+H,this.diagramSet[k].position.z=this.diagramSet[k].position.z+Ae;let W=N(this.diagramSet[k].position,re,c.quat);this.diagramSet[k].position=W;let ie=X(c.quat,this.diagramSet[k].quaternion);if(this.diagramSet[k].quaternion=ie,this.diagramSet[k].tableChairs>0){let pe=l.siteProInfo.chairObjSel,ue=this.diagramSet[k].position.x,Le=this.diagramSet[k].position.y,xe=this.diagramSet[k].position.z,ye=this.diagramSet[k].tableChairs,ke=(this.diagramSet[k].size.x+pe.size.x)/1.95,ze=(this.diagramSet[k].size.x+pe.size.x)/1.95,L=(this.diagramSet[k].size.z+pe.size.x)/1.95,E=this.diagramSet[k].size.x,j=this.diagramSet[k].size.z;
3283if(this.diagramSet[k].tableType=="round"&&!this.diagramSet[k].tableID)for(let K=0;K<this.diagramSet[k].tableChairs;K++){let ae=l.siteProInfo.chairObjSel,fe=Ct(),Se=-2*Math.PI/ye*K,ne=2*Math.PI/ye*K,z=new De().setFromAxisAngle(new A(0,1,0),ne);z=X(c.quat,z);let be={x:ue,y:0,z:xe},de={x:ue+L*Math.cos(Se),y:this.diagramSet[k].position.y,z:xe+ze*Math.sin(Se)};de=N(de,be,c.quat);let _e={position:{x:de.x,y:de.y,z:de.z},scale:{x:1,y:1,z:1},quaternion:{x:z.x,y:z.y,z:z.z,w:z.w},boundingBox:!1,url:ae.url,seats:ae.seats,tableType:ae.tableType,tableChairs:ae.tableChairs,tableID:this.diagramSet[k].diagramID,size:{x:ae.size.x,y:ae.size.y,z:ae.size.z},materialColor:"white",diagramID:fe};this.diagramSet.push(_e),_e={}}if(this.diagramSet[k].tableType=="classroom"&&!this.diagramSet[k].tableID){let K=M;K=X(c.quat,K);let ae=this.yRotation*(Math.PI/180),fe=this.diagramSet[k].size.z,Se=this.diagramSet[k].size.x,ne=this.diagramSet[k].position.x,z=this.diagramSet[k].position.z,be=l.siteProInfo.chairObjSel,de=this.diagramSet[k].tableChairs,_e=Se/1.25,Pe=be.size.x/2+.05;for(let Me=0;Me<this.diagramSet[k].tableChairs;Me++){let Oe=l.siteProInfo.chairObjSel,Qe=Ct(),nt,D,$=Oe.size.z,ce=(fe-$*de)/(de+1),Ce=$/2+Me*($+ce)+ce;switch(c.direction.toLowerCase()){case"n":nt=ne-fe/2+Ce,D=z+Se/2+Pe;break;case"s":nt=ne-fe/2+Ce,D=z-Se/2-Pe;break;case"e":nt=ne-Se/2-Pe,D=z+fe/2-Ce;break;case"w":nt=ne+Se/2+Pe,D=z-fe/2+Ce;break}let Xe={x:ne,y:0,z},it={x:nt,y:this.diagramSet[k].position.y,z:D};it=N(it,Xe,c.quat);let ct={position:{x:it.x,y:this.diagramSet[k].position.y,z:it.z},scale:{x:1,y:1,z:1},quaternion:{x:K.x,y:K.y,z:K.z,w:K.w},boundingBox:!1,url:Oe.url,seats:Oe.seats,tableType:Oe.tableType,tableChairs:Oe.tableChairs,tableID:this.diagramSet[k].diagramID,size:{x:Oe.size.x,y:Oe.size.y,z:Oe.size.z},materialColor:"white",diagramID:Qe};this.diagramSet.push(ct),ct={}}}if((this.diagramSet[k].tableType=="conference"||this.diagramSet[k].tableType=="ushape"||this.diagramSet[k].tableType=="hollowsquare")&&!this.diagramSet[k].tableID){let K=this.diagramSet[k].quaternion,ae=this.yRotation*(Math.PI/180),fe=this.diagramSet[k].size.z,Se=this.diagramSet[k].size.x,ne=this.diagramSet[k].position.x,z=this.diagramSet[k].position.z,be=l.siteProInfo.chairObjSel,de=this.diagramSet[k].tableChairs,_e=Se;for(let Pe=0;Pe<this.diagramSet[k].tableChairs;Pe++){let Me=l.siteProInfo.chairObjSel,Oe=Ct(),Qe,nt,D=new A(this.diagramSet[k].size.x,this.diagramSet[k].size.y,this.diagramSet[k].size.z),$=Me.size.z,ce=(D.z-Me.size.z*de)/(de+1),ve=new De(K.x,K.y,K.z,K.w),Ce=new A(ne,this.diagramSet[k].position.y,z),it=-(D.z/2)+$/2+Pe*($+ce)+ce,ct=ne
3283w A(_e,0,it);ct.applyQuaternion(ve);let on=ct.add(Ce),st={x:ne,y:0,z},Bt={x:on.x,y:this.diagramSet[k].position.y,z:on.z},Lt={position:{x:Bt.x,y:Bt.y,z:Bt.z},scale:{x:1,y:1,z:1},quaternion:{x:K.x,y:K.y,z:K.z,w:K.w},boundingBox:!1,url:Me.url,seats:Me.seats,tableType:Me.tableType,tableChairs:Me.tableChairs,tableID:this.diagramSet[k].diagramID,size:{x:Me.size.x,y:Me.size.y,z:Me.size.z},materialColor:"white",diagramID:Oe};this.diagramSet.push(Lt),Lt={}}}if(this.diagramSet[k].tableType=="crescent"&&!this.diagramSet[k].tableID)for(let K=0;K<this.diagramSet[k].tableChairs;K++){let ae=l.siteProInfo.chairObjSel,fe=Ct(),Se;switch(c.direction.toLowerCase()){case"n":Se=-1*Math.PI/(this.diagramSet[k].tableChairs-1)*K-Math.PI;break;case"s":Se=1*Math.PI/(this.diagramSet[k].tableChairs-1)*K-Math.PI;break;case"e":Se=-1*Math.PI/(this.diagramSet[k].tableChairs-1)*K-Math.PI/2;break;case"w":Se=1*Math.PI/(this.diagramSet[k].tableChairs-1)*K-Math.PI/2;break}let ne=2*Math.PI/ye*K,z=M;z=X(c.quat,z);let be={x:ue,y:0,z:xe},de={x:ue+L*Math.cos(Se),y:this.diagramSet[k].position.y,z:xe+ze*Math.sin(Se)};de=N(de,be,c.quat);let _e={position:{x:de.x,y:de.y,z:de.z},scale:{x:1,y:1,z:1},quaternion:{x:z.x,y:z.y,z:z.z,w:z.w},boundingBox:!1,url:ae.url,seats:ae.seats,tableType:ae.tableType,tableChairs:ae.tableChairs,tableID:this.diagramSet[k].diagramID,size:{x:ae.size.x,y:ae.size.y,z:ae.size.z},materialColor:"white",diagramID:fe};this.diagramSet.push(_e),_e={}}this.diagramSet[k].tableID=this.diagramSet[k].diagramID}}return this.maxSetArray=this.diagramSet,console.log("New wall params added:",f,this.diagramSet,this.maxSetArray),console.log("is updateSeats",a,t),a&&(console.log("updating max set seat count",t),await this.updateMaxSetSeats(r,e,t)),this.diagramSet;console.log("New wall params added:",this.diagramSet),s&&console.log("not showing diagrams created")}catch(m){console.error("Error in addWall function:",m)}},async updateMaxSetSeats(r,e,t){const n=at();let i=0;for(let s=0;s<this.diagramSet.length;s++)i+=this.diagramSet[s].seats;r.capacities[t]=i,console.log("new seat count",r.capacities,r.capacities[t],i),await n.updateField(e,"capacities",r.capacities)},async buildDynoAVSets(r,e,t,n,i,s,a,o,l,c){const u=at();let f=[];this.diagramSet=[],this.maxSetArray=[];let p=!1;n?p=!0:window.confirm("Is Area box good?")||(n=await this.defineArea("0x00ff00",.7,30));let g=u.diagramObjects.find(h=>h.name==="screentripod"),x=u.diagramObjects.find(h=>h.name==="stage6ftx8ft");if(p){let h=this.deepClone(n),d=this.deepClone(n);console.log("avarea2",d);let m=this.deepClone(n),v=this.deepClone(n),y,_,S=n.widthX*n.depthZ*10.76391042,M,C=i??prompt("Please enter the direction of the area (N, S, E, W)","N").toUpperCase(),b=s??window.confirm("Is the Ceiling Tall? Confirm to use Risers, cancel to skip risers.");this.screenBranding=[],S>6e3&&(M=60,y=3,b?_=x.size.z*2:_=g.size.x*2),S>3e3&&S<6e3&&(M=40,y=2,b?_=x.size.z*2:_=g.size.x*2),S<=3e3&&(M=20,y=1,b?_=x.size.z*2:_=g.size.x*2),S<=1600&&(M=20,y=1,b?_=x.size.z*2:_=g.size.x*2,console.log("small room, screenspace small",_));let w=this.deepClone(n);console.log("roomsetarea",w);let P,T=M*.0254;C.toLowerCase()=="n"&&(w.startZ=w.startZ+_,w.depthZ=Math.abs(w.startZ-w.endZ),P="n",w.widthX-T*2<50&&(y=2),w.widthX-T*2<30&&(y=1),y==3&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-T-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.endZ=m.startZ+_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+T+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.endZ=m.startZ+_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.startX+x.size.x,h.endX=h.endX,h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),console.log("avarea2 after north",d,"screennum",y),console.log("roomsetarea after north",w)),C.toLowerCase()=="s"&&(w.endZ=w.endZ-_,w.depthZ=Math.abs(w.startZ-w.endZ),P="s",console.log("room is south"),w.widthX-T*2<50&&(y=2),w.widthX-T*2<30&&(y=1),y==3&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-T-(d.widthX-2*T)/y*(y-2),d.startZ=d.endZ-_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.startZ=m.endZ-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+T+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.startZ=m.endZ-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.startX+x.size.x,h.endX=h.endX,h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),C.toLowerCase()=="w"&&(w.startX=w.startX+_,w.widthX=Math.abs(w.startX-w.endX),P="e",w.depthZ-T*2<50&&(y=2),w.depthZ-T*2<30&&(y=1),y==3&&(m.endX=m.startX+_,m.startZ=m.startZ+x.size.x+T,m.endZ=m.endZ-T-(m.depthZ-2*T)/y*(y-1),m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ),d.endX=d.startX+_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),h.startZ=h.startZ+(h.depthZ-2*T)/y*(y-1),h.endZ=h.endZ-T,h.endX=h.startX+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),y==2&&(m.endX=m.startX+_,m.startZ=m.startZ+x.size.x+T,m.endZ=m.endZ-(m.depthZ-2*T)/y*(y-1),m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ),d.endX=d.startX+_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),h.startZ=h.startZ+T+(h.depthZ-2*T)/y*(y-1),h.endZ=h.endZ-T,h.endX=h.startX+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),y==1&&(h.endX=h.startX+_,h.startZ=h.startZ+x.size.x,h.endZ=h.endZ,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),C.toLowerCase()=="e"&&(w.endX=w.endX-_,w.widthX=Math.abs(w.startX-w.endX),P="w",w.depthZ-T*2<50&&(y=2),w.depthZ-T*2<30&&(y=1),y==3&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x+T,h.endZ=h.endZ-T-(h.depthZ-2*T)/y*(y-1),h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.endX-_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startZ=m.startZ+(m.depthZ-2*T)/y*(y-1),m.endZ=m.endZ-T,m.startX=m.endX-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x+T,h.endZ=h.endZ-(h.depthZ-2*T)/y*(y-1),h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.endX-_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startZ=m.startZ+T+(m.depthZ-2*T)/y*(y-1),m.endZ=m.endZ-T,m.startX=m.endX-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x,h.endZ=h.endZ,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),this.maxSetArray=[],console.log("adding diagrams theater av, roomserper",M);let F=this.setTemplates.find(B=>B.diagramType===t);this.findGltfObj(t),F.gltfObj=this.gltfUrl,console.log("dyno av set obj",F.gltfObj,t),r.setTemplate&&r.setTemplate[t]&&(F.aisleHor=r.setTemplate[t].aisleHor,F.aisleVert=r.setTemplate[t].aisleVert,F.objSpaceHori=r.setTemplate[t].objSpaceHori,F.objSpaceVert=r.setTemplate[t].objSpaceVert,F.objPerBlockHori=r.setTemplate[t].objPerBlockHori,F.objPerBlockVert=r.setTemplate[t].objPerBlockVert,F.serPer=r.setTemplate[t].serPer,console.log("room ser per",r.setTemplate[t].serPer,M),(r.setTemplate[t].serPer!=null||r.setTemplate[t].serPer!=null)&&(M=r.setTemplate[t].serPer),console.log("room ser per",r.setTemplate[t].serPer,M)),await this.setTemplate(F.gltfObj,M,F.aisleHor,F.aisleVert,F.objSpaceHori,F.objSpaceVert,F.objPerBlockHori,F.objPerBlockVert),console.log("avarea2 placing screens",d,"screennum",y),y==1&&await this.placeStageScreen(r,e,`${t}`,3,2,b,"center",h,v,P,!0),y==2&&(await this.placeStageScreen(r,e,`${t}`,3,2,b,"left",h,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"right",m,v,P,!0)),y==3&&(await this.placeStageScreen(r,e,`${t}`,3,2,b,"left",h,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"center",d,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"right",m,v,P,!0)),this.maxSetArray=await this.addDiagram(r,r.id,`${t}`,w,C,l,o,v),c&&(console.log("attempting whitefloor"),await this.addVisualFloor(n.startX,n.startZ,n.endX,n.endZ,!1,"0x00ff00",.5)),console.log("showing Dynamic set",f),l||(await this.showDynamicDiagramming(this.maxSetArray),await this.showBranding()),console.log("finshed adding av sets")}},async starTheSky(){const r=at(),e=r.inputComponent.context.three;let t=r.mainNode.obj3D.parent;console.log(t);const n=r.inputComponent.context.renderer,i=new e.Plane(new e.Vector3(1,0,0),-10),s=new e.Plane(new e.Vector3(-1,0,0),50),a=new e.Plane(new e.Vector3(0,0,1),-10),o=new e.Plane(new e.Vector3(0,0,-1),50);n.clippingPlanes=[i,s,a,o],n.localClippingEnabled=!0;const l=new e.PlaneHelper(i,100,16711680),c=new e.PlaneHelper(s,100,65280),u=new e.PlaneHelper(a,100,255),f=new e.PlaneHelper(o,100,16776960);t.add(l),t.add(c),t.add(u),t.add(f);let p,g;if(t&&typeof t.children<"u")for(let h in t.children){let d=t.children[h];if(d.name=="Skysphere"){console.log("skytime",d),p=d,g=d.material.uniforms.radius,console.log(d);break}}x();function x(){var h=new e.ShaderMaterial({uniforms:{skyRadius:g,env_c1:{value:new e.Color("#0d1a2f")},env_c2:{value:new e.Color("#0f8682")},noiseOffset:{value:new e.Vector3(100.01,100.01,100.01)},starSize:{value:.01},starDensity:{value:.09},clusterStrength:{value:.2},clusterSize:{value:.2}},fragmentShader:yh.fragmentShader,vertexShader:yh.vertexShader,side:e.DoubleSide,needsUpdate:!0});p.material=h}},async addVisualFloor(r,e,t,n,i,s,a){const o=at();await o.mpSdk.Scene.registerComponents([{factory:ns(o.mpSdk),name:ts}]);try{o.diagramtemplateobject!=null&&(console.log("checking if obj null",o.diagramtemplateobject),o.diagramtemplateobject.stop(),o.diagramtemplateobject=null),o.diagramtemplateobject=(await o.mpSdk.Scene.createObjects(1))[0],o.diagramtemplatenode=await o.diagramtemplateobject.addNode(),console.log("trying to add box"),this.diagramBox=o.diagramtemplatenode.addComponent("mp.box",{width:Math.abs(t-r),height:.1,depth:Math.abs(n-e),color:s,opacity:a??.3,localScale:{x:1,y:1,z:1},localPosition:{x:(t+r)/2,y:.1,z:(n+e)/2},localRotation:{x:0,y:0,z:0}}),console.log("component added",o.diagramtemplatenode,this.diagramBox),o.diagramtemplateobject.start()}catch(l){console.error("Error adding box to Matterport scene:",l)}i&&(o.diagramtemplatenode.stop(),o.diagramtemplatenode=null)},setTemplate(r,e,t,n,i,s,a,o){console.log("setting template"),at(),this.servicePerimeter=e,this.spaceBetweenBlocksHor=t,this.spaceBetweenBlocksVert=n,this.spaceBetweenRow=i,this.spaceBetweenColumn=s,this.numObjInBlockHor=a,this.numObjInBlockVert=o,this.gltfUrl=r,console.log("template set, gltfurl",this.gltfUrl)},findGltfObj(r){const e=at();(r=="theaterDiagram"||r=="theaterDiagramAV")&&(this.gltfUrl=e.siteProInfo.chairObjSel),(r=="classroom2per6Diagram"||r=="classroom2per6DiagramAV")&&(this.gltfUrl=e.siteProInfo.classroomTableObjSel),(r=="crescent6Diagram"||r=="crescent6DiagramAV")&&(this.gltfUrl=e.siteProInfo.crescentsTableObjSel),(r=="rounds10Diagram"||r=="roun
3283ds10DiagramAV")&&(this.gltfUrl=e.siteProInfo.roundsTableObjSel),(r=="receptionDiagram"||r=="receptionDiagramAV")&&(this.gltfUrl=e.siteProInfo.receptionTableObjSel),(r=="ushapeDiagram"||r=="ushapeDiagramAV")&&(this.gltfUrl=e.siteProInfo.ushapeTableObjSel),(r=="conferenceDiagram"||r=="conferenceDiagramAV")&&(this.gltfUrl=e.siteProInfo.conferenceTableObjSel),(r=="hollowsquareDiagram"||r=="hollowsquareDiagramAV")&&(this.gltfUrl=e.siteProInfo.hollowTableObjSel)},async buildMainSets(r,e,t,n){const i=at();let s=!1;if(t?s=!0:window.confirm("Is Area box good?")||(t=await this.defineArea("0x00ff00",.7,30)),s){let a=t.widthX*t.depthZ*10.76391042,o;a>4e3?o=60:o=20;let l=n??prompt("Please enter the direction of the area (N, S, E, W)","N").toUpperCase();console.log("adding diagrams theater"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.chairObjSel,o,60,48,20,0,14,7),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`theaterDiagram${l}`,t,l,!0),this.maxSetArray=[],console.log("adding diagrams classroom"),await this.setTemplate(i.siteProInfo.classroomTableObjSel,o,60,36,36,0,5,5),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`classroom2per6Diagram${l}`,t,l,!0),console.log("adding diagrams crescent"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.crescentsTableObjSel,o,60,60,0,0,1,1),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`crescent6Diagram${l}`,t,l,!0),await delay(3e3),await delay(1e3),await delay(3e3),console.log("adding diagrams rounds10"),this.maxSetArray=[],await delay(4e3),await this.setTemplate(i.siteProInfo.roundsTableObjSel,o,60,60,0,0,1,1),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`rounds10Diagram${l}`,t,l,!0),console.log("adding diagrams reception"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.receptionTableObjSel,o,120,120,60,60,5,4),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`receptionDiagram${l}`,t,l,!0),a<3100&&(console.log("adding diagrams ushape"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.conferenceTableObjSel,o,60,60,60,60,5,4),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`ushapeDiagram${l}`,t,l,!0),console.log("adding diagrams conference"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.conferenceTableObjSel,o,60,60,60,60,5,4),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`conferenceDiagram${l}`,t,l,!0),console.log("adding diagrams hollowsquare"),this.maxSetArray=[],await this.setTemplate(i.siteProInfo.conferenceTableObjSel,o,60,60,60,60,5,4),console.log("roomSerPer this.servicePerimeter",this.servicePerimeter),await addDiagram(r,e,`hollowsquareDiagram${l}`,t,l,!0)),console.log("finished adding diagrams")}},async placeStageScreen(r,e,t,n,i,s,a,o,l,c,u){const f=at();let p=f.diagramObjects.find(he=>he.name==="stage6ftx8ft"),g=o;g.quat||(g.quat={x:0,y:0,z:0,w:1}),console.log("area",g);let x=c;s||(n=0,i=0),console.log("screenside",a),g.direction=x,console.log("area",g),console.log("add diagram",r,e,t);let h=Ct();this.diagramSet=[],this.maxSetArray||(this.maxSetArray=[]),this.maxSetArray?this.diagramSet=this.maxSetArray:this.diagramSet=[];let d=g.startX,m=g.startZ,v=g.startY;this.yRotation*(Math.PI/180);let y=g.widthX,_=g.depthZ,S=Ct(),M,C,b,w=f.diagramObjects.find(he=>he.name==="screentripod"),P,T,F,B,R,U,q,J,X;function O(he,H){return{w:he.w*H.w-he.x*H.x-he.y*H.y-he.z*H.z,x:he.w*H.x+he.x*H.w+he.y*H.z-he.z*H.y,y:he.w*H.y-he.x*H.z+he.y*H.w+he.z*H.x,z:he.w*H.z+he.x*H.y-he.y*H.x+he.z*H.w}}function N(he,H){let{x:Ae,y:k,z:Y,w:oe}=H,{x:we,y:Z,z:W}=he,ie=oe*we+k*W-Y*Z,pe=oe*Z+Y*we-Ae*W,ue=oe*W+Ae*Z-k*we,Le=-Ae*we-k*Z-Y*W;return{x:ie*oe+Le*-Ae+pe*-Y-ue*-k,y:pe*oe+Le*-k+ue*-Ae-ie*-Y,z:ue*oe+Le*-Y+ie*-k-pe*-Ae}}function re(he,H,Ae){let k={x:he.x-H.x,y:he.y-H.y,z:he.z-H.z},Y=N(k,Ae);return{x:Y.x+H.x,y:Y.y+H.y,z:Y.z+H.z}}let ee={x:l.startX+l.widthX/2,y:0,z:l.startZ+l.depthZ/2};switch((g.direction.toLowerCase()=="s"||g.direction.toLowerCase()=="n")&&(n?C=n:C=0,i?b=i:b=0),(g.direction.toLowerCase()=="w"||g.direction.toLowerCase()=="e")&&(n?C=i:C=0,i?b=n:b=0),g.direction.toLowerCase()){case"n":M=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),X=M,R=p.size.z,U=p.size.x,q=d-p.size.z/2+p.size.z*C/2,J=m-p.size.x/2+p.size.x*b/2,P=q,T=J-U/2+.24,F=d+(y-R*C)/2,B=m+U/2,s&&(a=="left"&&(P=F-R*.5-1.9),a=="right"&&(P=F+R*(C-.5)+1.9),a=="center"&&(T=m+.5,P=F-R*.5+R*(C/2))),s||(T=m+.5,P=F-R*.5+R*(C/2));break;case"s":M=new De().setFromAxisAngle(new A(0,1,0),Math.PI/2),X=M,R=p.size.z,U=p.size.x,q=d-p.size.z/2+p.size.z*C/2,J=m-p.size.x/2+p.size.x*b/2,P=q,T=J-p.size.x/2+p.size.x*b/2,F=d+(y-R*C)/2,B=m+_-U*b+U/2,s&&(a=="left"&&(P=F-R*.5-1.9,T=m+_-.5),a=="right"&&(P=F+R*(C-.5)+1.9,T=m+_-.5),a=="center"&&(T=m+_-.5,P=F-R*.5+R*(C/2))),s||(T=m+_-.5,P=F-R*.5+R*(C/2));break;case"e":M=new De().setFromAxisAngle(new A(0,1,0),Math.PI),X=new De().setFromAxisAngle(new A(0,1,0),0),R=p.size.x,U=p.size.z,q=d-p.size.x/2+p.size.x*C/2,J=m-p.size.z/2+p.size.z*b/2,P=q+p.size.x/2-p.size.x*C/2+.25,T=J,F=d+R/2,B=m+(_-U*b)/2,s&&(a=="left"&&(T=B+U*(b-.5)+1.9),a=="right"&&(T=B-U*.5-1.9),a=="center"&&(T=B+U*(b/2)-U*.5,P=d+.5)),s||(T=B+U*(b/2)-U*.5,P=d+.5);break;case"w":M=new De().setFromAxisAngle(new A(0,1,0),0),X=new De().setFromAxisAngle(new A(0,1,0),Math.PI),R=p.size.x,U=p.size.z,q=d-p.size.x/2+p.size.x*C/2,J=m-p.size.z/2+p.size.z*b/2,P=q+p.size.x/2+p.size.x*C/2,T=J,F=d+y-R*C+R/2,B=m+(_-U*b)/2,s&&(a=="right"&&(T=B+U*(b-.5)+1.9,P=d+y-.5),a=="left"&&(T=B-U*.5-1.9,P=d+y-.5),a=="center"&&(T=B-U*.5+U*(b/2),P=d+y-.5)),s||(T=B-U*.5+U*(b/2),P=d+y-.5);break}console.log("positions","initialX",d,"initialZ",m,"stageNumEleWidth","stageNumEleDepth","templateWidth","templateDepth",C,b,y,_);for(let he=0;he<C;he++)for(let H=0;H<b;H++){let Ae=M;Ae=O(g.quat,Ae);let k={x:R*he+F,y:v,z:U*H+B};k=re(k,ee,g.quat);let Y={position:{x:k.x,y:k.y,z:k.z},scale:{x:1,y:1,z:1},quaternion:{x:Ae.x,y:Ae.y,z:Ae.z,w:Ae.w},boundingBox:!1,url:p.url,seats:p.seats,materialColor:"white",diagramID:S};this.diagramSet.push(Y),Y={}}X=O(g.quat,X);let le={x:P,y:v,z:T};le=re(le,ee,g.quat);let me={position:{x:le.x,y:le.y,z:le.z},scale:{x:1,y:1,z:1},quaternion:{x:X.x,y:X.y,z:X.z,w:X.w},boundingBox:!1,url:w.url,seats:w.seats,materialColor:"white",diagramID:S};this.diagramSet.push(me),this.screenBranding.push(me),me={};try{this.maxSetArray=this.diagramSet,console.log("New wall params added:",h,this.diagramSet,this.maxSetArray),console.log("New wall params added:",this.diagramSet)}catch(he){console.error("Error in addWall function:",he)}this.maxSetArray=this.diagramSet,console.log("New wall params added:",h,this.diagramSet,this.maxSetArray),u?console.log("not showing diagrams created"):(showDiagramming(this.diagramSet),showDiagramming(this.diagramSet))},async openSetModal(){return this.showSetModal=!0,console.log("Modal opened1:",this.showSetModal),new Promise(r=>{this.setModalResolve=r})},async closeSetModal(r){this.setModalResolve&&(this.setModalResolve(r),this.setModalResolve=null,this.showSetModal=!1,console.log("(showsetmodal)",this.showSetModal)),this.showSetModal=!1,console.log("Modal closed (sh
3283owsetmodal):",this.showSetModal)},async visualBox5Color(r,e,t,n,i,s,a,o,l,c){const u=at();await u.mpSdk.Scene.registerComponents([{factory:ns(u.mpSdk),name:ts}]);try{let g=function(M,C,b){const w={x:M.x-b.x,y:M.y-b.y,z:M.z-b.z},{x:P,y:T,z:F}=w,{x:B,y:R,z:U,w:q}=C,J=q*P+R*F-U*T,X=q*T+U*P-B*F,O=q*F+B*T-R*P,N=-B*P-R*T-U*F,re={x:J*q+N*-B+X*-U-O*-R,y:X*q+N*-R+O*-B-J*-U,z:O*q+N*-U+J*-R-X*-B};return{x:re.x+b.x,y:re.y+b.y,z:re.z+b.z}};u.diagramtemplateobject!=null&&(u.diagramtemplateobject.stop(),u.diagramtemplateobject=null),u.diagramtemplateobject=(await u.mpSdk.Scene.createObjects(1))[0];let p=c||{x:0,y:0,z:0,w:1};const x={x:(t+r)/2,y:i+1,z:(n+e)/2};let h=[16777215,16711680,65280,16776960,255],d=[(t+r)/2,(t+r)/2,(t+r)/2,r+.5,t-.5],m=[i+.25,i+.75,i+.75,i+.75,i+.75],v=[(n+e)/2,e+.5,n-.5,(n+e)/2,(n+e)/2],y=[Math.abs(t-r),Math.abs(t-r)-2,Math.abs(t-r)-2,1,1],_=[.5,.5,.5,.5,.5],S=[Math.abs(n-e),1,1,Math.abs(n-e)-2,Math.abs(n-e)-2];for(let M=0;M<5;M++){const C=await u.diagramtemplateobject.addNode();let b=d[M],w=m[M],P=v[M];if(M>0){const T=g({x:b,y:w,z:P},p,x);b=T.x,w=T.y,P=T.z}await C.position.set(b,w,P),await C.scale.set(y[M],_[M],S[M]),await C.quaternion.set(p.x,p.y,p.z,p.w),C.addComponent("mp.box",{width:1,height:1,depth:1,color:h[M],opacity:l??.3,localScale:{x:1,y:1,z:1},localPosition:{x:0,y:0,z:0},localRotation:{x:0,y:0,z:0}})}u.diagramtemplateobject.start()}catch(f){console.error("Error adding nodes to Matterport scene:",f)}a&&(u.diagramtemplateobject.stop(),u.diagramtemplateobject=null)},async returnDynoAVSetsOG(r,e,t,n,i,s,a,o,l,c){const u=at();let f=[];this.diagramSet=[],this.maxSetArray=[];let p=!1;n?p=!0:window.confirm("Is Area box good?")||(n=await this.defineArea("0x00ff00",.7,30));let g=u.diagramObjects.find(h=>h.name==="screentripod"),x=u.diagramObjects.find(h=>h.name==="stage6ftx8ft");if(p){let h=this.deepClone(n),d=this.deepClone(n);console.log("avarea2",d);let m=this.deepClone(n),v=this.deepClone(n),y,_,S=n.widthX*n.depthZ*10.76391042,M,C=i??prompt("Please enter the direction of the area (N, S, E, W)","N").toUpperCase(),b=s??window.confirm("Is the Ceiling Tall? Confirm to use Risers, cancel to skip risers.");this.screenBranding=[],S>6e3&&(M=60,y=3,b?_=x.size.z*2:_=g.size.x*2),S>3e3&&S<6e3&&(M=40,y=2,b?_=x.size.z*2:_=g.size.x*2),S<=3e3&&(M=20,y=1,b?_=x.size.z*2:_=g.size.x*2),S<=1600&&(M=20,y=1,b?_=x.size.z*2:_=g.size.x*2,console.log("small room, screenspace small",_));let w=this.deepClone(n);console.log("roomsetarea",w);let P,T=M*.0254;C.toLowerCase()=="n"&&(w.startZ=w.startZ+_,w.depthZ=Math.abs(w.startZ-w.endZ),P="n",w.widthX-T*2<50&&(y=2),w.widthX-T*2<30&&(y=1),y==3&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-T-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.endZ=m.startZ+_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+T+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.endZ=m.startZ+_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.startX+x.size.x,h.endX=h.endX,h.endZ=h.startZ+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),console.log("avarea2 after north",d,"screennum",y),console.log("roomsetarea after north",w)),C.toLowerCase()=="s"&&(w.endZ=w.endZ-_,w.depthZ=Math.abs(w.startZ-w.endZ),P="s",console.log("room is south"),w.widthX-T*2<50&&(y=2),w.widthX-T*2<30&&(y=1),y==3&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-T-(d.widthX-2*T)/y*(y-2),d.startZ=d.endZ-_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.startZ=m.endZ-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.startX+x.size.x+T,h.endX=h.endX-T-(h.widthX-2*T)/y*(y-1),h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.startX+T+(d.widthX-2*T)/y*(y-2),d.endX=d.endX-(d.widthX-2*T)/y*(y-2),d.endZ=d.startZ+_,d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startX=m.startX+T+(m.widthX-2*T)/y*(y-1),m.endX=m.endX-T,m.startZ=m.endZ-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.startX+x.size.x,h.endX=h.endX,h.startZ=h.endZ-_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),C.toLowerCase()=="w"&&(w.startX=w.startX+_,w.widthX=Math.abs(w.startX-w.endX),P="e",w.depthZ-T*2<50&&(y=2),w.depthZ-T*2<30&&(y=1),y==3&&(m.endX=m.startX+_,m.startZ=m.startZ+x.size.x+T,m.endZ=m.endZ-T-(m.depthZ-2*T)/y*(y-1),m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ),d.endX=d.startX+_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),h.startZ=h.startZ+(h.depthZ-2*T)/y*(y-1),h.endZ=h.endZ-T,h.endX=h.startX+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),y==2&&(m.endX=m.startX+_,m.startZ=m.startZ+x.size.x+T,m.endZ=m.endZ-(m.depthZ-2*T)/y*(y-1),m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ),d.endX=d.startX+_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),h.startZ=h.startZ+T+(h.depthZ-2*T)/y*(y-1),h.endZ=h.endZ-T,h.endX=h.startX+_,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ)),y==1&&(h.endX=h.startX+_,h.startZ=h.startZ+x.size.x,h.endZ=h.endZ,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),C.toLowerCase()=="e"&&(w.endX=w.endX-_,w.widthX=Math.abs(w.startX-w.endX),P="w",w.depthZ-T*2<50&&(y=2),w.depthZ-T*2<30&&(y=1),y==3&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x+T,h.endZ=h.endZ-T-(h.depthZ-2*T)/y*(y-1),h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.endX-_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startZ=m.startZ+(m.depthZ-2*T)/y*(y-1),m.endZ=m.endZ-T,m.startX=m.endX-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==2&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x+T,h.endZ=h.endZ-(h.depthZ-2*T)/y*(y-1),h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ),d.startX=d.endX-_,d.startZ=d.startZ+T+(d.depthZ-2*T)/y*(y-2),d.endZ=d.endZ-T-(d.depthZ-2*T)/y*(y-2),d.widthX=Math.abs(d.endX-d.startX),d.depthZ=Math.abs(d.endZ-d.startZ),m.startZ=m.startZ+T+(m.depthZ-2*T)/y*(y-1),m.endZ=m.endZ-T,m.startX=m.endX-_,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),y==1&&(h.startX=h.endX-_,h.startZ=h.startZ+x.size.x,h.endZ=h.endZ,h.widthX=Math.abs(h.endX-h.startX),h.depthZ=Math.abs(h.endZ-h.startZ))),this.maxSetArray=[],console.log("adding diagrams theater av, roomserper",M);let F=this.setTemplates.find(B=>B.diagramType===t);return this.findGltfObj(t),F.gltfObj=this.gltfUrl,console.log("dyno av set obj",F.gltfObj,t),r.setTemplate&&r.setTemplate[t]&&(F.aisleHor=r.setTemplate[t].aisleHor,F.aisleVert=r.setTemplate[t].aisleVert,F.objSpaceHori=r.setTemplate[t].objSpaceHori,F.objSpaceVert=r.setTemplate[t].objSpaceVert,F.objPerBlockHori=r.setTemplate[t].objPerBlockHori,F.objPerBlockVert=r.setTemplate[t].objPerBlockVert,F.serPer=r.setTemplate[t].serPer,console.log("room ser per",r.setTemplate[t].serPer,M),(r.setTemplate[t].serPer!=null||r.setTemplate[t].serPer!=null)&&(M=r.setTemplate[t].serPer),console.log("room ser per",r.setTemplate[t].serPer,M)),await this.setTemplate(F.gltfObj,M,F.aisleHor,F.aisleVert,F.objSpaceHori,F.objSpaceVert,F.objPerBlockHori,F.objPerBlockVert),console.log("avarea2 placing screens",d,"screennum",y),y==1&&await this.placeStageScreen(r,e,`${t}`,3,2,b,"center",h,v,P,!0),y==2&&(await this.placeStageScreen(r,e,`${t}`,3,2,b,"left",h,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"right",m,v,P,!0)),y==3&&(await this.placeStageScreen(r,e,`${t}`,3,2,b,"left",h,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"center",d,v,P,!0),await this.placeStageScreen(r,e,`${t}`,3,2,b,"right",m,v,P,!0)),this.maxSetArray=await this.addDiagram(r,r.id,`${t}`,w,C,l,o),c&&(console.log("attempting whitefloor"),await this.addVisualFloor(n.startX,n.startZ,n.endX,n.endZ,!1,"0x00ff00",.5)),console.log("showing Dynamic set",f),l||(await this.showDynamicDiagramming(this.maxSetArray),await this.showBranding()),this.maxSetArray}},async returnDynoAVSets(r,e,t,n,i,s,a,o,l,c,u,f){const p=at();let g=[];this.diagramSet=[],this.maxSetArray=[];let x=!1;i?x=!0:window.confirm("Is Area box good?")||(i=await this.defineArea("0x00ff00",.7,30));let h=p.diagramObjects.find(m=>m.name==="screentripod"),d=o;if(console.log("return av set stage",d),x){let m=this.deepClone(i),v=this.deepClone(i);console.log("avarea2",v),this.deepClone(i);let y=this.deepClone(i),_,S,M=i.widthX*i.depthZ*10.76391042,C,b=s??prompt("Please enter the direction of the area (N, S, E, W)","N").toUpperCase(),w=a??window.confirm("Is the Ceiling Tall? Confirm to use Risers, cancel to skip risers.");this.screenBranding=[],M>6e3&&(C=60,_=3,w?S=d.size.z*2:S=h.size.x*2),M>3e3&&M<6e3&&(C=40,_=2,w?S=d.size.z*2:S=h.size.x*2),M<=3e3&&(C=20,_=1,w?S=d.size.z*2:S=h.size.x*2),M<=1600&&(C=20,_=1,w?S=d.size.z*2:S=h.size.x*2,console.log("small room, screenspace small",S));let P=this.deepClone(i);console.log("roomsetarea",P);let T,F=C*.0254;b.toLowerCase()=="n"&&(P.startZ=P.startZ+d.size.x,P.depthZ=Math.abs(P.startZ-P.endZ),T="n",P.widthX-F*2
3283<50&&(_=2),P.widthX-F*2<30&&(_=1),m.startX=m.startX,m.endZ=m.startZ+d.size.x,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ),console.log("avarea2 after north",v,"screennum",_),console.log("roomsetarea after north",P)),b.toLowerCase()=="s"&&(P.endZ=P.endZ-d.size.x,P.depthZ=Math.abs(P.startZ-P.endZ),T="s",console.log("room is south"),P.widthX-F*2<50&&(_=2),P.widthX-F*2<30&&(_=1),m.startX=m.startX,m.endX=m.endX,m.startZ=m.endZ-d.size.x,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),b.toLowerCase()=="w"&&(P.startX=P.startX+d.size.x,P.widthX=Math.abs(P.startX-P.endX),T="e",P.depthZ-F*2<50&&(_=2),P.depthZ-F*2<30&&(_=1),m.endX=m.startX+d.size.x,m.startZ=m.startZ,m.endZ=m.endZ,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),b.toLowerCase()=="e"&&(P.endX=P.endX-d.size.x,P.widthX=Math.abs(P.startX-P.endX),T="w",P.depthZ-F*2<50&&(_=2),P.depthZ-F*2<30&&(_=1),m.startX=m.endX-d.size.x,m.startZ=m.startZ,m.endZ=m.endZ,m.widthX=Math.abs(m.endX-m.startX),m.depthZ=Math.abs(m.endZ-m.startZ)),this.maxSetArray=[],console.log("adding diagrams theater av, roomserper",C);let B=this.setTemplates.find(R=>R.diagramType===t);return this.findGltfObj(t),B.gltfObj=this.gltfUrl,console.log("dyno av set obj",B.gltfObj,t),r.setTemplate&&r.setTemplate[t]&&(B.aisleHor=r.setTemplate[t].aisleHor,B.aisleVert=r.setTemplate[t].aisleVert,B.objSpaceHori=r.setTemplate[t].objSpaceHori,B.objSpaceVert=r.setTemplate[t].objSpaceVert,B.objPerBlockHori=r.setTemplate[t].objPerBlockHori,B.objPerBlockVert=r.setTemplate[t].objPerBlockVert,B.serPer=r.setTemplate[t].serPer,console.log("room ser per",r.setTemplate[t].serPer,C),(r.setTemplate[t].serPer!=null||r.setTemplate[t].serPer!=null)&&(C=r.setTemplate[t].serPer),console.log("room ser per",r.setTemplate[t].serPer,C)),n?await this.setTemplate(B.gltfObj,n.roomSerPer,n.aisleHor,n.aisleVert,n.objSpaceHori,n.objSpaceVert,n.objPerBlockHori,n.objPerBlockVert):await this.setTemplate(B.gltfObj,C,B.aisleHor,B.aisleVert,B.objSpaceHori,B.objSpaceVert,B.objPerBlockHori,B.objPerBlockVert),console.log("avarea2 placing screens",v,"screennum",_),this.maxSetArray=await this.addDiagram(r,r.id,`${t}`,P,b,u,c,y),await this.placeStageScreen2(r,e,`${t}`,3,2,w,"center",m,y,T,!0,o),f&&(console.log("attempting whitefloor"),await this.addVisualFloor(i.startX,i.startZ,i.endX,i.endZ,!1,"0x00ff00",.5)),console.log("showing Dynamic set",g),u||(await this.showDynamicDiagramming(this.maxSetArray),await this.showBranding()),this.maxSetArray}},async returnMaxSet(r,e,t,n,i,s,a,o,l){at();let c=[];this.diagramSet=[],this.maxSetArray=[];let u=n.widthX*n.depthZ*10.76391042;u>6e3&&(a=60),u>3e3&&u<6e3&&(a=40),u<=3e3&&(a=20);let f=this.setTemplates.find(p=>p.diagramType===e);return r.setTemplate&&r.setTemplate[e]&&(f.aisleHor=r.setTemplate[e].aisleHor,f.aisleVert=r.setTemplate[e].aisleVert,f.objSpaceHori=r.setTemplate[e].objSpaceHori,f.objSpaceVert=r.setTemplate[e].objSpaceVert,f.objPerBlockHori=r.setTemplate[e].objPerBlockHori,f.objPerBlockVert=r.setTemplate[e].objPerBlockVert,f.serPer=r.setTemplate[e].serPer,console.log("room ser per",r.setTemplate[e].serPer,a),(r.setTemplate[e].serPer!=null||r.setTemplate[e].serPer!=null)&&(a=r.setTemplate[e].serPer),console.log("room ser per",r.setTemplate[e].serPer,a)),this.findGltfObj(e),f.gltfObj=this.gltfUrl,t?(console.log("custom template",t),await this.setTemplate(f.gltfObj,t.roomSerPer,t.aisleHor,t.aisleVert,t.objSpaceHori,t.objSpaceVert,t.objPerBlockHori,t.objPerBlockVert)):(console.log("no custom template"),await this.setTemplate(f.gltfObj,a,f.aisleHor,f.aisleVert,f.objSpaceHori,f.objSpaceVert,f.objPerBlockHori,f.objPerBlockVert)),console.log("debug GLTF",this.gltfUrl),c=await this.addDiagram(r,r.id,`${e}`,n,i,!0,o),console.log("showing Dynamic set",c),l||await this.showDynamicDiagramming(c),this.maxSetArray},async updateMaxSetSeats2(r,e,t,n,i){const s=at();r.maxCapacities||(r.maxCapacities={}),r.maxCapacities[t]||(r.maxCapacities[t]=[]);let a=0;for(let l=0;l<i.length;l++)a+=i[l].seats;const o=r.maxCapacities[t].findIndex(l=>l.id===`${t}${n}`);o!==-1?r.maxCapacities[t][o].seats=a:r.maxCapacities[t].push({id:`${t}${n}`,seats:a}),console.log("Updated maxCapacities:",r.maxCapacities,r.maxCapacities[t]),await s.updateField(e,"maxCapacities",r.maxCapacities)},async placeStageScreen2(r,e,t,n,i,s,a,o,l,c,u,f){const p=at();let g=f,x=o;x.quat||(x.quat={x:0,y:0,z:0,w:1}),console.log("area",x);let h=c;console.log("screenside",a),x.direction=h,console.log("area",x),console.log("add diagram",r,e,t);let d=Ct();this.diagramSet=[],this.maxSetArray||(this.maxSetArray=[]),this.maxSetArray?this.diagramSet=this.maxSetArray:this.diagramSet=[];let m=x.startX,v=x.startZ,y=x.startY;this.yRotation*(Math.PI/180);let _=x.widthX,S=x.depthZ,M=Ct(),C,b,w;p.diagramObjects.find(O=>O.name==="screentripod");let P,T;function F(O,N){return{w:O.w*N.w-O.x*N.x-O.y*N.y-O.z*N.z,x:O.w*N.x+O.x*N.w+O.y*N.z-O.z*N.y,y:O.w*N.y-O.x*N.z+O.y*N.w+O.z*N.x,z:O.w*N.z+O.x*N.y-O.y*N.x+O.z*N.w}}function B(O,N){let{x:re,y:ee,z:le,w:me}
3283=N,{x:he,y:H,z:Ae}=O,k=me*he+ee*Ae-le*H,Y=me*H+le*he-re*Ae,oe=me*Ae+re*H-ee*he,we=-re*he-ee*H-le*Ae;return{x:k*me+we*-re+Y*-le-oe*-ee,y:Y*me+we*-ee+oe*-re-k*-le,z:oe*me+we*-le+k*-ee-Y*-re}}function R(O,N,re){let ee={x:O.x-N.x,y:O.y-N.y,z:O.z-N.z},le=B(ee,re);return{x:le.x+N.x,y:le.y+N.y,z:le.z+N.z}}let U={x:l.startX+l.widthX/2,y:0,z:l.startZ+l.depthZ/2},q={x:(x.startX+x.endX)/2,y,z:(x.startZ+x.endZ)/2};switch(q=R(q,U,x.quat),x.direction.toLowerCase()){case"n":C=new De().setFromAxisAngle(new A(0,1,0),-Math.PI/2),g.size.z,g.size.x;break;case"s":C=new De().setFromAxisAngle(new A(0,1,0),Math.PI/2),g.size.z,g.size.x,P=m-g.size.z/2+g.size.z*b/2,T=v-g.size.x/2+g.size.x*w/2,T-g.size.x/2+g.size.x*w/2;break;case"e":C=new De().setFromAxisAngle(new A(0,1,0),0),new De().setFromAxisAngle(new A(0,1,0),0),g.size.x,g.size.z,P=m-g.size.x/2+g.size.x*b/2,T=v-g.size.z/2+g.size.z*w/2,P+g.size.x/2-g.size.x*b/2+.25;break;case"w":C=new De().setFromAxisAngle(new A(0,1,0),Math.PI),new De().setFromAxisAngle(new A(0,1,0),Math.PI),g.size.x,g.size.z,P=m-g.size.x/2+g.size.x*b/2,T=v-g.size.z/2+g.size.z*w/2,P+g.size.x/2+g.size.x*b/2;break}console.log("positions","initialX",m,"initialZ",v,"stageNumEleWidth","stageNumEleDepth","templateWidth","templateDepth",b,w,_,S);let J=C;J=F(x.quat,J);let X={position:{x:q.x,y,z:q.z},scale:{x:1,y:1,z:1},quaternion:{x:J.x,y:J.y,z:J.z,w:J.w},size:{x:f.size.x,y:f.size.y,z:f.size.z},boundingBox:!1,url:g.url,seats:g.seats,materialColor:"white",diagramID:M,...f.brandPos&&f.brandPos.length>0&&{brandPos:[...f.brandPos]}};this.diagramSet.push(X),X={};try{this.maxSetArray=this.diagramSet,console.log("New wall params added:",d,this.diagramSet,this.maxSetArray),console.log("New wall params added:",this.diagramSet)}catch(O){console.error("Error in addWall function:",O)}this.maxSetArray=this.diagramSet,console.log("New wall params added:",d,this.diagramSet,this.maxSetArray),u?console.log("not showing diagrams created"):(showDiagramming(this.diagramSet),showDiagramming(this.diagramSet))}},getters:{}});let Co;const at=Ch("storeMain",{state:()=>({notes:[],notesOn:!1,selectedNote:null,selectedNoteID:null,isLoaded:!1,isExpanded:!1,envTestOn:!0,inputComponent:null,currentMode:"Ballrooms",currentMpMode:"",navPills:[],complex:[],wallsRequested:!1,subscriptions:[],vrsubscriptions:[],curatedBrandSub:[],custWallsSub:[],custVIPSub:[],debugLogger:!1,custBrandingSub:[],selectedPanoramaId:null,siteProStatus:{ver:"1.2.6"},siteProInfo:{menus:[],categoryFunctions:["event space","amenities","guest rooms","dining"],documents:[],navs:[],models:[],sources:[],hotelName:"",mapLink:"",plan:"",logoUrl:"",landingLogoUrl:"",mobileDiningNewTab:!1,mobileDiningLink:"",walls:[],hideHorDash:!1,hideVertDash:!0,hideSquareDash:!0},mpShiftKey:!1,mpCmdKey:!1,mpCtrlKey:!1,mpOptKey:!1,mpEscKey:!1,toolUITransform:"",mpViewWidth:"100vw",setLocBtnTransform:"translateX(-50%)",propSetObjects:[],diagramObjects:[{name:"screen",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkembassydfw.appspot.com/o/Selfwalk_AVScreen001_Asset.gltf?alt=media&token=f336105c-3950-4259-ae61-ff75fc6c588c",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:3.872053384780884,y:2.4487736225128174,z:.49463504552841187}},{name:"screentripod",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/screentripodtall.glb?alt=media&token=0e7a7794-5dcb-43e2-80b8-f5d8dcc3125e",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.712765,y:2.9939,z:3.34916}},{name:"stageModularBare",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkembassydfw.appspot.com/o/SelfWalk_StageModularBare_Asset.gltf?alt=media&token=27b9b34f-fc7d-48a0-a1e8-8b3fb86e12f3",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:1.025719404220581,y:.43433234095573425,z:1.025719404220581}},{name:"stage6ftx8ft",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/4curtainstage6ftx8ftx24in.glb?alt=media&token=d2bbc0fa-2b86-4e3d-8880-ebf0646c117e",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:1.8288,y:.6096,z:2.44}},{name:"stageModularCorner",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkembassydfw.appspot.com/o/SelfWalk_StageModularCorner_Asset.gltf?alt=media&token=3259ff8d-5889-4062-bfa5-7c340168cd11",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:1.0289713144302368,y:.43381664229673333,z:1.0288304090499878}},{name:"stageModularSteps",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkembassydfw.appspot.com/o/SelfWalk_StageModularSteps_Asset.gltf?alt=media&token=f3f66ac4-4475-412a-acd7-ed14d40f565a",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:1.6526615023612976,y:.45944638177752495,z:1.025
32837951021194458}},{name:"stageModularStraight",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkembassydfw.appspot.com/o/SelfWalk_StageModularStraight_Asset.gltf?alt=media&token=7d37c5d0-bbcd-43c7-8fb8-a94c29441813",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:1.0261502265930176,y:.4333933889865875,z:1}},{name:"grayChairLOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/setObjects%2Fchairjwtan.glb?alt=media&token=08e2fc8c-8f40-4477-bae4-02ec475327b2",loader:"",tableType:"theater",tableChairs:0,type:"",seats:1,size:{x:.608,y:.983,z:.506}},{name:"classroomtablexblend",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/tablefaceXblend.glb?alt=media&token=27810b52-87aa-4c24-86be-eccd361b8ab9",loader:"",tableType:"classroom",tableChairs:3,type:"",seats:0,size:{x:.457,y:.737,z:1.83}},{name:"conferencetablexblend",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/conferencetable.glb?alt=media&token=ccc79442-80c9-4bf9-999a-4ac3c981e6a5",loader:"",tableType:"conference",tableChairs:3,type:"",seats:0,size:{x:.762,y:.737,z:1.83}},{name:"ushape",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/conferencetable.glb?alt=media&token=ccc79442-80c9-4bf9-999a-4ac3c981e6a5",loader:"",tableType:"ushape",tableChairs:3,type:"",seats:0,size:{x:.762,y:.737,z:1.83}},{name:"hollowsquare",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek-dev.appspot.com/o/conferencetable.glb?alt=media&token=ccc79442-80c9-4bf9-999a-4ac3c981e6a5",loader:"",tableType:"hollowsquare",tableChairs:3,type:"",seats:0,size:{x:.762,y:.737,z:1.83}},{name:"roundsOf1LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"round",tableChairs:1,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"roundsOf2LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"round",tableChairs:2,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"roundsOf6LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"round",tableChairs:6,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"roundsOf8LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"round",tableChairs:8,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"roundsOf10LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"round",tableChairs:10,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"crescentOf6LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"crescent",tableChairs:6,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"crescentOf8LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"crescent",tableChairs:8,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"crescentOf10LOD2",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/updatedDiagramAssets%2Ftable6ft.gltf?alt=media&token=4a8cce37-67b6-4877-a8b4-592fb310f147",loader:"",tableType:"crescent",tableChairs:10,type:"",seats:0,size:{x:1.8288,y:.749,z:1.8288}},{name:"vip",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkwhiskeyrowdenver.appspot.com/o/scene%20(45).gltf?alt=media&token=94631dc1-d1f7-438f-8b24-46cdd7845986",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.831435889005661,y:1.0976417664205655,z:.8259616494178772}},{name:"tenftwall",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkwestinsouthfield.appspot.com/o/3d%2F12ftwall.gltf?alt=media&token=b207280d-f9c4-4ea7-b9c4-329ef3164c60",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.057543962149695815,y:3.8362639062528103,z:3.644450782058243}},{name:"cocktail",url:"https://firebasestorage.googleapis.com/v0/b/selfwalksigniabonnetcreek.appspot.com/o/diagramassets%2FSelfWalk_CocktailTable001_Asset%20(1).gltf?alt=media&token=16a33a2b-f86d-4d29-b2da-e908b5656
32837f1",loader:"",tableType:"round",tableChairs:0,type:"",seats:0,size:{x:.831435889005661,y:1.0976417664205655,z:.8259616494178772}},{name:"stage empty",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkrenaissancerichardson.appspot.com/o/stage_empty.gltf?alt=media&token=1f033e95-ce8f-4f0e-a3a9-46a380f9a30b",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.831435889005661,y:1.0976417664205655,z:.8259616494178772}},{name:"stage podium",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkrenaissancerichardson.appspot.com/o/stage_podium.gltf?alt=media&token=e1271111-9e78-41d7-9ec9-239867237ebd",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.831435889005661,y:1.0976417664205655,z:.8259616494178772}},{name:"stage screen",url:"https://firebasestorage.googleapis.com/v0/b/selfwalkrenaissancerichardson.appspot.com/o/stage_screen.gltf?alt=media&token=b5fbeccd-d2c3-454d-96bd-43780d2b4e57",loader:"",tableType:"",tableChairs:0,type:"",seats:0,size:{x:.831435889005661,y:1.0976417664205655,z:.8259616494178772}}],diagramCollection:[],isMobile:!1,isTablet:!1,isTabletOrMobile:!1,tabCount:0,showStartPanel:!1,showAdminPanel:!0,zoomLevel:1,selectedLocID:null,showMaxSetTool:!1,selectedMaxSetType:{},selectedMaxSetSpace:{},airWallOn:!1,tourState:"",currentSweep:"",oldSweep:"",brandOn:!1,tabIndex:0,submenuTab:1,started:!1,toEditSpace:{},centerSRC:"",sourceToolX:0,sourceToolY:2,sourceToolZ:0,sourceToolSizeX:10,sourceToolSizeY:4,sourceToolSizeZ:10,sourceToolOrientYaw:0,sourceToolOrientPitch:0,sourceToolOrientRoll:0,sourceTool:null,debugger:!1,mpSdk:null,modelView:0,containerClick:!1,showcaseClickCount:0,mpViewFrameSize:100,mpInteracting:!1,snapImgRef:null,screenShotUri:null,resolution:{width:600,height:800},visibility:{mattertags:!1,sweeps:!0},spaceInfo:[],spaceInfo2:[],proposalInfo:[],navLinks:[],toEmail:"[email protected]",selectedSpace:0,selectedComplex:0,currentBallroom:-1,currentSalon:-1,selectedModel:null,selectedCapacityType:"",spaceLink:"",m:null,start:null,oldSelect:0,contactFrame:"https://weselfwalk.com/contact",contactOn:!1,proposalOn:!1,helpOn:!1,adaOn:!1,isHighlighted:0,helpCookie:!1,hiddenWallSize:.1,tLNavOn:!1,isDialogVisible:!1,inputPassword:"",passwordResolve:null,tRNavOn:!1,tLInfoOn:!1,tRInfoOn:!1,docBoxOn:!1,docBoxMenu:!1,bRFrameOn:!1,bRNavOn:!1,cFrameOn:!1,landFrameOn:!1,tCInfoOn:!0,cInfoOn:!1,bRMenuOn:!1,mobileMenuOn:!1,photoFrameOn:!1,linkOn:!1,shareProposalOn:!1,shareProposalLink:"",currentLink:"",linkToShare:"",totalSessionSeats:0,pillIndex:0,docPillIndex:0,adminPillIndex:0,locMenuPillIndex:0,moreInfoOn:!1,fullScreenSrc:"",fullScreenImgOn:!1,docSelect:0,pdfSelect:"",mattertagId:null,toastMessage:null,toastVisible:!1,tagUrlMap:new Map,diagramTypes:[{label:"Exhibit 8 x 10",field:"exhibit",linkField:"exhibitLink",type:"exhibit"},{label:"Theater",field:"theater",linkField:"theaterLink",type:"theater"},{label:"Classroom",field:"classroom2per6",linkField:"classroom2per6Link",type:"classroom2per6"},{label:"Banquet",field:"banquet",linkField:"banquetLink",type:"banquet"},{label:"Hollow Square",field:"hollowSquare",linkField:"hollowSquareLink",type:"hollowSquare"},{label:"Rounds of 10",field:"rounds10",linkField:"rounds10Link",type:"rounds10"},{label:"Rounds of 6",field:"rounds6",linkField:"rounds6Link",type:"rounds6"},{label:"Conference",field:"conference",linkField:"conferenceLink",type:"conference"},{label:"U-shape",field:"uShape",linkField:"uShapeLink",type:"uShape"},{label:"Reception",field:"reception",linkField:"receptionLink",type:"reception"}],tLNav:[],tRNav:[],measureModeOn:!1,mode:"mode.floorplan",position:{x:.5,y:.5,z:0},rotation:{x:70,y:180},transition:"transition.instant",zoom:3,sessionSeatMap:{},uploadModelSize:null,showSiteProLogo:1,myObj:null,myObj2:null,brand1:null,brand2:null,brand3:null,brand4:null,brand5:null,brand6:null,brand7:null,brand8:null,car1:null,car2:null,wall:null,mainSceneObject:null,mainNode:null,wallsceneObject:null,airwallsceneObject:null,brandingSceneObject:null,curatedbrandingSceneObject:null,diagrammingSceneObject:null,modelUploadSceneObject:null,modelUploadSubs:[],myVRSceneObject:null,myVRNode:null,diagramtemplatenode:null,controlBoxNode:null,myBoxControl:null,vipSceneObject:null,areaobject:null,diagramtemplateobject:null,car3:null,vipareaobject:null,vipTagOn:!1,myObj3:null,myObj4:null,myControl
3283s:null,myControlsMode:0,myControlsModes:["translate","rotate","scale"],myMode:"",transformVis:!1,showWalls:!1,liveSiteProSweeps:[],sensor:null,vistaBase:!1,sources:[]}),actions:{async init(){this.isLoaded=!1;const r=Ge(Ie,"sitePro","info");Co=rt(Ie,"notesCollection"),pn(Co,In("date")),console.log("init");try{console.log("trying init sitepro");const e=await Wa(r);if(e.exists()){const t=e.data();if(this.siteProInfo={...this.siteProInfo,...t},this.siteProInfo.hotelName=t.hotelName,this.siteProInfo.documents=t.documents,this.siteProInfo.logoUrl=t.logoUrl,this.siteProInfo.landingLogoUrl=t.landingLogoUrl||"",this.siteProInfo.mobileDiningLink=t.mobileDiningLink||"",this.siteProInfo.mobileDiningNewTab=t.mobileDiningNewTab||"",this.siteProInfo.sources=t.sources,this.siteProInfo.models=t.models,this.siteProInfo.menus=t.menus,this.siteProInfo.categoryFunctions=["event space","amenities","guest rooms","dining"],this.siteProInfo.complex=t.complex||[],this.siteProInfo.subMenus=t.subMenus,this.siteProInfo.mainStart=t.mainStart,this.siteProInfo.mapLink=t.mapLink,this.siteProInfo.plan=t.plan,this.siteProInfo.pills=t.pills,this.siteProInfo.pillsProd=t.pillsProd,this.siteProInfo.docPills=t.docPills||[],this.siteProInfo.DocPillsProd=t.docPillsProd||[],console.log("init venue",this.siteProInfo.venueType),this.siteProInfo.complex&&this.siteProInfo.complex.length>0&&console.log("init firestore reading spaces",this.siteProInfo.complex,this.siteProInfo.complex.length),await this.readAllData(),this.toEmail=t.hotelLeadEmail,console.log("spaceInfo",this.spaceInfo),console.log("propSetObjects",this.propSetObjects),this.navLinks=this.navLinks||[],this.m===null||this.m==null||this.m==""||this.start===null||this.start==null||this.start==""){if(this.siteProInfo.complex&&this.siteProInfo.complex.length>0){console.log("init complex1",this.siteProInfo.complex,this.siteProInfo.complex.length),console.log("init currentDomain before");const o=window.location.hostname;console.log("init currentDomain after",o);const l=this.siteProInfo.complex.findIndex(c=>o.includes(c.webdomain));console.log("init selindex",l),l!==-1?console.log("Selected1 complex index:",l,this.siteProInfo.complex[l]):console.log("No complex matches the current domain"),this.selectedComplex=l,o.includes("localhost")&&(console.log("localhost detected"),this.selectedComplex=0),console.log("init main fallbackM",this.siteProInfo.complex[this.selectedComplex].mainStart),this.siteProInfo.complex[this.selectedComplex].mainStart&&this.siteProInfo.complex[this.selectedComplex].mainStart.space?this.m=this.siteProInfo.complex[this.selectedComplex].mainStart.space:this.m=t.fallbackM,this.siteProInfo.complex[this.selectedComplex].mainStart&&this.siteProInfo.complex[this.selectedComplex].mainStart.spaceStart?this.start=this.siteProInfo.complex[this.selectedComplex].mainStart.spaceStart:this.start=t.fallbackStart,this.selectedModel=this.m,document.title=this.siteProInfo.complex[this.selectedComplex].hotelName}else console.log("Selected no complex :",this.siteProInfo.mainStart),this.m=t.fallbackM,console.log("fallbackM",this.m,t.fallbackM,this.siteProInfo.mainStart.space),this.selectedModel=this.m,this.start=t.fallbackStart;console.log("init is moving space")}const n=new Map;this.spaceInfo.forEach(o=>{n.has(o.categoryName)||n.set(o.categoryName,[]),n.get(o.categoryName).push(o)});const i=[],s=[];[...this.siteProInfo.menus].sort((o,l)=>o.order-l.order).forEach(o=>{n.has(o.name)&&(s.push(o),i.push(n.get(o.name)))}),this.navLinks=i,this.siteProInfo.menus=s}else console.log("SitePro Info document created and fields set!");return await this.checkStatus(),console.log("loaded?",this.isLoaded),this.isLoaded=!0,console.log("loaded?",this.isLoaded),this.siteProInfo}catch(e){console.log("Error initializing:",e)}},async checkStatus(){const r=Ge(Ie,"status","version");try{console.log("getting site status");const e=await Wa(r);let t="1.2.6";if(!Ge.exists)console.log("status doc does not exists, creating now"),await jt(r,{ver:t}),this.siteProStatus.ver=t;else{const n=Ge.data();this.siteProStatus.ver=n.ver,this.siteProStatus.ver!==t&&(this.siteProStatus.ver=t,await At(r,{ver:t}))}return console.log("siteProStatus",this.siteProStatus),this.siteProStatus}catch(e){console.log("Error initializing stats",e)}}
3283,async convertSpacesToDocs(){console.log("converting spaces to docs");const r=rt(Ie,"spaces"),e=this.spaceInfo2.map(async(t,n)=>{try{const i={...t,createdAt:Qt()},s=await xr(r,i);return await At(Ge(Ie,"spaces",s.id),{id:s.id}),s.id}catch(i){return console.error("Error adding document: ",i),null}});return Promise.all(e)},async addSand(r){const e=this.tagUrlMap.get(r);try{const[t,n]=await this.mpSdk.Tag.registerSandbox(tf(r,e));console.log("tag and sand",r,t,n),await this.mpSdk.Tag.attach(r,t),n.on("buttonClick",i=>{const s=this.tagUrlMap.get(i);window.open(s,"_blank"),console.log("clicked button with id:",i),console.log("cvent3dUrl:",s)})}catch(t){console.error("Error in addSand:",t)}},async addTagToSpace(r){let e=[];if(r.cvent3d&&r.maxSetArea&&this.showSiteProLogo==0){let t=r.maxSetArea;console.log("add tag to scene",t,this.spaceInfo);let n={title:"My Mattertag",description:"",anchorPosition:{x:t.startX+t.widthX/2,y:0,z:t.startZ+t.depthZ/2},stemVector:{x:0,y:1.3,z:0},stemHeight:1.5,color:{r:.15,g:.58,b:1}},i;this.mpSdk.Tag.add(n).then(s=>{console.log("Mattertag added with SID:",s),i=s[0],console.log("tagsToRemove:",e),console.log("tag added,",i,r.cvent3d),this.tagUrlMap.set(i,r.cvent3d),this.addSand(i)}).catch(s=>{console.error("Error adding Mattertag:",s)})}},async readAllData(){try{console.log("Fetching spaces...");const r=this.readSpacesFromFire();console.log("Fetching walls...");const e=this.readWallsFromFire();console.log("Fetching branding...");const t=this.readBrandingFromFire();console.log("Fetching diagramming...");const n=this.readDiagrammingFromFire(),i=this.readPropSetObjectsFromFire();console.log("Fetching curatedbranding..."),await Promise.all([r,e,t,n,i]),console.log("All data loaded")}catch(r){console.error("Error fetching data:",r)}},async readSpacesFromFire(){const r=rt(Ie,"spaces"),e=pn(r,In("createdAt","asc")),n=(await Nt(e)).docs.map(i=>i.data());return this.spaceInfo=n,console.log("spaceinfo",this.spaceInfo[4]),this.spaceInfo},async readProposalsFromFire(){const r=rt(Ie,"curated"),e=pn(r,In("createdAt","desc")),n=(await Nt(e)).docs.map(i=>({id:i.id,...i.data()}));return this.proposalInfo=n,console.log("proposalinfo",this.proposalInfo),this.proposalInfo},async convertWallsToDocs(){console.log("converting wallss to docs");const r=rt(Ie,"walls"),e=this.siteProInfo.walls.map(async(t,n)=>{try{const i={...t,createdAt:Qt()},s=await xr(r,i);return await At(Ge(Ie,"walls",s.id),{id:s.id}),s.id}catch(i){return console.error("Error adding document: ",i),null}});return Promise.all(e)},async readWallsFromFire(){const r=rt(Ie,"walls"),e=pn(r,In("createdAt","asc")),n=(await Nt(e)).docs.map(i=>i.data());return this.siteProInfo.walls=n,console.log("walls1",this.siteProInfo.walls[4]),this.siteProInfo.walls},async updateCategoryNames(){try{const r=rt(Ie,"spaces");(await Nt(r)).forEach(async t=>{const n=t.data(),{category:i,categoryName:s,categoryIcon:a}=n;if(!s){const o=Ge(Ie,"spaces",t.id);await At(o,{categoryName:i}),console.log(`Updated categoryName for space ${t.id}`)}if(!a){const o=Ge(Ie,"spaces",t.id);await At(o,{categoryIcon:i}),console.log(`Updated categoryIcon for space ${t.id}`)}}),console.log("Category updates complete.")}catch(r){console.error("Error updating categories:",r)}},async readBrandingFromFire(){const r=rt(Ie,"branding"),e=pn(r,In("createdAt","asc")),n=(await Nt(e)).docs.map(i=>i.data());return this.siteProInfo.branding=n,console.log("branding",this.siteProInfo.branding[4]),this.siteProInfo.branding},async readDiagrammingFromFire(){const r=rt(Ie,"diagramming"),e=pn(r,In("createdAt","asc")),n=(await Nt(e)).docs.map(i=>i.data());return this.siteProInfo.diagramming=n,console.log("diagramming",this.siteProInfo.diagramming[4]),this.siteProInfo.diagramming},async readPropSetObjectsFromFire(){const r=rt(Ie,"setObjects"),e=pn(r),n=(await Nt(e)).docs.map(i=>i.data());return this.propSetObjects=n,console.log("propSetObjects",this.propSetObjects),this.propSetObjects},async readCuratedProposalFromFire(r){const e=Ge(Ie,"curated",r),n=(await Wa(e)).data();return this.siteProInfo.curatedProposal=n,console.log("curated proposal",this.siteProInfo.curatedProposal),this.siteProInfo.curatedProposal},async readCuratedBrandingFromFire(r){const e=rt(Ie,"curated",r,"branding"),t=pn(e,In("createdAt","asc")),i=(await Nt(t)).docs.map(s=>s.data());return this.siteProInfo.curatedBranding=i,console.log("curated",this.siteProInfo.curatedBranding[4]),this.siteProInfo.curatedBranding},async readCuratedDiagrammingFromFire(r){console.log("sessions init",this.siteProInfo.curatedProposal.sessions);let e=[];
3283if(this.siteProInfo.curatedProposal.sessions)for(let t=0;t<this.siteProInfo.curatedProposal.sessions.length;t++){let n=await this.retrieveSessionSet(r,this.siteProInfo.curatedProposal.sessions[t].id);console.log("sets",n,r);for(let i=0;i<n.length;i++)e.push(n[i])}return this.siteProInfo.curatedDiagramming=e,console.log("curated",this.siteProInfo.curatedDiagramming[4]),this.siteProInfo.curatedDiagramming},async readVIPFromFire(){const r=rt(Ie,"vip"),e=pn(r,In("createdAt","asc")),n=(await Nt(e)).docs.map(i=>i.data());return this.siteProInfo.vip=n,console.log("curated",this.siteProInfo.vip[4]),this.siteProInfo.vip},async promptForPassword(){return new Promise(r=>{this.passwordResolve=r,this.isDialogVisible=!0})},submitPassword(){this.inputPassword&&(this.passwordResolve(this.inputPassword),this.isDialogVisible=!1,this.inputPassword="")},async addLocation(){let r={capacities:{},spaceStart:"",space:"",name:"",info:"",moreInfo:"",amenities:"",menuLink:"",roomFactLink:"",ctaText:"",ctaLink:"",ctaNewTab:!1,ctaEmail:"",category:"",complex:"",subCategory:"",sourceBox:[]};const e=rt(Ie,"spaces"),t=Ge(e),n={...r,createdAt:Qt()};try{await jt(t,n),await At(Ge(Ie,"spaces",t.id),{id:t.id}),console.log("Document written with ID: ",t.id)}catch(i){console.error("Error adding document: ",i)}},async addWall(r){const e=rt(Ie,"walls"),t=Ge(e),n={...r,createdAt:Qt()};try{await jt(t,n),await At(Ge(Ie,"walls",t.id),{id:t.id}),console.log("Document written with ID: ",t.id)}catch(i){console.error("Error adding document: ",i)}},async removeWall(r){const e=Ge(Ie,"walls",r);await Ln(e)},async removeProposal(r){const e=Ge(Ie,"curated",r);await Ln(e)},async createDocumentAndCopyBranding(r,e){try{await jt(r,e),console.log("Document successfully created"),await this.copyBrandingCollection(r)}catch(t){console.error("Error creating document and copying Branding: ",t)}},async copyBrandingCollection(r){let e=rt(Ie,"curated","DEFAULT","branding");
3283try{(await Nt(e)).forEach(async n=>{const i=`${r.path}/branding/${n.id}`,s=Ge(Ie,i);await jt(s,n.data())}),console.log("Branding collection successfully copied")}catch(t){console.error("Error copying Branding collection: ",t)}},async addBrand(r){const e=rt(Ie,"branding"),t=Ge(e),n={...r,createdAt:Qt()};try{await jt(t,n),await At(Ge(Ie,"branding",t.id),{id:t.id}),console.log("Document written with ID: ",t.id)}catch(i){console.error("Error adding document: ",i)}},async removeBrand(r){const e=Ge(Ie,"branding",r);await Ln(e)},async addDiagram(r){const e=rt(Ie,"diagramming"),t=Ge(e),n={...r,createdAt:Qt()};try{await jt(t,n),await At(Ge(Ie,"diagramming",t.id),{id:t.id}),console.log("Document written with ID: ",t.id)}catch(i){console.error("Error adding document: ",i)}},async removeDiagram(r){const e=Ge(Ie,"diagramming",r);await Ln(e)},async updateMaxSet(r,e,t){const n=[],i=rt(Ie,"spaces",e,t);(await Nt(i)).forEach(o=>{n.push(o.id)}),console.log("old objects",n,"current setObjects",e,t,r);const a=yr(Ie);for(let o=0;o<r.length;o+=250){const c={chunkData:r.slice(o,o+250),createdAt:Qt()},u=Ge(i);a.set(u,c)}await a.commit().then(async()=>{console.log("Batch committed successfully. Proceeding with deletion of old documents.");const o=yr(Ie);n.forEach(l=>{const c=Ge(Ie,"spaces",e,t,l);o.delete(c)}),await o.commit().then(()=>{console.log("All old documents deleted successfully!")}).catch(l=>{console.error("Error deleting old documents: ",l)})}).catch(o=>{console.error("Error committing batch for new documents:",o)})},async retrieveMaxSet(r,e){const t=[],n=rt(Ie,"spaces",r,e);try{return(await Nt(n)).forEach(s=>{const a=s.data().chunkData;a&&t.push(...a)}),console.log("Combined set objects:",t),t}catch(i){return console.error("Error retrieving documents: ",i),[]}},async updateSessionSet(r,e,t){const n=[],i=rt(Ie,"curated",e,t);(await Nt(i)).forEach(o=>{n.push(o.id)}),console.log("old objects",n,"current setObjects",e,t,r);const a=yr(Ie);for(let o=0;o<r.length;o+=250){const c={chunkData:r.slice(o,o+250),createdAt:Qt()},u=Ge(i);a.set(u,c)}await a.commit().then(async()=>{console.log("Batch committed successfully. Proceeding with deletion of old documents.");const o=yr(Ie);n.forEach(l=>{const c=Ge(Ie,"curated",e,t,l);o.delete(c)}),await o.commit().then(()=>{console.log("All old documents deleted successfully!")}).catch(l=>{console.error("Error deleting old documents: ",l)})}).catch(o=>{console.error("Error committing batch for new documents:",o)})},async retrieveSessionSet(r,e){const t=[],n=rt(Ie,"curated",r,e);try{return(await Nt(n)).forEach(s=>{const a=s.data().chunkData;a&&t.push(...a)}),console.log("Combined set objects:",t),t}catch(i){return console.error("Error retrieving documents: ",i),[]}},async addCuratedBrand(r,e){const t=rt(Ie,"curated",e,"branding"),n=Ge(t),i={...r,createdAt:Qt()};try{await jt(n,i),await At(n,{id:n.id}),console.log("Document written with ID: ",n.id)}catch(s){console.error("Error adding document: ",s)}},async removeCuratedBrand(r,e){const t=Ge(Ie,"curated",e,"branding",r);await Ln(t)},async addCuratedDiagram(r,e){const t=rt(Ie,"curated",e,"diagramming"),n=Ge(t),i={...r,createdAt:Qt()};try{await jt(n,i),await At(n,{id:n.id}),console.log("Document written with ID: ",n.id)}catch(s){console.error("Error adding document: ",s)}},async removeCuratedDiagram(r,e){const t=Ge(Ie,"curated",e,"diagramming",r);await Ln(t)},async addVIP(r){const e=rt(Ie,"vip"),t=Ge(e),n={...r,createdAt:Qt()};try{await jt(t,n),await At(t,{id:t.id}),console.log("Document written with ID: ",t.id)}catch(i){console.error("Error adding document: ",i)}},async removeVIP(r){const e=Ge(Ie,"vip",r);await Ln(e)},async removeLocation(r){const e=Ge(Ie,"spaces",r);await Ln(e)},async moveToPos(r,e){this.mpSdk.Sweep.moveTo(r,{rotation:e,transition:this.mpSdk.Sweep.Transition.FLY})},screenGrab(){this.mpSdk.Renderer.takeScreenShot().then(function(r){this.snapImgRef=r,console.log("2nd")})},async getSweep(){this.mpSdk.Camera.getPose().then(function(r){console.log("Current position is ",r.position),console.log(",rotation:",r.rotation," ,sweep:",r.sweep)})}
3283,async makeLink(r=null){const e=vb(),t=at();let i=(await this.mpSdk.Link.createDeepLink()).replace("/bundle/showcase.html",window.location.pathname);if(i=i.replace("&applicationKey=7aiqs9hi5htirg5st5gceq3yb",""),i=i.replace("&play=1&tour=0&measurements=0&vr=0>=0&search=0&title=0&qs=1&log=0",""),e.setRequested&&(i=`${i}&ds=${e.setRequested}`),t.currentMode==="Salons"&&(t.wallsRequested=!0,i=`${i}&walls=${t.wallsRequested}`,t.wallsRequested=!1),r==="1"){const s=i.includes("?")?"&":"?";i=`${i}${s}lvid=1`}console.log("link is: ",i),this.linkToShare=i},showToast(r,e){this.toastMessage=r,this.toastVisible=!0,this.toastColor=e,setTimeout(()=>{this.toastVisible=!1,this.toastMessage="",this.toastColor="#04a72f"},3e3)},async makeLocation(r){let e,t,i=(await this.mpSdk.Link.createDeepLink()).replace("/bundle/showcase.html","/");console.log("modelLink is:",i);const s=new URL(i),a=s.searchParams.get("m"),o=s.searchParams.get("sr")?`&sr=${s.searchParams.get("sr")}&ss=${s.searchParams.get("ss")}`:"";i=i.replace("&play=1&tour=0&measurements=0&vr=0>=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",""),await this.mpSdk.Camera.getPose().then(function(c){e=c.rotation,t=c.sweep});let l=this.zoomLevel;console.log("Current zoom is ",l),console.log("spacesweep",t),console.log("updating space:",r,o,a,t,e),await this.updateMultiFields(r,{spaceStart:o,space:a,sweep2:t,rotation:{x:e.x,y:e.y},zoomLevel:l}),this.showStartPanel=!1},async makeLocation2(r){let e,t,i=(await this.mpSdk.Link.createDeepLink()).replace("/bundle/showcase.html","/");console.log("modelLink is:",i);const s=new URL(i),a=s.searchParams.get("m"),o=s.searchParams.get("sr")?`&sr=${s.searchParams.get("sr")}&ss=${s.searchParams.get("ss")}`:"";i=i.replace("&play=1&tour=0&measurements=0&vr=0>=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",""),await this.mpSdk.Camera.getPose().then(function(c){e=c.rotation,t=c.sweep});let l=this.zoomLevel;console.log("Current zoom is ",l),console.log("spacesweep",t),console.log("updating space:",r,o,a,t,e),await this.updateMultiFields(r,{spaceStart:o,space:a,sweep2:t,rotation:{x:e.x,y:e.y},zoomLevel:l}),this.showStartPanel=!1},navToSpot(){let r=this.spaceInfo[this.oldSelect].space,e=this.spaceInfo[this.selectedSpace].space;this.selectedModel=this.spaceInfo[this.selectedSpace].space,r==e?(this.moveToPos(this.spaceInfo[this.selectedSpace].sweep2,this.spaceInfo[this.selectedSpace].rotation),console.log("same space...moving")):(document.getElementById("showcase").src="/bundle/showcase.html?m="+this.spaceInfo[this.selectedSpace].space+this.spaceInfo[this.selectedSpace].spaceStart+"&play=1&measurements=0&vr=0>=0&tour=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",console.log("diff space...setting src"),console.log(document.getElementById("showcase").src)),this.oldSelect=this.selectedSpace},navBySpaceStart(){this.spaceInfo[this.oldSelect].space,this.spaceInfo[this.selectedSpace].space,this.selectedModel=this.spaceInfo[this.selectedSpace].space,document.getElementById("showcase").src="/bundle/showcase.html?m="+this.spaceInfo[this.selectedSpace].space+this.spaceInfo[this.selectedSpace].spaceStart+"&play=1&measurements=0&vr=0>=0&tour=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",console.log("diff space...setting src"),console.log(document.getElementById("showcase").src),this.oldSelect=this.selectedSpace},navToMPLink(r){console.log(r),r=r.replace("https://my.matterport.com/show/?m=","/bundle/showcase.html?m="),console.log(r),document.getElementById("showcase").src=r+"&play=1&measurements=0&vr=0>=0&tour=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",console.log("diff space...setting src")},measureMode(){try{this.measureModeOn=!this.measureModeOn,console.log("firing toggle");try{this.mpSdk.Measurements.toggleMode(this.measureModeOn)}catch(t){console.error("Error with toggleMode:",t)}var r=document.getElementById("showcase");if(!r){console.error('Unable to find iframe with ID "showcase"');return}var e=r.contentWindow.document.querySelector("#gui");if(!e){console.error("Unable to find GUI element inside iframe");return}e.style.height="80%",e.style.top="10%"}catch(t){console.error("An error occurred:",t.message)}finally{console.log("toggle fired")}},mPMode(r){this.mpSdk.Mode.moveTo(r).then(function(e){console.log("Arrived at new view mode "+e)}).catch(function(e){})},async addCuratedNote(r,e,t,n){let i=rt(Ie,"curated",t,"notes"),s=new Date().getTime(),a=s.toString(),o=new Date(s).toLocaleDateString();new Date(s).toLocaleTimeString(),console.log("note date is:",o);let l={tag:r,id:"",tagPose:n||"",address:"",comments:[],initialNote:e||"",selectedModel:this.selectedModel,selectedSpace:this.spaceInfo[this.selectedSpace].id,resolved:!1},c={date:a,id:"",noteContent:l};this.notes.push(c);try{const u=await xr(i,{});c.id=u.id,c.noteContent.id=u.id,await jt(u,c),this.setSelectedNote(c.id
3283),console.log("new note added",c.id);let f=JSON.parse(localStorage.getItem("noteIds"))||[];return f.push(u.id),localStorage.setItem("noteIds",JSON.stringify(f)),c="",u.id}catch(u){console.log(u)}},async addNote(r,e){let t=new Date().getTime(),n=t.toString(),i=new Date(t).toLocaleDateString();new Date(t).toLocaleTimeString(),console.log("note date is:",i);let a={date:n,id:"",noteContent:{tag:r,id:"",address:"",comments:[],initialNote:e||""}};this.notes.push(a),await xr(Co,{}).then(o=>{a.id=o.id,a.noteContent.id=o.id,jt(o,a),this.setSelectedNote(a.id),console.log("new note added",a.id);let l=JSON.parse(localStorage.getItem("noteIds"))||[];l.push(o.id),localStorage.setItem("noteIds",JSON.stringify(l))}).catch(o=>{console.log(o)}),a=""},async setSelectedNote(r){let e;for(console.log("setting",r,"selected",this.selectedNote),e=0;e<this.notes.length;e++)console.log(this.notes[e],this.notes.length,r,e),this.notes[e].id==r&&(console.log("i is:",e),this.selectedNote=e);this.selectedNoteID=r},escapeModals(){this.tLNavOn=!1,this.tRNavOn=!1,this.tLInfoOn=!1,this.tRInfoOn=!1,this.bRFrameOn=!1,this.bRNavOn=!1,this.cFrameOn=!1,this.landFrameOn=!1,this.docBoxOn=!1,this.bRMenuOn=!1,this.moreInfoOn=!1,this.cInfoOn=!1,this.docSelect=0,this.contactOn=!1,this.proposalOn=!1,this.helpOn=!1,this.photoFrameOn=!1,this.linkOn=!1,this.isExpanded=!1,this.measureModeOn=!0,this.measureMode()},openFullscreen(r){this.fullScreenImgOn=!0,this.fullScreenSrc=r},closeFullscreen(){this.fullScreenImgOn=!1,this.fullScreenSrc=""},async updateBuilderField(r,e,t){const n=Ge(Ie,"curated",r);try{const i={};i[e]=t,await At(n,i)}catch(i){console.error("Error updating document: ",i)}},async updateField(r,e,t){const n=Ge(Ie,"spaces",r);try{const i={};i[e]=t,await At(n,i)}catch(i){console.error("Error updating document: ",i)}},async updateMultiFields(r,e){const t=Ge(Ie,"spaces",r);console.log("updating fields",r,e);try{await At(t,e),console.log("updated fields",r,e)}catch(n){console.error("Error updating document: ",n)}},async updateAdminField(r,e){const t=Ge(Ie,"sitePro","info");try{await At(t,{[r]:e})}catch(n){console.error("Error updating document: ",n)}},trackEvent(r,e){const t=jd();qd(t,r,e),console.log("track event",r,e)}},getters:{getShareLink(){return console.log("getShareLink",this.m,this.start),this.m==null||this.m===void 0||this.start==null||this.start===void 0?this.spaceLink="/bundle/showcase.html?m="+this.spaceInfo[this.selectedSpace].space+this.spaceInfo[this.selectedSpace].spaceStart+"&play=1&tour=0&measurements=0&vr=0>=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb":(console.log("getsharelink fallback",this.m,this.start),this.spaceLink="/bundle/showcase.html?m="+this.m+this.start+"&play=1&tour=0&measurements=0&vr=0>=0&search=0&title=0&qs=1&log=0&applicationKey=7aiqs9hi5htirg5st5gceq3yb",console.log("newsp
3283acelink",this.spaceLink)),this.spaceLink},getMode(){return this.myMode=this.myControlsModes[this.myControlsMode],console.log(this.myMode),this.myMode},getMpFrameSize(){return this.mpViewFrameSize+"%"},getNavLinks(){return this.spaceInfo}}});export{Vs as $,je as A,tt as B,Te as C,wd as D,Cn as E,An as F,Ve as G,Xu as H,Zu as I,Tt as J,fn as K,Xt as L,of as M,Yn as N,qe as O,vd as P,De as Q,Bs as R,A_ as S,lf as T,ju as U,A as V,qu as W,as as X,Mt as Y,tp as Z,Ia as _,_r as a,Ks as a0,Cl as a1,Oa as a2,xf as a3,Be as a4,xt as a5,ya as a6,gl as a7,_a as a8,Pt as a9,Sd as aA,O_ as aB,G_ as aC,Cb as aD,Fs as aa,Us as ab,wi as ac,Mi as ad,_t as ae,gf as af,Js as ag,_s as ah,$s as ai,Ei as aj,Pi as ak,gr as al,T_ as am,Ii as an,Kn as ao,Ee as ap,xs as aq,ys as ar,fr as as,ps as at,fs as au,Vu as av,Fu as aw,ns as ax,ts as ay,Ct as az,vb as b,Ab as c,Ch as d,_h as e,se as f,bb as g,ul as h,bd as i,Jn as j,ot as k,od as l,$n as m,Zy as n,Ky as o,Yl as p,Da as q,ft as r,tf as s,Ci as t,at as u,El as v,It as w,Ot as x,Nl as y,wn as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.