vendor: 7,908 bytes, lines 1-13
1/** 2 * @license 3 * Copyright 2017 Google LLC 4 * SPDX-License-Identifier: BSD-3-Clause 5 */const g_=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},__=(r,e,t)=>{e.constructor.createProperty(t,r)};function ve(r){return(e,t)=>t!==void 0?__(r,e,t):g_(r,e)}/** 6 * @license 7 * Copyright 2021 Google LLC 8 * SPDX-License-Identifier: BSD-3-Clause 9 */var Wl;((Wl=window.HTMLSlotElement)===null||Wl===void 0?void 0:Wl.prototype.assignedElements)!=null;/** 10 * @license 11 * Copyright 2010-2023 Three.js Authors 12 * SPDX-License-Identifier: MIT 13 */const Nu="163",E_=0,_d=1,v_=2,Zm=1,y_=2,fi=3,Nn=0,Ht=1,Yt=2,qn=0,Er=1,Ed=2,vd=3,yd=4,x_=5,ds=100,S_=101,I_=102,C_=103,M_=104,w_=200,b_=201,T_=202,B_=203,Zh=204,eu=205,R_=206,D_=207,L_=208,P_=209,U_=210,N_=211,F_=212,O_=213,Q_=214,k_=0,G_=1,H_=2,dl=3,V_=4,z_=5,W_=6,$_=7,eg=0,q_=1,X_=2,_i=0,Y_=1,K_=2,J_=3,Rl=4,j_=5,tg=6,Fu=7,xd="attached",Z_="detached",Ir=300,Es=301,Cr=302,fl=303,tu=304,Dl=306,Fn=1e3,Ct=1001,vs=1002,Tt=1003,No=1004,Fi=1005,Xe=1006,gs=1007,on=1008,Sd=1008,It=1009,ng=1010,ig=1011,sg=1012,Ou=1013,ys=1014,Bt=1015,Gt=1016,rg=1017,og=1018,Fo=1020,eE=35902,tE=1021,nE=1022,_t=1023,iE=1024,sE=1025,vr=1026,bo=1027,ps=1028,ag=1029,ur=1030,lg=1031,cg=1033,Ya=33776,$l=33777,ql=33778,Ka=33779,nu=35840,Id=35841,iu=35842,Cd=35843,Qu=36196,su=37492,ru=37496,ou=37808,Md=37809,wd=37810,bd=37811,Al=37812,Td=37813,Bd=37814,Rd=37815,Dd=37816,Ld=37817,Pd=37818,Ud=37819,Nd=37820,Fd=37821,Ja=36492,Od=36494,Qd=36495,rE=36283,kd=36284,Gd=36285,Hd=36286,hg=2200,ku=2201,Gu=2202,Mr=2300,xs=2301,Xl=2302,dr=2400,fr=2401,pl=2402,Hu=2500,oE=2501,aE=0,ug=1,au=2,lE=3200,cE=3201,dg=0,hE=1,vn="",gt="srgb",it="srgb-linear",Ll="display-p3",Oo="display-p3-linear",ml="linear",ut="srgb",gl="rec709",_l="p3",Ts=7680,Vd=519,uE=512,dE=513,fE=514,fg=515,AE=516,pE=517,mE=518,gE=519,lu=35044,zd="300 es",mi=2e3,El=2001;class On{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,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Wt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Wd=1234567;const Io=Math.PI/180,wr=180/Math.PI;function Pn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Wt[r&255]+Wt[r>>8&255]+Wt[r>>16&255]+Wt[r>>24&255]+"-"+Wt[e&255]+Wt[e>>8&255]+"-"+Wt[e>>16&15|64]+Wt[e>>24&255]+"-"+Wt[t&63|128]+Wt[t>>8&255]+"-"+Wt[t>>16&255]+Wt[t>>24&255]+Wt[n&255]+Wt[n>>8&255]+Wt[n>>16&255]+Wt[n>>24&255]).toLowerCase()}function Nt(r,e,t){return Math.max(e,Math.min(t,r))}function Vu(r,e){return(r%e+e)%e}function _E(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function EE(r,e,t){return r!==e?(t-r)/(e-r):0}function Co(r,e,t){return(1-t)*r+t*e}function vE(r,e,t,n){return Co(r,e,1-Math.exp(-t*n))}function yE(r,e=1){return e-Math.abs(Vu(r,e*2)-e)}function xE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function SE(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function IE(r,e){return r+Math.floor(Math.random()*(e-r+1))}function CE(r,e){return r+Math.random()*(e-r)}function ME(r){return r*(.5-Math.random())}function wE(r){r!==void 0&&(Wd=r);let e=Wd+=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 bE(r){return r*Io}function TE(r){return r*wr}function BE(r){return(r&r-1)===0&&r!==0}function RE(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function DE(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function LE(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),h=o((e+n)/2),u=s((e-n)/2),d=o((e-n)/2),f=s((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":r.set(a*h,l*u,l*d,a*c);break;case"YZY":r.set(l*d,a*h,l*u,a*c);break;case"ZXZ":r.set(l*u,l*d,a*h,a*c);break;case"XZX":r.set(a*h,l*m,l*f,a*c);break;case"YXY":r.set(l*f,a*h,l*m,a*c);break;case"ZYZ":r.set(l*m,l*f,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Rn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function tt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const vl={DEG2RAD:Io,RAD2DEG:wr,generateUUID:Pn,clamp:Nt,euclideanModulo:Vu,mapLinear:_E,inverseLerp:EE,lerp:Co,damp:vE,pingpong:yE,smoothstep:xE,smootherstep:SE,randInt:IE,randFloat:CE,randFloatSpread:ME,seededRandom:wE,degToRad:bE,radToDeg:TE,isPowerOfTwo:BE,ceilPowerOfTwo:RE,floorPowerOfTwo:DE,setQuaternionFromProperEuler:LE,normalize:tt,denormalize:Rn};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: 72,826 bytes, line 13
13sub(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=Math.trunc(this.x),this.y=Math.trunc(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}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(Nt(n,-1,1))}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,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class De{constructor(e,t,n,i,s,o,a,l,c){De.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c)}set(e,t,n,i,s,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=o,h[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,o=n[0],a=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],g=i[0],A=i[3],p=i[6],x=i[1],_=i[4],S=i[7],C=i[2],I=i[5],w=i[8];return s[0]=o*g+a*x+l*C,s[3]=o*A+a*_+l*I,s[6]=o*p+a*S+l*w,s[1]=c*g+h*x+u*C,s[4]=c*A+h*_+u*I,s[7]=c*p+h*S+u*w,s[2]=d*g+f*x+m*C,s[5]=d*A+f*_+m*I,s[8]=d*p+f*S+m*w,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],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-n*s*h+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=h*o-a*c,d=a*l-h*s,f=c*s-o*l,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/m;return e[0]=u*g,e[1]=(i*c-h*n)*g,e[2]=(a*n-i*o)*g,e[3]=d*g,e[4]=(h*t-i*l)*g,e[5]=(i*s-a*t)*g,e[6]=f*g,e[7]=(n*l-c*t)*g,e[8]=(o*t-n*s)*g,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yl.makeScale(e,t)),this}rotate(e){return this.premultiply(Yl.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),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)}}const Yl=new De;function Ag(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function To(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function PE(){const r=To("canvas");return r.style.display="block",r}const $d={};function pg(r){r in $d||($d[r]=!0,console.warn(r))}const qd=new De().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Xd=new De().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),qo={[it]:{transfer:ml,primaries:gl,toReference:r=>r,fromReference:r=>r},[gt]:{transfer:ut,primaries:gl,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Oo]:{transfer:ml,primaries:_l,toReference:r=>r.applyMatrix3(Xd),fromReference:r=>r.applyMatrix3(qd)},[Ll]:{transfer:ut,primaries:_l,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Xd),fromReference:r=>r.applyMatrix3(qd).convertLinearToSRGB()}},UE=new Set([it,Oo]),Je={enabled:!0,_workingColorSpace:it,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!UE.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=qo[e].toReference,i=qo[t].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return qo[r].primaries},getTransfer:function(r){return r===vn?ml:qo[r].transfer}};function yr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Kl(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Bs;class NE{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Bs===void 0&&(Bs=To("canvas")),Bs.width=e.width,Bs.height=e.height;const n=Bs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Bs}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=To("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 o=0;o<s.length;o++)s[o]=yr(s[o]/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(yr(t[n]/255)*255):t[n]=yr(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}}let FE=0;class zu{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:FE++}),this.uuid=Pn(),this.data=e,this.dataReady=!0,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 o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(Jl(i[o].image)):s.push(Jl(i[o]))}else s=Jl(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Jl(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?NE.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 OE=0;class nt extends On{constructor(e=nt.DEFAULT_IMAGE,t=nt.DEFAULT_MAPPING,n=Ct,i=Ct,s=Xe,o=on,a=_t,l=It,c=nt.DEFAULT_ANISOTROPY,h=vn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:OE++}),this.uuid=Pn(),this.name="",this.source=new zu(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,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 De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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.channel=e.channel,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.colorSpace=e.colorSpace,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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ir)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Fn:e.x=e.x-Math.floor(e.x);break;case Ct:e.x=e.x<0?0:1;break;case vs: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 Fn:e.y=e.y-Math.floor(e.y);break;case Ct:e.y=e.y<0?0:1;break;case vs: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}nt.DEFAULT_IMAGE=null;nt.DEFAULT_MAPPING=Ir;nt.DEFAULT_ANISOTROPY=1;class rt{constructor(e=0,t=0,n=0,i=1){rt.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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[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],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],g=l[2],A=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-g)<.01&&Math.abs(m-A)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+g)<.1&&Math.abs(m+A)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,S=(f+1)/2,C=(p+1)/2,I=(h+d)/4,w=(u+g)/4,b=(m+A)/4;return _>S&&_>C?_<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(_),i=I/n,s=w/n):S>C?S<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(S),n=I/i,s=b/i):C<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),n=w/s,i=b/s),this.set(n,i,s,t),this}let x=Math.sqrt((A-m)*(A-m)+(u-g)*(u-g)+(d-h)*(d-h));return Math.abs(x)<.001&&(x=1),this.x=(A-m)/x,this.y=(u-g)/x,this.z=(d-h)/x,this.w=Math.acos((c+f+p-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}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 QE extends On{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new rt(0,0,e,t),this.scissorTest=!1,this.viewport=new rt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xe,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new nt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].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.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new zu(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 In extends QE{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class mg extends nt{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=Tt,this.minFilter=Tt,this.wrapR=Ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class gg extends nt{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=Tt,this.minFilter=Tt,this.wrapR=Ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class fn{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,o,a){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=s[o+0],f=s[o+1],m=s[o+2],g=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=g;return}if(u!==g||l!==d||c!==f||h!==m){let A=1-a;const p=l*d+c*f+h*m+u*g,x=p>=0?1:-1,_=1-p*p;if(_>Number.EPSILON){const C=Math.sqrt(_),I=Math.atan2(C,p*x);A=Math.sin(A*I)/C,a=Math.sin(a*I)/C}const S=a*x;if(l=l*A+d*S,c=c*A+f*S,h=h*A+m*S,u=u*A+g*S,A===1-a){const C=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=C,c*=C,h*=C,u*=C}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[o],d=s[o+1],f=s[o+2],m=s[o+3];return e[t]=a*m+h*u+l*f-c*d,e[t+1]=l*m+h*d+c*u-a*f,e[t+2]=c*m+h*f+a*d-l*u,e[t+3]=h*m-a*u-l*d-c*f,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=!0){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),h=a(i/2),u=a(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(o){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&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],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=n+a+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(o-i)*f}else if(n>a&&n>u){const f=2*Math.sqrt(1+n-a-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+o)/f,this._z=(s+c)/f}else if(a>u){const f=2*Math.sqrt(1+a-n-u);this._w=(s-c)/f,this._x=(i+o)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-a);this._w=(o-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}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(Nt(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()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=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,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+o*a+i*c-s*l,this._y=i*h+o*l+s*a-n*c,this._z=s*h+o*c+n*l-i*a,this._w=o*h-n*a-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,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class D{constructor(e=0,t=0,n=0){D.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(Yd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Yd.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*n),h=2*(a*t-s*i),u=2*(s*n-o*t);return this.x=t+l*c+o*u-a*h,this.y=n+l*h+a*c-s*u,this.z=i+l*u+s*h-o*c,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,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 jl.copy(this).projectOnVector(e),this.sub(jl)}reflect(e){return this.sub(jl.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(Nt(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}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jl=new D,Yd=new fn;class sn{constructor(e=new D(1/0,1/0,1/0),t=new D(-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){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(wn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(wn.fromBufferAttribute(e,t));return 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=wn.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){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,wn):wn.fromBufferAttribute(s,o),wn.applyMatrix4(e.matrixWorld),this.expandByPoint(wn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Xo.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Xo.copy(n.boundingBox)),Xo.applyMatrix4(e.matrixWorld),this.union(Xo)}const i=e.children;for(let s=0,o=i.length;s<o;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,wn),wn.distanceToSquared(e.center)<=e.radius*e.radius}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(Gr),Yo.subVectors(this.max,Gr),Rs.subVectors(e.a,Gr),Ds.subVectors(e.b,Gr),Ls.subVectors(e.c,Gr),xi.subVectors(Ds,Rs),Si.subVectors(Ls,Ds),qi.subVectors(Rs,Ls);let t=[0,-xi.z,xi.y,0,-Si.z,Si.y,0,-qi.z,qi.y,xi.z,0,-xi.x,Si.z,0,-Si.x,qi.z,0,-qi.x,-xi.y,xi.x,0,-Si.y,Si.x,0,-qi.y,qi.x,0];return!Zl(t,Rs,Ds,Ls,Yo)||(t=[1,0,0,0,1,0,0,0,1],!Zl(t,Rs,Ds,Ls,Yo))?!1:(Ko.crossVectors(xi,Si),t=[Ko.x,Ko.y,Ko.z],Zl(t,Rs,Ds,Ls,Yo))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wn).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:(Zn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zn),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 Zn=[new D,new D,new D,new D,new D,new D,new D,new D],wn=new D,Xo=new sn,Rs=new D,Ds=new D,Ls=new D,xi=new D,Si=new D,qi=new D,Gr=new D,Yo=new D,Ko=new D,Xi=new D;function Zl(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Xi.fromArray(r,s);const a=i.x*Math.abs(Xi.x)+i.y*Math.abs(Xi.y)+i.z*Math.abs(Xi.z),l=e.dot(Xi),c=t.dot(Xi),h=n.dot(Xi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const kE=new sn,Hr=new D,ec=new D;class Mn{constructor(e=new D,t=-1){this.isSphere=!0,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):kE.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;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;Hr.subVectors(e,this.center);const t=Hr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Hr,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):(ec.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Hr.copy(e.center).add(ec)),this.expandByPoint(Hr.copy(e.center).sub(ec))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ei=new D,tc=new D,Jo=new D,Ii=new D,nc=new D,jo=new D,ic=new D;class Qo{constructor(e=new D,t=new D(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ei)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ei.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ei.copy(this.origin).addScaledVector(this.direction,t),ei.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tc.copy(e).add(t).multiplyScalar(.5),Jo.copy(t).sub(e).normalize(),Ii.copy(this.origin).sub(tc);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Jo),a=Ii.dot(this.direction),l=-Ii.dot(Jo),c=Ii.lengthSq(),h=Math.abs(1-o*o);let u,d,f,m;if(h>0)if(u=o*l-a,d=o*a-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const g=1/h;u*=g,d*=g,f=u*(u+o*d+2*a)+d*(o*u+d+2*l)+c}else d=s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-o*s+a)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(o*s+a)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=o>0?-s:s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(tc).addScaledVector(Jo,d),f}intersectSphere(e,t){ei.subVectors(e.center,this.origin);const n=ei.dot(this.direction),i=ei.dot(ei)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,o=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,o=(e.min.y-d.y)*h),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),u>=0?(a=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ei)!==null}intersectTriangle(e,t,n,i,s){nc.subVectors(t,e),jo.subVectors(n,e),ic.crossVectors(nc,jo);let o=this.direction.dot(ic),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ii.subVectors(this.origin,e);const l=a*this.direction.dot(jo.crossVectors(Ii,jo));if(l<0)return null;const c=a*this.direction.dot(nc.cross(Ii));if(c<0||l+c>o)return null;const h=-a*Ii.dot(ic);return h<0?null:this.at(h/o,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 Me{constructor(e,t,n,i,s,o,a,l,c,h,u,d,f,m,g,A){Me.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c,h,u,d,f,m,g,A)}set(e,t,n,i,s,o,a,l,c,h,u,d,f,m,g,A){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=g,p[15]=A,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 Me().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/Ps.setFromMatrixColumn(e,0).length(),s=1/Ps.setFromMatrixColumn(e,1).length(),o=1/Ps.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=o*h,f=o*u,m=a*h,g=a*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=f+m*c,t[5]=d-g*c,t[9]=-a*l,t[2]=g-d*c,t[6]=m+f*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*h,f=l*u,m=c*h,g=c*u;t[0]=d+g*a,t[4]=m*a-f,t[8]=o*c,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=f*a-m,t[6]=g+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*h,f=l*u,m=c*h,g=c*u;t[0]=d-g*a,t[4]=-o*u,t[8]=m+f*a,t[1]=f+m*a,t[5]=o*h,t[9]=g-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*h,f=o*u,m=a*h,g=a*u;t[0]=l*h,t[4]=m*c-f,t[8]=d*c+g,t[1]=l*u,t[5]=g*c+d,t[9]=f*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,f=o*c,m=a*l,g=a*c;t[0]=l*h,t[4]=g-d*u,t[8]=m*u+f,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=f*u+m,t[10]=d-g*u}else if(e.order==="XZY"){const d=o*l,f=o*c,m=a*l,g=a*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+g,t[5]=o*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=a*h,t[10]=g*u+d}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(GE,e,HE)}lookAt(e,t,n){const i=this.elements;return cn.subVectors(e,t),cn.lengthSq()===0&&(cn.z=1),cn.normalize(),Ci.crossVectors(n,cn),Ci.lengthSq()===0&&(Math.abs(n.z)===1?cn.x+=1e-4:cn.z+=1e-4,cn.normalize(),Ci.crossVectors(n,cn)),Ci.normalize(),Zo.crossVectors(cn,Ci),i[0]=Ci.x,i[4]=Zo.x,i[8]=cn.x,i[1]=Ci.y,i[5]=Zo.y,i[9]=cn.y,i[2]=Ci.z,i[6]=Zo.z,i[10]=cn.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,o=n[0],a=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],g=n[6],A=n[10],p=n[14],x=n[3],_=n[7],S=n[11],C=n[15],I=i[0],w=i[4],b=i[8],v=i[12],E=i[1],L=i[5],F=i[9],R=i[13],P=i[2],N=i[6],G=i[10],$=i[14],O=i[3],X=i[7],q=i[11],ee=i[15];return s[0]=o*I+a*E+l*P+c*O,s[4]=o*w+a*L+l*N+c*X,s[8]=o*b+a*F+l*G+c*q,s[12]=o*v+a*R+l*$+c*ee,s[1]=h*I+u*E+d*P+f*O,s[5]=h*w+u*L+d*N+f*X,s[9]=h*b+u*F+d*G+f*q,s[13]=h*v+u*R+d*$+f*ee,s[2]=m*I+g*E+A*P+p*O,s[6]=m*w+g*L+A*N+p*X,s[10]=m*b+g*F+A*G+p*q,s[14]=m*v+g*R+A*$+p*ee,s[3]=x*I+_*E+S*P+C*O,s[7]=x*w+_*L+S*N+C*X,s[11]=x*b+_*F+S*G+C*q,s[15]=x*v+_*R+S*$+C*ee,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],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],g=e[7],A=e[11],p=e[15];return m*(+s*l*u-i*c*u-s*a*d+n*c*d+i*a*f-n*l*f)+g*(+t*l*f-t*c*d+s*o*d-i*o*f+i*c*h-s*l*h)+A*(+t*c*u-t*a*f-s*o*u+n*o*f+s*a*h-n*c*h)+p*(-i*a*h-t*l*u+t*a*d+i*o*u-n*o*d+n*l*h)}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],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],g=e[13],A=e[14],p=e[15],x=u*A*c-g*d*c+g*l*f-a*A*f-u*l*p+a*d*p,_=m*d*c-h*A*c-m*l*f+o*A*f+h*l*p-o*d*p,S=h*g*c-m*u*c+m*a*f-o*g*f-h*a*p+o*u*p,C=m*u*l-h*g*l-m*a*d+o*g*d+h*a*A-o*u*A,I=t*x+n*_+i*S+s*C;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/I;return e[0]=x*w,e[1]=(g*d*s-u*A*s-g*i*f+n*A*f+u*i*p-n*d*p)*w,e[2]=(a*A*s-g*l*s+g*i*c-n*A*c-a*i*p+n*l*p)*w,e[3]=(u*l*s-a*d*s-u*i*c+n*d*c+a*i*f-n*l*f)*w,e[4]=_*w,e[5]=(h*A*s-m*d*s+m*i*f-t*A*f-h*i*p+t*d*p)*w,e[6]=(m*l*s-o*A*s-m*i*c+t*A*c+o*i*p-t*l*p)*w,e[7]=(o*d*s-h*l*s+h*i*c-t*d*c-o*i*f+t*l*f)*w,e[8]=S*w,e[9]=(m*u*s-h*g*s-m*n*f+t*g*f+h*n*p-t*u*p)*w,e[10]=(o*g*s-m*a*s+m*n*c-t*g*c-o*n*p+t*a*p)*w,e[11]=(h*a*s-o*u*s-h*n*c+t*u*c+o*n*f-t*a*f)*w,e[12]=C*w,e[13]=(h*g*i-m*u*i+m*n*d-t*g*d-h*n*A+t*u*A)*w,e[14]=(m*a*i-o*g*i-m*n*l+t*g*l+o*n*A-t*a*A)*w,e[15]=(o*u*i-h*a*i+h*n*l-t*u*l-o*n*d+t*a*d)*w,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):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,o=e.x,a=e.y,l=e.z,c=s*o,h=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+n,h*l-i*o,0,c*l-i*a,h*l+i*o,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,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,h=o+o,u=a+a,d=s*c,f=s*h,m=s*u,g=o*h,A=o*u,p=a*u,x=l*c,_=l*h,S=l*u,C=n.x,I=n.y,w=n.z;return i[0]=(1-(g+p))*C,i[1]=(f+S)*C,i[2]=(m-_)*C,i[3]=0,i[4]=(f-S)*I,i[5]=(1-(d+p))*I,i[6]=(A+x)*I,i[7]=0,i[8]=(m+_)*w,i[9]=(A-x)*w,i[10]=(1-(d+g))*w,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=Ps.set(i[0],i[1],i[2]).length();const o=Ps.set(i[4],i[5],i[6]).length(),a=Ps.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],bn.copy(this);const c=1/s,h=1/o,u=1/a;return bn.elements[0]*=c,bn.elements[1]*=c,bn.elements[2]*=c,bn.elements[4]*=h,bn.elements[5]*=h,bn.elements[6]*=h,bn.elements[8]*=u,bn.elements[9]*=u,bn.elements[10]*=u,t.setFromRotationMatrix(bn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=mi){const l=this.elements,c=2*s/(t-e),h=2*s/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i);let f,m;if(a===mi)f=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===El)f=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=mi){const l=this.elements,c=1/(t-e),h=1/(n-i),u=1/(o-s),d=(t+e)*c,f=(n+i)*h;let m,g;if(a===mi)m=(o+s)*u,g=-2*u;else if(a===El)m=s*u,g=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=g,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[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 Ps=new D,bn=new Me,GE=new D(0,0,0),HE=new D(1,1,1),Ci=new D,Zo=new D,cn=new D,Kd=new Me,Jd=new fn;class Cn{constructor(e=0,t=0,n=0,i=Cn.DEFAULT_ORDER){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],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Nt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-Nt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,f),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 Kd.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Kd,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jd.setFromEuler(this),this.setFromQuaternion(Jd,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}}Cn.DEFAULT_ORDER="XYZ";class Wu{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 VE=0;const jd=new D,Us=new fn,ti=new Me,ea=new D,Vr=new D,zE=new D,WE=new fn,Zd=new D(1,0,0),ef=new D(0,1,0),tf=new D(0,0,1),nf={type:"added"},$E={type:"removed"},Ns={type:"childadded",child:null},sc={type:"childremoved",child:null};class lt extends On{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:VE++}),this.uuid=Pn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lt.DEFAULT_UP.clone();const e=new D,t=new Cn,n=new fn,i=new D(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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 Me},normalMatrix:{value:new De}}),this.matrix=new Me,this.matrixWorld=new Me,this.matrixAutoUpdate=lt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Wu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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 Us.setFromAxisAngle(e,t),this.quaternion.multiply(Us),this}rotateOnWorldAxis(e,t){return Us.setFromAxisAngle(e,t),this.quaternion.premultiply(Us),this}rotateX(e){return this.rotateOnAxis(Zd,e)}rotateY(e){return this.rotateOnAxis(ef,e)}rotateZ(e){return this.rotateOnAxis(tf,e)}translateOnAxis(e,t){return jd.copy(e).applyQuaternion(this.quaternion),this.position.add(jd.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Zd,e)}translateY(e){return this.translateOnAxis(ef,e)}translateZ(e){return this.translateOnAxis(tf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ti.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ea.copy(e):ea.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Vr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ti.lookAt(Vr,ea,this.up):ti.lookAt(ea,Vr,this.up),this.quaternion.setFromRotationMatrix(ti),i&&(ti.extractRotation(i.matrixWorld),Us.setFromRotationMatrix(ti),this.quaternion.premultiply(Us.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.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(nf),Ns.child=e,this.dispatchEvent(Ns),Ns.child=null):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($E),sc.child=e,this.dispatchEvent(sc),sc.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ti.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ti.multiply(e.parent.matrixWorld)),e.applyMatrix4(ti),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(nf),Ns.child=e,this.dispatchEvent(Ns),Ns.child=null,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 o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vr,e,zE),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vr,WE,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,o=i.length;s<o;s++){const a=i[s];a.matrixWorldAutoUpdate===!0&&a.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.6,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),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.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())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),h=o(e.images),u=o(e.shapes),d=o(e.skeletons),f=o(e.animations),m=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,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.animations=e.animations.slice(),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}}lt.DEFAULT_UP=new D(0,1,0);lt.DEFAULT_MATRIX_AUTO_UPDATE=!0;lt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Tn=new D,ni=new D,rc=new D,ii=new D,Fs=new D,Os=new D,sf=new D,oc=new D,ac=new D,lc=new D;class yn{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Tn.subVectors(e,t),i.cross(Tn);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){Tn.subVectors(i,t),ni.subVectors(n,t),rc.subVectors(e,t);const o=Tn.dot(Tn),a=Tn.dot(ni),l=Tn.dot(rc),c=ni.dot(ni),h=ni.dot(rc),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-a*h)*d,m=(o*h-a*l)*d;return s.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,ii)===null?!1:ii.x>=0&&ii.y>=0&&ii.x+ii.y<=1}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,ii)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ii.x),l.addScaledVector(o,ii.y),l.addScaledVector(a,ii.z),l)}static isFrontFacing(e,t,n,i){return Tn.subVectors(n,t),ni.subVectors(e,t),Tn.cross(ni).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 Tn.subVectors(this.c,this.b),ni.subVectors(this.a,this.b),Tn.cross(ni).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return yn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return yn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return yn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yn.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 o,a;Fs.subVectors(i,n),Os.subVectors(s,n),oc.subVectors(e,n);const l=Fs.dot(oc),c=Os.dot(oc);if(l<=0&&c<=0)return t.copy(n);ac.subVectors(e,i);const h=Fs.dot(ac),u=Os.dot(ac);if(h>=0&&u<=h)return t.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(n).addScaledVector(Fs,o);lc.subVectors(e,s);const f=Fs.dot(lc),m=Os.dot(lc);if(m>=0&&f<=m)return t.copy(s);const g=f*c-l*m;if(g<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(n).addScaledVector(Os,a);const A=h*m-f*u;if(A<=0&&u-h>=0&&f-m>=0)return sf.subVectors(s,i),a=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(sf,a);const p=1/(A+g+d);return o=g*p,a=d*p,t.copy(n).addScaledVector(Fs,o).addScaledVector(Os,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _g={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},Mi={h:0,s:0,l:0},ta={h:0,s:0,l:0};function cc(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}class Ce{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=gt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Je.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Je.workingColorSpace){return this.r=e,this.g=t,this.b=n,Je.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Je.workingColorSpace){if(e=Vu(e,1),t=Nt(t,0,1),n=Nt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;
vendor: 6,059 bytes, line 13
13this.r=cc(o,s,e+1/3),this.g=cc(o,s,e),this.b=cc(o,s,e-1/3)}return Je.toWorkingColorSpace(this,i),this}setStyle(e,t=gt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=gt){const n=_g[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=yr(e.r),this.g=yr(e.g),this.b=yr(e.b),this}copyLinearToSRGB(e){return this.r=Kl(e.r),this.g=Kl(e.g),this.b=Kl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=gt){return Je.fromWorkingColorSpace($t.copy(this),e),Math.round(Nt($t.r*255,0,255))*65536+Math.round(Nt($t.g*255,0,255))*256+Math.round(Nt($t.b*255,0,255))}getHexString(e=gt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Je.workingColorSpace){Je.fromWorkingColorSpace($t.copy(this),t);const n=$t.r,i=$t.g,s=$t.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=h<=.5?u/(o+a):u/(2-o-a),o){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Je.workingColorSpace){return Je.fromWorkingColorSpace($t.copy(this),t),e.r=$t.r,e.g=$t.g,e.b=$t.b,e}getStyle(e=gt){Je.fromWorkingColorSpace($t.copy(this),e);const t=$t.r,n=$t.g,i=$t.b;return e!==gt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Mi),this.setHSL(Mi.h+e,Mi.s+t,Mi.l+n)}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(Mi),e.getHSL(ta);const n=Co(Mi.h,ta.h,t),i=Co(Mi.s,ta.s,t),s=Co(Mi.l,ta.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const $t=new Ce;Ce.NAMES=_g;let qE=0;class Un extends On{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:qE++}),this.uuid=Pn(),this.name="",this.type="Material",this.blending=Er,this.side=Nn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Zh,this.blendDst=eu,this.blendEquation=ds,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ce(0,0,0),this.blendAlpha=0,this.depthFunc=dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Vd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ts,this.stencilZFail=Ts,this.stencilZPass=Ts,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.forceSinglePass=!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: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);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.6,type:"Material",generator:"Material.toJSON"}};
vendor: 6,095 bytes, line 13
13n.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!==void 0&&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.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.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.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),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!==Er&&(n.blending=this.blending),this.side!==Nn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Zh&&(n.blendSrc=this.blendSrc),this.blendDst!==eu&&(n.blendDst=this.blendDst),this.blendEquation!==ds&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==dl&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Vd&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ts&&
vendor: 44,011 bytes, lines 13-111
13(n.stencilFail=this.stencilFail),this.stencilZFail!==Ts&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ts&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),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=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,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 xn extends Un{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ce(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.envMapRotation=new Cn,this.combine=eg,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const pi=XE();function XE(){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),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(c&8388608);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function YE(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Nt(r,-65504,65504),pi.floatView[0]=r;const e=pi.uint32View[0],t=e>>23&511;return pi.baseTable[t]+((e&8388607)>>pi.shiftTable[t])}function KE(r){const e=r>>10;return pi.uint32View[0]=pi.mantissaTable[pi.offsetTable[e]+(r&1023)]+pi.exponentTable[e],pi.floatView[0]}const na={toHalfFloat:YE,fromHalfFloat:KE},wt=new D,ia=new Se;class Et{constructor(e,t,n=!1){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,this.usage=lu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Bt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return pg("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,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;t++)ia.fromBufferAttribute(this,t),ia.applyMatrix3(e),this.setXY(t,ia.x,ia.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)wt.fromBufferAttribute(this,t),wt.applyMatrix3(e),this.setXYZ(t,wt.x,wt.y,wt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)wt.fromBufferAttribute(this,t),wt.applyMatrix4(e),this.setXYZ(t,wt.x,wt.y,wt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)wt.fromBufferAttribute(this,t),wt.applyNormalMatrix(e),this.setXYZ(t,wt.x,wt.y,wt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)wt.fromBufferAttribute(this,t),wt.transformDirection(e),this.setXYZ(t,wt.x,wt.y,wt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Rn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Rn(t,this.array)),t}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Rn(t,this.array)),t}setY(e,t){return this.normalized&&(t=tt(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=Rn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tt(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=Rn(t,this.array)),t}setW(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(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=tt(t,this.array),n=tt(n,this.array),i=tt(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=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(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!==lu&&(e.usage=this.usage),e}}class Eg extends Et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vg extends Et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class An extends Et{constructor(e,t,n){super(new Float32Array(e),t,n)}}let JE=0;const gn=new Me,hc=new lt,Qs=new D,hn=new sn,zr=new sn,Pt=new D;class pn extends On{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:JE++}),this.uuid=Pn(),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(Ag(e)?vg:Eg)(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 De().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 gn.makeRotationFromQuaternion(e),this.applyMatrix4(gn),this}rotateX(e){return gn.makeRotationX(e),this.applyMatrix4(gn),this}rotateY(e){return gn.makeRotationY(e),this.applyMatrix4(gn),this}rotateZ(e){return gn.makeRotationZ(e),this.applyMatrix4(gn),this}translate(e,t,n){return gn.makeTranslation(e,t,n),this.applyMatrix4(gn),this}scale(e,t,n){return gn.makeScale(e,t,n),this.applyMatrix4(gn),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qs).negate(),this.translate(Qs.x,Qs.y,Qs.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 An(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new sn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(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];hn.setFromBufferAttribute(s),this.morphTargetsRelative?(Pt.addVectors(this.boundingBox.min,hn.min),this.boundingBox.expandByPoint(Pt),Pt.addVectors(this.boundingBox.max,hn.max),this.boundingBox.expandByPoint(Pt)):(this.boundingBox.expandByPoint(hn.min),this.boundingBox.expandByPoint(hn.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 Mn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){const n=this.boundingSphere.center;if(hn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];zr.setFromBufferAttribute(a),this.morphTargetsRelative?(Pt.addVectors(hn.min,zr.min),hn.expandByPoint(Pt),Pt.addVectors(hn.max,zr.max),hn.expandByPoint(Pt)):(hn.expandByPoint(zr.min),hn.expandByPoint(zr.max))}hn.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Pt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Pt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)Pt.fromBufferAttribute(a,c),l&&(Qs.fromBufferAttribute(e,c),Pt.add(Qs)),i=Math.max(i,n.distanceToSquared(Pt))}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=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Et(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let b=0;b<n.count;b++)a[b]=new D,l[b]=new D;const c=new D,h=new D,u=new D,d=new Se,f=new Se,m=new Se,g=new D,A=new D;function p(b,v,E){c.fromBufferAttribute(n,b),h.fromBufferAttribute(n,v),u.fromBufferAttribute(n,E),d.fromBufferAttribute(s,b),f.fromBufferAttribute(s,v),m.fromBufferAttribute(s,E),h.sub(c),u.sub(c),f.sub(d),m.sub(d);const L=1/(f.x*m.y-m.x*f.y);isFinite(L)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(L),A.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(L),a[b].add(g),a[v].add(g),a[E].add(g),l[b].add(A),l[v].add(A),l[E].add(A))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let b=0,v=x.length;b<v;++b){const E=x[b],L=E.start,F=E.count;for(let R=L,P=L+F;R<P;R+=3)p(e.getX(R+0),e.getX(R+1),e.getX(R+2))}const _=new D,S=new D,C=new D,I=new D;function w(b){C.fromBufferAttribute(i,b),I.copy(C);const v=a[b];_.copy(v),_.sub(C.multiplyScalar(C.dot(v))).normalize(),S.crossVectors(I,v);const L=S.dot(l[b])<0?-1:1;o.setXYZW(b,_.x,_.y,_.z,L)}for(let b=0,v=x.length;b<v;++b){const E=x[b],L=E.start,F=E.count;for(let R=L,P=L+F;R<P;R+=3)w(e.getX(R+0)),w(e.getX(R+1)),w(e.getX(R+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 Et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new D,s=new D,o=new D,a=new D,l=new D,c=new D,h=new D,u=new D;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),g=e.getX(d+1),A=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),o.fromBufferAttribute(t,A),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,g),c.fromBufferAttribute(n,A),a.add(h),l.add(h),c.add(h),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(A,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Pt.fromBufferAttribute(e,t),Pt.normalize(),e.setXYZ(t,Pt.x,Pt.y,Pt.z)}toNonIndexed(){function e(a,l){const c=a.array,h=a.itemSize,u=a.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let g=0,A=l.length;g<A;g++){a.isInterleavedBufferAttribute?f=l[g]*a.data.stride+a.offset:f=l[g]*h;for(let p=0;p<h;p++)d[m++]=c[f++]}return new Et(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new pn,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=e(d,n);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(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],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,h=o.length;c<h;c++){const u=o[c];this.addGroup(u.start,u.count,u.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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,this}dispose(){this.dispatchEvent({type:"dispose"})}}const rf=new Me,Yi=new Qo,sa=new Mn,of=new D,ks=new D,Gs=new D,Hs=new D,uc=new D,ra=new D,oa=new Se,aa=new Se,la=new Se,af=new D,lf=new D,cf=new D,ca=new D,ha=new D;class ot extends lt{constructor(e=new pn,t=new xn){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=Array.isArray(e.material)?e.material.slice():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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){ra.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=a[l],u=s[l];h!==0&&(uc.fromBufferAttribute(u,e),o?ra.addScaledVector(uc,h):ra.addScaledVector(uc.sub(t),h))}t.add(ra)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),sa.copy(n.boundingSphere),sa.applyMatrix4(s),Yi.copy(e.ray).recast(e.near),!(sa.containsPoint(Yi.origin)===!1&&(Yi.intersectSphere(sa,of)===null||Yi.origin.distanceToSquared(of)>(e.far-e.near)**2))&&(rf.copy(s).invert(),Yi.copy(e.ray).applyMatrix4(rf),!(n.boundingBox!==null&&Yi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Yi)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,g=d.length;m<g;m++){const A=d[m],p=o[A.materialIndex],x=Math.max(A.start,f.start),_=Math.min(a.count,Math.min(A.start+A.count,f.start+f.count));for(let S=x,C=_;S<C;S+=3){const I=a.getX(S),w=a.getX(S+1),b=a.getX(S+2);i=ua(this,p,e,n,c,h,u,I,w,b),i&&(i.faceIndex=Math.floor(S/3),i.face.materialIndex=A.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),g=Math.min(a.count,f.start+f.count);for(let A=m,p=g;A<p;A+=3){const x=a.getX(A),_=a.getX(A+1),S=a.getX(A+2);i=ua(this,o,e,n,c,h,u,x,_,S),i&&(i.faceIndex=Math.floor(A/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,g=d.length;m<g;m++){const A=d[m],p=o[A.materialIndex],x=Math.max(A.start,f.start),_=Math.min(l.count,Math.min(A.start+A.count,f.start+f.count));for(let S=x,C=_;S<C;S+=3){const I=S,w=S+1,b=S+2;i=ua(this,p,e,n,c,h,u,I,w,b),i&&(i.faceIndex=Math.floor(S/3),i.face.materialIndex=A.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),g=Math.min(l.count,f.start+f.count);for(let A=m,p=g;A<p;A+=3){const x=A,_=A+1,S=A+2;i=ua(this,o,e,n,c,h,u,x,_,S),i&&(i.faceIndex=Math.floor(A/3),t.push(i))}}}}function jE(r,e,t,n,i,s,o,a){let l;if(e.side===Ht?l=n.intersectTriangle(o,s,i,!0,a):l=n.intersectTriangle(i,s,o,e.side===Nn,a),l===null)return null;ha.copy(a),ha.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(ha);return c<t.near||c>t.far?null:{distance:c,point:ha.clone(),object:r}}function ua(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,ks),r.getVertexPosition(l,Gs),r.getVertexPosition(c,Hs);const h=jE(r,e,t,n,ks,Gs,Hs,ca);if(h){i&&(oa.fromBufferAttribute(i,a),aa.fromBufferAttribute(i,l),la.fromBufferAttribute(i,c),h.uv=yn.getInterpolation(ca,ks,Gs,Hs,oa,aa,la,new Se)),s&&(oa.fromBufferAttribute(s,a),aa.fromBufferAttribute(s,l),la.fromBufferAttribute(s,c),h.uv1=yn.getInterpolation(ca,ks,Gs,Hs,oa,aa,la,new Se)),o&&(af.fromBufferAttribute(o,a),lf.fromBufferAttribute(o,l),cf.fromBufferAttribute(o,c),h.normal=yn.getInterpolation(ca,ks,Gs,Hs,af,lf,cf,new D),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a,b:l,c,normal:new D,materialIndex:0};yn.getNormal(ks,Gs,Hs,u.normal),h.face=u}return h}class bs extends pn{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,t,e,o,s,0),m("z","y","x",1,-1,n,t,-e,o,s,1),m("x","z","y",1,1,e,n,t,i,o,2),m("x","z","y",1,-1,e,n,-t,i,o,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new An(c,3)),this.setAttribute("normal",new An(h,3)),this.setAttribute("uv",new An(u,2));function m(g,A,p,x,_,S,C,I,w,b,v){const E=S/w,L=C/b,F=S/2,R=C/2,P=I/2,N=w+1,G=b+1;let $=0,O=0;const X=new D;for(let q=0;q<G;q++){const ee=q*L-R;for(let ue=0;ue<N;ue++){const we=ue*E-F;X[g]=we*x,X[A]=ee*_,X[p]=P,c.push(X.x,X.y,X.z),X[g]=0,X[A]=0,X[p]=I>0?1:-1,h.push(X.x,X.y,X.z),u.push(ue/w),u.push(1-q/b),$+=1}}for(let q=0;q<b;q++)for(let ee=0;ee<w;ee++){const ue=d+ee+N*q,we=d+ee+N*(q+1),z=d+(ee+1)+N*(q+1),K=d+(ee+1)+N*q;l.push(ue,we,K),l.push(we,z,K),O+=6}a.addGroup(f,O,v),f+=O,d+=$}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function br(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)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function tn(r){const e={};for(let t=0;t<r.length;t++){const n=br(r[t]);for(const i in n)e[i]=n[i]}return e}function ZE(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function yg(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Je.workingColorSpace}const ev={clone:br,merge:tn};var tv=`void main() { 14 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 15}`,nv=`void main() { 16 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 17}`;class an extends Un{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=tv,this.fragmentShader=nv,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[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=br(e.uniforms),this.uniformsGroups=ZE(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 o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;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 xg extends lt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Me,this.projectionMatrix=new Me,this.projectionMatrixInverse=new Me,this.coordinateSystem=mi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}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)}}const wi=new D,hf=new Se,uf=new Se;class Ft extends xg{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=wr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Io*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return wr*2*Math.atan(Math.tan(Io*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){wi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(wi.x,wi.y).multiplyScalar(-e/wi.z),wi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(wi.x,wi.y).multiplyScalar(-e/wi.z)}getViewSize(e,t){return this.getViewBounds(e,hf,uf),t.subVectors(uf,hf)}setViewOffset(e,t,n,i,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Io*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),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 Vs=-90,zs=1;class cu extends lt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ft(Vs,zs,e,t);i.layers=this.layers,this.add(i);const s=new Ft(Vs,zs,e,t);s.layers=this.layers,this.add(s);const o=new Ft(Vs,zs,e,t);o.layers=this.layers,this.add(o);const a=new Ft(Vs,zs,e,t);a.layers=this.layers,this.add(a);const l=new Ft(Vs,zs,e,t);l.layers=this.layers,this.add(l);const c=new Ft(Vs,zs,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===mi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===El)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class Sg extends nt{constructor(e,t,n,i,s,o,a,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:Es,super(e,t,n,i,s,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $u extends In{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 Sg(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Xe}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 18 19 varying vec3 vWorldDirection; 20 21 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 22 23 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 24 25 } 26 27 void main() { 28 29 vWorldDirection = transformDirection( position, modelMatrix ); 30 31 #include <begin_vertex> 32 #include <project_vertex> 33 34 } 35 `,fragmentShader:` 36 37 uniform sampler2D tEquirect; 38 39 varying vec3 vWorldDirection; 40 41 #include <common> 42 43 void main() { 44 45 vec3 direction = normalize( vWorldDirection ); 46 47 vec2 sampleUV = equirectUv( direction ); 48 49 gl_FragColor = texture2D( tEquirect, sampleUV ); 50 51 } 52 `},i=new bs(5,5,5),s=new an({name:"CubemapFromEquirect",uniforms:br(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ht,blending:qn});s.uniforms.tEquirect.value=t;const o=new ot(i,s),a=t.minFilter;return t.minFilter===on&&(t.minFilter=Xe),new cu(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const dc=new D,iv=new D,sv=new De;class rs{constructor(e=new D(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=dc.subVectors(n,t).cross(iv.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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(dc),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(e.start).addScaledVector(n,s)}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||sv.getNormalMatrix(e),i=this.coplanarPoint(dc).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 Ki=new Mn,da=new D;class qu{constructor(e=new rs,t=new rs,n=new rs,i=new rs,s=new rs,o=new rs){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=mi){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],h=i[5],u=i[6],d=i[7],f=i[8],m=i[9],g=i[10],A=i[11],p=i[12],x=i[13],_=i[14],S=i[15];if(n[0].setComponents(l-s,d-c,A-f,S-p).normalize(),n[1].setComponents(l+s,d+c,A+f,S+p).normalize(),n[2].setComponents(l+o,d+h,A+m,S+x).normalize(),n[3].setComponents(l-o,d-h,A-m,S-x).normalize(),n[4].setComponents(l-a,d-u,A-g,S-_).normalize(),t===mi)n[5].setComponents(l+a,d+u,A+g,S+_).normalize();else if(t===El)n[5].setComponents(a,u,g,_).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ki.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ki.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ki)}intersectsSprite(e){return Ki.center.set(0,0,0),Ki.radius=.7071067811865476,Ki.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ki)}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(da.x=i.normal.x>0?e.max.x:e.min.x,da.y=i.normal.y>0?e.max.y:e.min.y,da.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(da)<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 Ig(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),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 rv(r){const e=new WeakMap;function t(a,l){const c=a.array,h=a.usage,u=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,h),a.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function n(a,l,c){const h=l.array,u=l._updateRange,d=l.updateRanges;if(r.bindBuffer(c,a),u.count===-1&&d.length===0&&r.bufferSubData(c,0,h),d.length!==0){for(let f=0,m=d.length;f<m;f++){const g=d[f];r.bufferSubData(c,g.start*h.BYTES_PER_ELEMENT,h,g.start,g.count)}l.clearUpdateRanges()}u.count!==-1&&(r.bufferSubData(c,u.offset*h.BYTES_PER_ELEMENT,h,u.offset,u.count),u.count=-1),l.onUploadCallback()}function i(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(r.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isGLBufferAttribute){const h=e.get(a);(!h||h.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}a.isInterleavedBufferAttribute&&(a=a.data);const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}class Yn extends pn{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,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,h=l+1,u=e/a,d=t/l,f=[],m=[],g=[],A=[];for(let p=0;p<h;p++){const x=p*d-o;for(let _=0;_<c;_++){const S=_*u-s;m.push(S,-x,0),g.push(0,0,1),A.push(_/a),A.push(1-p/l)}}for(let p=0;p<l;p++)for(let x=0;x<a;x++){const _=x+c*p,S=x+c*(p+1),C=x+1+c*(p+1),I=x+1+c*p;f.push(_,S,I),f.push(S,C,I)}this.setIndex(f),this.setAttribute("position",new An(m,3)),this.setAttribute("normal",new An(g,3)),this.setAttribute("uv",new An(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yn(e.width,e.height,e.widthSegments,e.heightSegments)}}var ov=`#ifdef USE_ALPHAHASH 53 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 54#endif`,av=`#ifdef USE_ALPHAHASH 55 const float ALPHA_HASH_SCALE = 0.05; 56 float hash2D( vec2 value ) { 57 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 58 } 59 float hash3D( vec3 value ) { 60 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 61 } 62 float getAlphaHashThreshold( vec3 position ) { 63 float maxDeriv = max( 64 length( dFdx( position.xyz ) ), 65 length( dFdy( position.xyz ) ) 66 ); 67 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 68 vec2 pixScales = vec2( 69 exp2( floor( log2( pixScale ) ) ), 70 exp2( ceil( log2( pixScale ) ) ) 71 ); 72 vec2 alpha = vec2( 73 hash3D( floor( pixScales.x * position.xyz ) ), 74 hash3D( floor( pixScales.y * position.xyz ) ) 75 ); 76 float lerpFactor = fract( log2( pixScale ) ); 77 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 78 float a = min( lerpFactor, 1.0 - lerpFactor ); 79 vec3 cases = vec3( 80 x * x / ( 2.0 * a * ( 1.0 - a ) ), 81 ( x - 0.5 * a ) / ( 1.0 - a ), 82 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 83 ); 84 float threshold = ( x < ( 1.0 - a ) ) 85 ? ( ( x < a ) ? cases.x : cases.y ) 86 : cases.z; 87 return clamp( threshold , 1.0e-6, 1.0 ); 88 } 89#endif`,lv=`#ifdef USE_ALPHAMAP 90 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 91#endif`,cv=`#ifdef USE_ALPHAMAP 92 uniform sampler2D alphaMap; 93#endif`,hv=`#ifdef USE_ALPHATEST 94 #ifdef ALPHA_TO_COVERAGE 95 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 96 if ( diffuseColor.a == 0.0 ) discard; 97 #else 98 if ( diffuseColor.a < alphaTest ) discard; 99 #endif 100#endif`,uv=`#ifdef USE_ALPHATEST 101 uniform float alphaTest; 102#endif`,dv=`#ifdef USE_AOMAP 103 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 104 reflectedLight.indirectDiffuse *= ambientOcclusion; 105 #if defined( USE_CLEARCOAT ) 106 clearcoatSpecularIndirect *= ambientOcclusion; 107 #endif 108 #if defined( USE_SHEEN ) 109 sheenSpecularIndirect *= ambientOcclusion; 110 #endif 111 #if defined( USE_ENVMAP ) && defined( STANDARD )
112 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 113 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 114 #endif 115#endif`,fv=`#ifdef USE_AOMAP 116 uniform sampler2D aoMap; 117 uniform float aoMapIntensity; 118#endif`,Av=`#ifdef USE_BATCHING 119 attribute float batchId; 120 uniform highp sampler2D batchingTexture; 121 mat4 getBatchingMatrix( const in float i ) { 122 int size = textureSize( batchingTexture, 0 ).x; 123 int j = int( i ) * 4; 124 int x = j % size; 125 int y = j / size; 126 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 127 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 128 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 129 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 130 return mat4( v1, v2, v3, v4 ); 131 } 132#endif`,pv=`#ifdef USE_BATCHING 133 mat4 batchingMatrix = getBatchingMatrix( batchId ); 134#endif`,mv=`vec3 transformed = vec3( position ); 135#ifdef USE_ALPHAHASH 136 vPosition = vec3( position ); 137#endif`,gv=`vec3 objectNormal = vec3( normal ); 138#ifdef USE_TANGENT 139 vec3 objectTangent = vec3( tangent.xyz ); 140#endif`,_v=`float G_BlinnPhong_Implicit( ) { 141 return 0.25; 142} 143float D_BlinnPhong( const in float shininess, const in float dotNH ) { 144 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 145} 146vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 147 vec3 halfDir = normalize( lightDir + viewDir ); 148 float dotNH = saturate( dot( normal, halfDir ) ); 149 float dotVH = saturate( dot( viewDir, halfDir ) ); 150 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 151 float G = G_BlinnPhong_Implicit( ); 152 float D = D_BlinnPhong( shininess, dotNH ); 153 return F * ( G * D ); 154} // validated`,Ev=`#ifdef USE_IRIDESCENCE 155 const mat3 XYZ_TO_REC709 = mat3( 156 3.2404542, -0.9692660, 0.0556434, 157 -1.5371385, 1.8760108, -0.2040259, 158 -0.4985314, 0.0415560, 1.0572252 159 ); 160 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 161 vec3 sqrtF0 = sqrt( fresnel0 ); 162 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 163 } 164 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 165 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 166 } 167 float IorToFresnel0( float transmittedIor, float incidentIor ) { 168 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 169 } 170 vec3 evalSensitivity( float OPD, vec3 shift ) { 171 float phase = 2.0 * PI * OPD * 1.0e-9; 172 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 173 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 174 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 175 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 176 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 ) ); 177 xyz /= 1.0685e-7; 178 vec3 rgb = XYZ_TO_REC709 * xyz; 179 return rgb; 180 } 181 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 182 vec3 I; 183 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 184 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 185 float cosTheta2Sq = 1.0 - sinTheta2Sq; 186 if ( cosTheta2Sq < 0.0 ) { 187 return vec3( 1.0 ); 188 } 189 float cosTheta2 = sqrt( cosTheta2Sq ); 190 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 191 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
192 float T121 = 1.0 - R12; 193 float phi12 = 0.0; 194 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 195 float phi21 = PI - phi12; 196 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 197 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 198 vec3 phi23 = vec3( 0.0 ); 199 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 200 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 201 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 202 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 203 vec3 phi = vec3( phi21 ) + phi23; 204 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 205 vec3 r123 = sqrt( R123 ); 206 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 207 vec3 C0 = R12 + Rs; 208 I = C0; 209 vec3 Cm = Rs - T121; 210 for ( int m = 1; m <= 2; ++ m ) { 211 Cm *= r123; 212 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 213 I += Cm * Sm; 214 } 215 return max( I, vec3( 0.0 ) ); 216 } 217#endif`,vv=`#ifdef USE_BUMPMAP 218 uniform sampler2D bumpMap; 219 uniform float bumpScale; 220 vec2 dHdxy_fwd() { 221 vec2 dSTdx = dFdx( vBumpMapUv ); 222 vec2 dSTdy = dFdy( vBumpMapUv ); 223 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 224 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 225 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 226 return vec2( dBx, dBy ); 227 } 228 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 229 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 230 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 231 vec3 vN = surf_norm; 232 vec3 R1 = cross( vSigmaY, vN ); 233 vec3 R2 = cross( vN, vSigmaX ); 234 float fDet = dot( vSigmaX, R1 ) * faceDirection; 235 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 236 return normalize( abs( fDet ) * surf_norm - vGrad ); 237 } 238#endif`,yv=`#if NUM_CLIPPING_PLANES > 0 239 vec4 plane; 240 #ifdef ALPHA_TO_COVERAGE 241 float distanceToPlane, distanceGradient; 242 float clipOpacity = 1.0; 243 #pragma unroll_loop_start 244 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 245 plane = clippingPlanes[ i ]; 246 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 247 distanceGradient = fwidth( distanceToPlane ) / 2.0; 248 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 249 if ( clipOpacity == 0.0 ) discard; 250 } 251 #pragma unroll_loop_end 252 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 253 float unionClipOpacity = 1.0; 254 #pragma unroll_loop_start 255 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 256 plane = clippingPlanes[ i ]; 257 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 258 distanceGradient = fwidth( distanceToPlane ) / 2.0; 259 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 260 } 261 #pragma unroll_loop_end 262 clipOpacity *= 1.0 - unionClipOpacity; 263 #endif 264 diffuseColor.a *= clipOpacity; 265 if ( diffuseColor.a == 0.0 ) discard; 266 #else 267 #pragma unroll_loop_start 268 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 269 plane = clippingPlanes[ i ]; 270 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 271 } 272 #pragma unroll_loop_end 273 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 274 bool clipped = true; 275 #pragma unroll_loop_start 276 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 277 plane = clippingPlanes[ i ]; 278 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 279 } 280 #pragma unroll_loop_end 281 if ( clipped ) discard; 282 #endif 283 #endif 284#endif`,xv=`#if NUM_CLIPPING_PLANES > 0 285 varying vec3 vClipPosition; 286 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 287#endif`,Sv=`#if NUM_CLIPPING_PLANES > 0 288 varying vec3 vClipPosition; 289#endif`,Iv=`#if NUM_CLIPPING_PLANES > 0 290 vClipPosition = - mvPosition.xyz; 291#endif`,Cv=`#if defined( USE_COLOR_ALPHA ) 292 diffuseColor *= vColor; 293#elif defined( USE_COLOR ) 294 diffuseColor.rgb *= vColor; 295#endif`,Mv=`#if defined( USE_COLOR_ALPHA ) 296 varying vec4 vColor; 297#elif defined( USE_COLOR ) 298 varying vec3 vColor; 299#endif`,wv=`#if defined( USE_COLOR_ALPHA ) 300 varying vec4 vColor; 301#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 302 varying vec3 vColor; 303#endif`,bv=`#if defined( USE_COLOR_ALPHA ) 304 vColor = vec4( 1.0 ); 305#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 306 vColor = vec3( 1.0 ); 307#endif 308#ifdef USE_COLOR 309 vColor *= color; 310#endif 311#ifdef USE_INSTANCING_COLOR 312 vColor.xyz *= instanceColor.xyz; 313#endif`,Tv=`#define PI 3.141592653589793 314#define PI2 6.283185307179586 315#define PI_HALF 1.5707963267948966 316#define RECIPROCAL_PI 0.3183098861837907 317#define RECIPROCAL_PI2 0.15915494309189535 318#define EPSILON 1e-6 319#ifndef saturate 320#define saturate( a ) clamp( a, 0.0, 1.0 ) 321#endif 322#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 323float pow2( const in float x ) { return x*x; } 324vec3 pow2( const in vec3 x ) { return x*x; } 325float pow3( const in float x ) { return x*x*x; } 326float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 327float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 328float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 329highp float rand( const in vec2 uv ) { 330 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 331 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 332 return fract( sin( sn ) * c ); 333} 334#ifdef HIGH_PRECISION 335 float precisionSafeLength( vec3 v ) { return length( v ); } 336#else 337 float precisionSafeLength( vec3 v ) { 338 float maxComponent = max3( abs( v ) ); 339 return length( v / maxComponent ) * maxComponent; 340 } 341#endif 342struct IncidentLight { 343 vec3 color; 344 vec3 direction; 345 bool visible; 346}; 347struct ReflectedLight { 348 vec3 directDiffuse; 349 vec3 directSpecular; 350 vec3 indirectDiffuse; 351 vec3 indirectSpecular; 352}; 353#ifdef USE_ALPHAHASH 354 varying vec3 vPosition; 355#endif 356vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 357 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 358} 359vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 360 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 361} 362mat3 transposeMat3( const in mat3 m ) { 363 mat3 tmp; 364 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 365 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 366 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 367 return tmp; 368} 369float luminance( const in vec3 rgb ) { 370 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 371 return dot( weights, rgb ); 372} 373bool isPerspectiveMatrix( mat4 m ) { 374 return m[ 2 ][ 3 ] == - 1.0; 375} 376vec2 equirectUv( in vec3 dir ) { 377 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 378 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 379 return vec2( u, v ); 380}
381vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 382 return RECIPROCAL_PI * diffuseColor; 383} 384vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 385 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 386 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 387} 388float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 389 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 390 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 391} // validated`,Bv=`#ifdef ENVMAP_TYPE_CUBE_UV 392 #define cubeUV_minMipLevel 4.0 393 #define cubeUV_minTileSize 16.0 394 float getFace( vec3 direction ) { 395 vec3 absDirection = abs( direction ); 396 float face = - 1.0; 397 if ( absDirection.x > absDirection.z ) { 398 if ( absDirection.x > absDirection.y ) 399 face = direction.x > 0.0 ? 0.0 : 3.0; 400 else 401 face = direction.y > 0.0 ? 1.0 : 4.0; 402 } else { 403 if ( absDirection.z > absDirection.y ) 404 face = direction.z > 0.0 ? 2.0 : 5.0; 405 else 406 face = direction.y > 0.0 ? 1.0 : 4.0; 407 } 408 return face; 409 } 410 vec2 getUV( vec3 direction, float face ) { 411 vec2 uv; 412 if ( face == 0.0 ) { 413 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 414 } else if ( face == 1.0 ) { 415 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 416 } else if ( face == 2.0 ) { 417 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 418 } else if ( face == 3.0 ) { 419 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 420 } else if ( face == 4.0 ) { 421 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 422 } else { 423 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 424 } 425 return 0.5 * ( uv + 1.0 ); 426 } 427 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 428 float face = getFace( direction ); 429 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 430 mipInt = max( mipInt, cubeUV_minMipLevel ); 431 float faceSize = exp2( mipInt ); 432 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 433 if ( face > 2.0 ) { 434 uv.y += faceSize; 435 face -= 3.0; 436 } 437 uv.x += face * faceSize; 438 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 439 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 440 uv.x *= CUBEUV_TEXEL_WIDTH; 441 uv.y *= CUBEUV_TEXEL_HEIGHT; 442 #ifdef texture2DGradEXT 443 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 444 #else 445 return texture2D( envMap, uv ).rgb; 446 #endif 447 } 448 #define cubeUV_r0 1.0 449 #define cubeUV_m0 - 2.0 450 #define cubeUV_r1 0.8 451 #define cubeUV_m1 - 1.0 452 #define cubeUV_r4 0.4 453 #define cubeUV_m4 2.0 454 #define cubeUV_r5 0.305 455 #define cubeUV_m5 3.0 456 #define cubeUV_r6 0.21 457 #define cubeUV_m6 4.0 458 float roughnessToMip( float roughness ) { 459 float mip = 0.0; 460 if ( roughness >= cubeUV_r1 ) { 461 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 462 } else if ( roughness >= cubeUV_r4 ) { 463 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 464 } else if ( roughness >= cubeUV_r5 ) { 465 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 466 } else if ( roughness >= cubeUV_r6 ) { 467 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 468 } else { 469 mip = - 2.0 * log2( 1.16 * roughness ); } 470 return mip; 471 } 472 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 473 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 474 float mipF = fract( mip ); 475 float mipInt = floor( mip ); 476 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 477 if ( mipF == 0.0 ) { 478 return vec4( color0, 1.0 ); 479 } else { 480 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 481 return vec4( mix( color0, color1, mipF ), 1.0 ); 482 } 483 } 484#endif`,Rv=`vec3 transformedNormal = objectNormal; 485#ifdef USE_TANGENT 486 vec3 transformedTangent = objectTangent; 487#endif 488#ifdef USE_BATCHING 489 mat3 bm = mat3( batchingMatrix ); 490 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 491 transformedNormal = bm * transformedNormal; 492 #ifdef USE_TANGENT 493 transformedTangent = bm * transformedTangent; 494 #endif 495#endif 496#ifdef USE_INSTANCING 497 mat3 im = mat3( instanceMatrix ); 498 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 499 transformedNormal = im * transformedNormal; 500 #ifdef USE_TANGENT 501 transformedTangent = im * transformedTangent; 502 #endif 503#endif 504transformedNormal = normalMatrix * transformedNormal; 505#ifdef FLIP_SIDED 506 transformedNormal = - transformedNormal; 507#endif 508#ifdef USE_TANGENT 509 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 510 #ifdef FLIP_SIDED 511 transformedTangent = - transformedTangent; 512 #endif 513#endif`,Dv=`#ifdef USE_DISPLACEMENTMAP 514 uniform sampler2D displacementMap; 515 uniform float displacementScale; 516 uniform float displacementBias; 517#endif`,Lv=`#ifdef USE_DISPLACEMENTMAP 518 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
518placementBias ); 519#endif`,Pv=`#ifdef USE_EMISSIVEMAP 520 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 521 totalEmissiveRadiance *= emissiveColor.rgb; 522#endif`,Uv=`#ifdef USE_EMISSIVEMAP 523 uniform sampler2D emissiveMap; 524#endif`,Nv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fv=` 525const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 526 vec3( 0.8224621, 0.177538, 0.0 ), 527 vec3( 0.0331941, 0.9668058, 0.0 ), 528 vec3( 0.0170827, 0.0723974, 0.9105199 ) 529); 530const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 531 vec3( 1.2249401, - 0.2249404, 0.0 ), 532 vec3( - 0.0420569, 1.0420571, 0.0 ), 533 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 534); 535vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 536 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 537} 538vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 539 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 540} 541vec4 LinearTransferOETF( in vec4 value ) { 542 return value; 543} 544vec4 sRGBTransferOETF( in vec4 value ) { 545 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 ); 546} 547vec4 LinearToLinear( in vec4 value ) { 548 return value; 549} 550vec4 LinearTosRGB( in vec4 value ) { 551 return sRGBTransferOETF( value ); 552}`,Ov=`#ifdef USE_ENVMAP 553 #ifdef ENV_WORLDPOS 554 vec3 cameraToFrag; 555 if ( isOrthographic ) { 556 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 557 } else { 558 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 559 } 560 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 561 #ifdef ENVMAP_MODE_REFLECTION 562 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 563 #else 564 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 565 #endif 566 #else 567 vec3 reflectVec = vReflect; 568 #endif 569 #ifdef ENVMAP_TYPE_CUBE 570 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 571 #else 572 vec4 envColor = vec4( 0.0 ); 573 #endif 574 #ifdef ENVMAP_BLENDING_MULTIPLY 575 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 576 #elif defined( ENVMAP_BLENDING_MIX ) 577 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 578 #elif defined( ENVMAP_BLENDING_ADD ) 579 outgoingLight += envColor.xyz * specularStrength * reflectivity; 580 #endif 581#endif`,Qv=`#ifdef USE_ENVMAP 582 uniform float envMapIntensity; 583 uniform float flipEnvMap; 584 uniform mat3 envMapRotation; 585 #ifdef ENVMAP_TYPE_CUBE 586 uniform samplerCube envMap; 587 #else 588 uniform sampler2D envMap; 589 #endif 590 591#endif`,kv=`#ifdef USE_ENVMAP 592 uniform float reflectivity; 593 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 594 #define ENV_WORLDPOS 595 #endif 596 #ifdef ENV_WORLDPOS 597 varying vec3 vWorldPosition; 598 uniform float refractionRatio; 599 #else 600 varying vec3 vReflect; 601 #endif 602#endif`,Gv=`#ifdef USE_ENVMAP 603 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 604 #define ENV_WORLDPOS 605 #endif 606 #ifdef ENV_WORLDPOS 607 608 varying vec3 vWorldPosition; 609 #else 610 varying vec3 vReflect; 611 uniform float refractionRatio; 612 #endif 613#endif`,Hv=`#ifdef USE_ENVMAP 614 #ifdef ENV_WORLDPOS 615 vWorldPosition = worldPosition.xyz; 616 #else 617 vec3 cameraToVertex; 618 if ( isOrthographic ) { 619 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 620 } else {
621 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 622 } 623 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 624 #ifdef ENVMAP_MODE_REFLECTION 625 vReflect = reflect( cameraToVertex, worldNormal ); 626 #else 627 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 628 #endif 629 #endif 630#endif`,Vv=`#ifdef USE_FOG 631 vFogDepth = - mvPosition.z; 632#endif`,zv=`#ifdef USE_FOG 633 varying float vFogDepth; 634#endif`,Wv=`#ifdef USE_FOG 635 #ifdef FOG_EXP2 636 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 637 #else 638 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 639 #endif 640 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 641#endif`,$v=`#ifdef USE_FOG 642 uniform vec3 fogColor; 643 varying float vFogDepth; 644 #ifdef FOG_EXP2 645 uniform float fogDensity; 646 #else 647 uniform float fogNear; 648 uniform float fogFar; 649 #endif 650#endif`,qv=`#ifdef USE_GRADIENTMAP 651 uniform sampler2D gradientMap; 652#endif 653vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 654 float dotNL = dot( normal, lightDirection ); 655 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 656 #ifdef USE_GRADIENTMAP 657 return vec3( texture2D( gradientMap, coord ).r ); 658 #else 659 vec2 fw = fwidth( coord ) * 0.5; 660 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 661 #endif 662}`,Xv=`#ifdef USE_LIGHTMAP 663 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 664 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 665 reflectedLight.indirectDiffuse += lightMapIrradiance; 666#endif`,Yv=`#ifdef USE_LIGHTMAP 667 uniform sampler2D lightMap; 668 uniform float lightMapIntensity; 669#endif`,Kv=`LambertMaterial material; 670material.diffuseColor = diffuseColor.rgb; 671material.specularStrength = specularStrength;`,Jv=`varying vec3 vViewPosition; 672struct LambertMaterial { 673 vec3 diffuseColor; 674 float specularStrength; 675}; 676void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 677 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 678 vec3 irradiance = dotNL * directLight.color; 679 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 680} 681void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 682 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 683} 684#define RE_Direct RE_Direct_Lambert 685#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,jv=`uniform bool receiveShadow; 686uniform vec3 ambientLightColor; 687#if defined( USE_LIGHT_PROBES ) 688 uniform vec3 lightProbe[ 9 ]; 689#endif 690vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 691 float x = normal.x, y = normal.y, z = normal.z; 692 vec3 result = shCoefficients[ 0 ] * 0.886227; 693 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 694 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 695 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 696 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 697 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 698 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 699 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 700 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 701 return result; 702} 703vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 704 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 705 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 706 return irradiance; 707} 708vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 709 vec3 irradiance = ambientLightColor; 710 return irradiance; 711} 712float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 713 #if defined ( LEGACY_LIGHTS ) 714 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 715 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 716 } 717 return 1.0; 718 #else 719 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 720 if ( cutoffDistance > 0.0 ) { 721 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 722 } 723 return distanceFalloff; 724 #endif 725} 726float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 727 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 728} 729#if NUM_DIR_LIGHTS > 0 730 struct DirectionalLight { 731 vec3 direction; 732 vec3 color; 733 }; 734 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 735 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 736 light.color = directionalLight.color; 737 light.direction = directionalLight.direction; 738 light.visible = true; 739 } 740#endif 741#if NUM_POINT_LIGHTS > 0 742 struct PointLight { 743 vec3 position; 744 vec3 color; 745 float distance; 746 float decay; 747 }; 748 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 749 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 750 vec3 lVector = pointLight.position - geometryPosition; 751 light.direction = normalize( lVector ); 752 float lightDistance = length( lVector ); 753 light.color = pointLight.color; 754 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 755 light.visible = ( light.color != vec3( 0.0 ) ); 756 } 757#endif
758#if NUM_SPOT_LIGHTS > 0 759 struct SpotLight { 760 vec3 position; 761 vec3 direction; 762 vec3 color; 763 float distance; 764 float decay; 765 float coneCos; 766 float penumbraCos; 767 }; 768 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 769 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 770 vec3 lVector = spotLight.position - geometryPosition; 771 light.direction = normalize( lVector ); 772 float angleCos = dot( light.direction, spotLight.direction ); 773 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 774 if ( spotAttenuation > 0.0 ) { 775 float lightDistance = length( lVector ); 776 light.color = spotLight.color * spotAttenuation; 777 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 778 light.visible = ( light.color != vec3( 0.0 ) ); 779 } else { 780 light.color = vec3( 0.0 ); 781 light.visible = false; 782 } 783 } 784#endif 785#if NUM_RECT_AREA_LIGHTS > 0 786 struct RectAreaLight { 787 vec3 color; 788 vec3 position; 789 vec3 halfWidth; 790 vec3 halfHeight; 791 }; 792 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 793 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 794#endif 795#if NUM_HEMI_LIGHTS > 0 796 struct HemisphereLight { 797 vec3 direction; 798 vec3 skyColor; 799 vec3 groundColor; 800 }; 801 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 802 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 803 float dotNL = dot( normal, hemiLight.direction ); 804 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 805 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 806 return irradiance; 807 } 808#endif`,Zv=`#ifdef USE_ENVMAP 809 vec3 getIBLIrradiance( const in vec3 normal ) { 810 #ifdef ENVMAP_TYPE_CUBE_UV 811 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 812 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 813 return PI * envMapColor.rgb * envMapIntensity; 814 #else 815 return vec3( 0.0 ); 816 #endif 817 } 818 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 819 #ifdef ENVMAP_TYPE_CUBE_UV 820 vec3 reflectVec = reflect( - viewDir, normal ); 821 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 822 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 823 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 824 return envMapColor.rgb * envMapIntensity; 825 #else 826 return vec3( 0.0 ); 827 #endif 828 } 829 #ifdef USE_ANISOTROPY 830 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 831 #ifdef ENVMAP_TYPE_CUBE_UV 832 vec3 bentNormal = cross( bitangent, viewDir ); 833 bentNormal = normalize( cross( bentNormal, bitangent ) ); 834 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 835 return getIBLRadiance( viewDir, bentNormal, roughness ); 836 #else 837 return vec3( 0.0 ); 838 #endif 839 } 840 #endif 841#endif`,ey=`ToonMaterial material; 842material.diffuseColor = diffuseColor.rgb;`,ty=`varying vec3 vViewPosition; 843struct ToonMaterial { 844 vec3 diffuseColor; 845}; 846void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 847 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 848 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 849} 850void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 851 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 852} 853#define RE_Direct RE_Direct_Toon 854#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ny=`BlinnPhongMaterial material; 855material.diffuseColor = diffuseColor.rgb; 856material.specularColor = specular; 857material.specularShininess = shininess; 858material.specularStrength = specularStrength;
858`,iy=`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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 866 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 867 vec3 irradiance = dotNL * directLight.color; 868 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 869 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 870} 871void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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`,sy=`PhysicalMaterial material; 876material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 877vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 878float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 879material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 880material.roughness = min( material.roughness, 1.0 ); 881#ifdef IOR 882 material.ior = ior; 883 #ifdef USE_SPECULAR 884 float specularIntensityFactor = specularIntensity; 885 vec3 specularColorFactor = specularColor; 886 #ifdef USE_SPECULAR_COLORMAP 887 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 888 #endif 889 #ifdef USE_SPECULAR_INTENSITYMAP 890 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 891 #endif 892 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 893 #else 894 float specularIntensityFactor = 1.0; 895 vec3 specularColorFactor = vec3( 1.0 ); 896 material.specularF90 = 1.0; 897 #endif 898 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 899#else 900 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 901 material.specularF90 = 1.0; 902#endif 903#ifdef USE_CLEARCOAT 904 material.clearcoat = clearcoat; 905 material.clearcoatRoughness = clearcoatRoughness; 906 material.clearcoatF0 = vec3( 0.04 ); 907 material.clearcoatF90 = 1.0; 908 #ifdef USE_CLEARCOATMAP 909 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 910 #endif 911 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 912 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 913 #endif 914 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 915 material.clearcoatRoughness += geometryRoughness; 916 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 917#endif 918#ifdef USE_IRIDESCENCE 919 material.iridescence = iridescence; 920 material.iridescenceIOR = iridescenceIOR; 921 #ifdef USE_IRIDESCENCEMAP 922 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 923 #endif 924 #ifdef USE_IRIDESCENCE_THICKNESSMAP 925 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 926 #else 927 material.iridescenceThickness = iridescenceThicknessMaximum; 928 #endif 929#endif 930#ifdef USE_SHEEN 931 material.sheenColor = sheenColor; 932 #ifdef USE_SHEEN_COLORMAP 933 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 934 #endif 935 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 936 #ifdef USE_SHEEN_ROUGHNESSMAP 937 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 938 #endif 939#endif 940#ifdef USE_ANISOTROPY 941 #ifdef USE_ANISOTROPYMAP 942 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 943 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 944 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 945 #else 946 vec2 anisotropyV = anisotropyVector; 947 #endif 948 material.anisotropy = length( anisotropyV ); 949 if( material.anisotropy == 0.0 ) { 950 anisotropyV = vec2( 1.0, 0.0 ); 951 } else { 952 anisotropyV /= material.anisotropy; 953 material.anisotropy = saturate( material.anisotropy ); 954 } 955 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
956 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 957 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 958#endif`,ry=`struct PhysicalMaterial { 959 vec3 diffuseColor; 960 float roughness; 961 vec3 specularColor; 962 float specularF90
vendor: 14,563 bytes, lines 962-1258
962; 963 #ifdef USE_CLEARCOAT 964 float clearcoat; 965 float clearcoatRoughness; 966 vec3 clearcoatF0; 967 float clearcoatF90; 968 #endif 969 #ifdef USE_IRIDESCENCE 970 float iridescence; 971 float iridescenceIOR; 972 float iridescenceThickness; 973 vec3 iridescenceFresnel; 974 vec3 iridescenceF0; 975 #endif 976 #ifdef USE_SHEEN 977 vec3 sheenColor; 978 float sheenRoughness; 979 #endif 980 #ifdef IOR 981 float ior; 982 #endif 983 #ifdef USE_TRANSMISSION 984 float transmission; 985 float transmissionAlpha; 986 float thickness; 987 float attenuationDistance; 988 vec3 attenuationColor; 989 #endif 990 #ifdef USE_ANISOTROPY 991 float anisotropy; 992 float alphaT; 993 vec3 anisotropyT; 994 vec3 anisotropyB; 995 #endif 996}; 997vec3 clearcoatSpecularDirect = vec3( 0.0 ); 998vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 999vec3 sheenSpecularDirect = vec3( 0.0 ); 1000vec3 sheenSpecularIndirect = vec3(0.0 ); 1001vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1002 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1003 float x2 = x * x; 1004 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1005 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1006} 1007float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1008 float a2 = pow2( alpha ); 1009 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1010 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1011 return 0.5 / max( gv + gl, EPSILON ); 1012} 1013float D_GGX( const in float alpha, const in float dotNH ) { 1014 float a2 = pow2( alpha ); 1015 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1016 return RECIPROCAL_PI * a2 / pow2( denom ); 1017} 1018#ifdef USE_ANISOTROPY 1019 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1020 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1021 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1022 float v = 0.5 / ( gv + gl ); 1023 return saturate(v); 1024 } 1025 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1026 float a2 = alphaT * alphaB; 1027 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1028 highp float v2 = dot( v, v ); 1029 float w2 = a2 / v2; 1030 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1031 } 1032#endif 1033#ifdef USE_CLEARCOAT 1034 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1035 vec3 f0 = material.clearcoatF0; 1036 float f90 = material.clearcoatF90; 1037 float roughness = material.clearcoatRoughness; 1038 float alpha = pow2( roughness ); 1039 vec3 halfDir = normalize( lightDir + viewDir ); 1040 float dotNL = saturate( dot( normal, lightDir ) ); 1041 float dotNV = saturate( dot( normal, viewDir ) ); 1042 float dotNH = saturate( dot( normal, halfDir ) ); 1043 float dotVH = saturate( dot( viewDir, halfDir ) ); 1044 vec3 F = F_Schlick( f0, f90, dotVH ); 1045 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1046 float D = D_GGX( alpha, dotNH ); 1047 return F * ( V * D ); 1048 } 1049#endif 1050vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1051 vec3 f0 = material.specularColor; 1052 float f90 = material.specularF90; 1053 float roughness = material.roughness; 1054 float alpha = pow2( roughness ); 1055 vec3 halfDir = normalize( lightDir + viewDir ); 1056 float dotNL = saturate( dot( normal, lightDir ) ); 1057 float dotNV = saturate( dot( normal, viewDir ) ); 1058 float dotNH = saturate( dot( normal, halfDir ) ); 1059 float dotVH = saturate( dot( viewDir, halfDir ) ); 1060 vec3 F = F_Schlick( f0, f90, dotVH ); 1061 #ifdef USE_IRIDESCENCE 1062 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1063 #endif 1064 #ifdef USE_ANISOTROPY 1065 float dotTL = dot( material.anisotropyT, lightDir ); 1066 float dotTV = dot( material.anisotropyT, viewDir ); 1067 float dotTH = dot( material.anisotropyT, halfDir ); 1068 float dotBL = dot( material.anisotropyB, lightDir ); 1069 float dotBV = dot( material.anisotropyB, viewDir ); 1070 float dotBH = dot( material.anisotropyB, halfDir ); 1071 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1072 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1073 #else 1074 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1075 float D = D_GGX( alpha, dotNH ); 1076 #endif 1077 return F * ( V * D ); 1078} 1079vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1080 const float LUT_SIZE = 64.0; 1081 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1082 const float LUT_BIAS = 0.5 / LUT_SIZE; 1083 float dotNV = saturate( dot( N, V ) ); 1084 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1085 uv = uv * LUT_SCALE + LUT_BIAS; 1086 return uv; 1087} 1088float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1089 float l = length( f ); 1090 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1091} 1092vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1093 float x = dot( v1, v2 ); 1094 float y = abs( x ); 1095 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1096 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1097 float v = a / b; 1098 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1099 return cross( v1, v2 ) * theta_sintheta; 1100} 1101vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1102 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1103 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1104 vec3 lightNormal = cross( v1, v2 ); 1105 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1106 vec3 T1, T2; 1107 T1 = normalize( V - N * dot( V, N ) ); 1108 T2 = - cross( N, T1 ); 1109 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1110 vec3 coords[ 4 ]; 1111 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1112 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1113 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1114 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1115 coords[ 0 ] = normalize( coords[ 0 ] ); 1116 coords[ 1 ] = normalize( coords[ 1 ] ); 1117 coords[ 2 ] = normalize( coords[ 2 ] ); 1118 coords[ 3 ] = normalize( coords[ 3 ] ); 1119 vec3 vectorFormFactor = vec3( 0.0 ); 1120 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1121 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1122 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1123 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1124 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1125 return vec3( result ); 1126} 1127#if defined( USE_SHEEN ) 1128float D_Charlie( float roughness, float dotNH ) { 1129 float alpha = pow2( roughness ); 1130 float invAlpha = 1.0 / alpha; 1131 float cos2h = dotNH * dotNH; 1132 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1133 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1134} 1135float V_Neubelt( float dotNV, float dotNL ) { 1136 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1137} 1138vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1139 vec3 halfDir = normalize( lightDir + viewDir ); 1140 float dotNL = saturate( dot( normal, lightDir ) ); 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 float dotNH = saturate( dot( normal, halfDir ) ); 1143 float D = D_Charlie( sheenRoughness, dotNH ); 1144 float V = V_Neubelt( dotNV, dotNL ); 1145 return sheenColor * ( D * V ); 1146} 1147#endif 1148float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1149 float dotNV = saturate( dot( normal, viewDir ) ); 1150 float r2 = roughness * roughness; 1151 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1152 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1153 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1154 return saturate( DG * RECIPROCAL_PI ); 1155} 1156vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1157 float dotNV = saturate( dot( normal, viewDir ) ); 1158 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1159 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1160 vec4 r = roughness * c0 + c1; 1161 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1162 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1163 return fab; 1164} 1165vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1166 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1167 return specularColor * fab.x + specularF90 * fab.y; 1168} 1169#ifdef USE_IRIDESCENCE 1170void 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 ) { 1171#else 1172void 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 ) { 1173#endif 1174 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1175 #ifdef USE_IRIDESCENCE 1176 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1177 #else 1178 vec3 Fr = specularColor; 1179 #endif 1180 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1181 float Ess = fab.x + fab.y; 1182 float Ems = 1.0 - Ess; 1183 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1184 singleScatter += FssEss; 1185 multiScatter += Fms * Ems; 1186} 1187#if NUM_RECT_AREA_LIGHTS > 0 1188 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1189 vec3 normal = geometryNormal; 1190 vec3 viewDir = geometryViewDir; 1191 vec3 position = geometryPosition; 1192 vec3 lightPos = rectAreaLight.position; 1193 vec3 halfWidth = rectAreaLight.halfWidth; 1194 vec3 halfHeight = rectAreaLight.halfHeight; 1195 vec3 lightColor = rectAreaLight.color; 1196 float roughness = material.roughness; 1197 vec3 rectCoords[ 4 ]; 1198 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1199 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1200 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1201 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1202 vec4 t1 = texture2D( ltc_1, uv ); 1203 vec4 t2 = texture2D( ltc_2, uv ); 1204 mat3 mInv = mat3( 1205 vec3( t1.x, 0, t1.y ), 1206 vec3( 0, 1, 0 ), 1207 vec3( t1.z, 0, t1.w ) 1208 ); 1209 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1210 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1211 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1212 } 1213#endif 1214void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1215 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1216 vec3 irradiance = dotNL * directLight.color; 1217 #ifdef USE_CLEARCOAT 1218 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1219 vec3 ccIrradiance = dotNLcc * directLight.color; 1220 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1221 #endif 1222 #ifdef USE_SHEEN 1223 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1224 #endif 1225 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1226 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1227} 1228void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1229 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1230} 1231void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1232 #ifdef USE_CLEARCOAT 1233 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1234 #endif 1235 #ifdef USE_SHEEN 1236 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1237 #endif 1238 vec3 singleScattering = vec3( 0.0 ); 1239 vec3 multiScattering = vec3( 0.0 ); 1240 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1241 #ifdef USE_IRIDESCENCE 1242 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1243 #else 1244 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1245 #endif 1246 vec3 totalScattering = singleScattering + multiScattering; 1247 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1248 reflectedLight.indirectSpecular += radiance * singleScattering; 1249 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1250 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1251} 1252#define RE_Direct RE_Direct_Physical 1253#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1254#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1255#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1256float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1257 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1258}`,
1258oy=` 1259vec3 geometryPosition = - vViewPosition; 1260vec3 geometryNormal = normal; 1261vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1262vec3 geometryClearcoatNormal = vec3( 0.0 ); 1263#ifdef USE_CLEARCOAT 1264 geometryClearcoatNormal = clearcoatNormal; 1265#endif 1266#ifdef USE_IRIDESCENCE 1267 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1268 if ( material.iridescenceThickness == 0.0 ) { 1269 material.iridescence = 0.0; 1270 } else { 1271 material.iridescence = saturate( material.iridescence ); 1272 } 1273 if ( material.iridescence > 0.0 ) { 1274 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1275 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1276 } 1277#endif 1278IncidentLight directLight; 1279#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1280 PointLight pointLight; 1281 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1282 PointLightShadow pointLightShadow; 1283 #endif 1284 #pragma unroll_loop_start 1285 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1286 pointLight = pointLights[ i ]; 1287 getPointLightInfo( pointLight, geometryPosition, directLight ); 1288 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1289 pointLightShadow = pointLightShadows[ i ]; 1290 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1291 #endif 1292 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1293 } 1294 #pragma unroll_loop_end 1295#endif 1296#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1297 SpotLight spotLight; 1298 vec4 spotColor; 1299 vec3 spotLightCoord; 1300 bool inSpotLightMap; 1301 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1302 SpotLightShadow spotLightShadow; 1303 #endif 1304 #pragma unroll_loop_start 1305 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1306 spotLight = spotLights[ i ]; 1307 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1308 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1309 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1310 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1311 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1312 #else 1313 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1314 #endif 1315 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1316 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1317 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1318 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1319 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1320 #endif 1321 #undef SPOT_LIGHT_MAP_INDEX 1322 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1323 spotLightShadow = spotLightShadows[ i ]; 1324 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1325 #endif 1326 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1327 } 1328 #pragma unroll_loop_end 1329#endif 1330#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1331 DirectionalLight directionalLight; 1332 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1333 DirectionalLightShadow directionalLightShadow; 1334 #endif 1335 #pragma unroll_loop_start 1336 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1337 directionalLight = directionalLights[ i ]; 1338 getDirectionalLightInfo( directionalLight, directLight ); 1339 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1340 directionalLightShadow = directionalLightShadows[ i ]; 1341 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1342 #endif 1343 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1344 } 1345 #pragma unroll_loop_end 1346#endif 1347#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1348 RectAreaLight rectAreaLight; 1349 #pragma unroll_loop_start 1350 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1351 rectAreaLight = rectAreaLights[ i ]; 1352 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1353 } 1354 #pragma unroll_loop_end 1355#endif 1356#if defined( RE_IndirectDiffuse ) 1357 vec3 iblIrradiance = vec3( 0.0 ); 1358 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1359 #if defined( USE_LIGHT_PROBES ) 1360 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1361 #endif 1362 #if ( NUM_HEMI_LIGHTS > 0 ) 1363 #pragma unroll_loop_start 1364 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1365 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1366 } 1367 #pragma unroll_loop_end 1368 #endif 1369#endif 1370#if defined( RE_IndirectSpecular ) 1371 vec3 radiance = vec3( 0.0 ); 1372 vec3 clearcoatRadiance = vec3( 0.0 ); 1373#endif`,ay=`#if defined( RE_IndirectDiffuse ) 1374 #ifdef USE_LIGHTMAP 1375 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1376 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1377 irradiance += lightMapIrradiance; 1378 #endif 1379 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1380 iblIrradiance += getIBLIrradiance( geometryNormal ); 1381 #endif 1382#endif 1383#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1384 #ifdef USE_ANISOTROPY 1385 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1386 #else 1387 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1388 #endif 1389 #ifdef USE_CLEARCOAT 1390 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1391 #endif 1392#endif`,ly=`#if defined( RE_IndirectDiffuse ) 1393 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1394#endif 1395#if defined( RE_IndirectSpecular ) 1396 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1397#endif`,cy=`#if defined( USE_LOGDEPTHBUF ) 1398 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1399#endif`,hy=`#if defined( USE_LOGDEPTHBUF ) 1400 uniform float logDepthBufFC; 1401 varying float vFragDepth; 1402 varying float vIsPerspective; 1403#endif`,uy=`#ifdef USE_LOGDEPTHBUF 1404 varying float vFragDepth; 1405 varying float vIsPerspective; 1406#endif`,dy=`#ifdef USE_LOGDEPTHBUF 1407 vFragDepth = 1.0 + gl_Position.w; 1408 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1409#endif`,fy=`#ifdef USE_MAP 1410 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1411 #ifdef DECODE_VIDEO_TEXTURE 1412 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 ); 1413 1414 #endif 1415 diffuseColor *= sampledDiffuseColor; 1416#endif`,Ay=`#ifdef USE_MAP 1417 uniform sampler2D map; 1418#endif`,py=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1419 #if defined( USE_POINTS_UV ) 1420 vec2 uv = vUv; 1421 #else 1422 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1423 #endif 1424#endif 1425#ifdef USE_MAP 1426 diffuseColor *= texture2D( map, uv ); 1427#endif 1428#ifdef USE_ALPHAMAP 1429 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1430#endif`,my=`#if defined( USE_POINTS_UV ) 1431 varying vec2 vUv; 1432#else 1433 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1434 uniform mat3 uvTransform; 1435 #endif 1436#endif 1437#ifdef USE_MAP 1438 uniform sampler2D map; 1439#endif 1440#ifdef USE_ALPHAMAP 1441 uniform sampler2D alphaMap; 1442#endif`,gy=`float metalnessFactor = metalness; 1443#ifdef USE_METALNESSMAP 1444 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1445 metalnessFactor *= texelMetalness.b; 1446#endif`,_y=`#ifdef USE_METALNESSMAP 1447 uniform sampler2D metalnessMap; 1448#endif`,Ey=`#ifdef USE_INSTANCING_MORPH 1449 float morphTargetInfluences[MORPHTARGETS_COUNT]; 1450 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1451 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1452 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1453 } 1454#endif`,vy=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1455 vColor *= morphTargetBaseInfluence; 1456 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1457 #if defined( USE_COLOR_ALPHA ) 1458 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1459 #elif defined( USE_COLOR ) 1460 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1461 #endif 1462 } 1463#endif`,yy=`#ifdef USE_MORPHNORMALS 1464 objectNormal *= morphTargetBaseInfluence; 1465 #ifdef MORPHTARGETS_TEXTURE 1466 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1467 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1468 } 1469 #else 1470 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1471 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1472 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1473 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1474 #endif 1475#endif`,xy=`#ifdef USE_MORPHTARGETS 1476 #ifndef USE_INSTANCING_MORPH 1477 uniform float morphTargetBaseInfluence; 1478 #endif 1479 #ifdef MORPHTARGETS_TEXTURE 1480 #ifndef USE_INSTANCING_MORPH 1481 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1482 #endif 1483 uniform sampler2DArray morphTargetsTexture; 1484 uniform ivec2 morphTargetsTextureSize; 1485 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1486 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1487 int y = texelIndex / morphTargetsTextureSize.x; 1488 int x = texelIndex - y * morphTargetsTextureSize.x; 1489 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1490 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1491 } 1492 #else 1493 #ifndef USE_MORPHNORMALS 1494 uniform float morphTargetInfluences[ 8 ]; 1495 #else 1496 uniform float morphTargetInfluences[ 4 ]; 1497 #endif 1498 #endif 1499#endif`,Sy=`#ifdef USE_MORPHTARGETS 1500 transformed *= morphTargetBaseInfluence; 1501 #ifdef MORPHTARGETS_TEXTURE 1502 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1503 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1504 } 1505 #else 1506 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1507 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1508 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1509 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1510 #ifndef USE_MORPHNORMALS 1511 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1512 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1513 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1514 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1515 #endif 1516 #endif 1517#endif`,Iy=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1518#ifdef FLAT_SHADED 1519 vec3 fdx = dFdx( vViewPosition ); 1520 vec3 fdy = dFdy( vViewPosition ); 1521 vec3 normal = normalize( cross( fdx, fdy ) ); 1522#else 1523 vec3 normal = normalize( vNormal ); 1524 #ifdef DOUBLE_SIDED 1525 normal *= faceDirection; 1526 #endif 1527#endif 1528#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1529 #ifdef USE_TANGENT 1530 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1531 #else 1532 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1533 #if defined( USE_NORMALMAP ) 1534 vNormalMapUv 1535 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1536 vClearcoatNormalMapUv 1537 #else 1538 vUv 1539 #endif 1540 ); 1541 #endif 1542 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1543 tbn[0] *= faceDirection; 1544 tbn[1] *= faceDirection; 1545 #endif 1546#endif 1547#ifdef USE_CLEARCOAT_NORMALMAP 1548 #ifdef USE_TANGENT 1549 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1550 #else 1551 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1552 #endif 1553 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1554 tbn2[0] *= faceDirection; 1555 tbn2[1] *= faceDirection; 1556 #endif 1557#endif 1558vec3 nonPerturbedNormal = normal;`,Cy=`#ifdef USE_NORMALMAP_OBJECTSPACE 1559 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1560 #ifdef FLIP_SIDED 1561 normal = - normal; 1562 #endif 1563 #ifdef DOUBLE_SIDED 1564 normal = normal * faceDirection; 1565 #endif 1566 normal = normalize( normalMatrix * normal ); 1567#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1568 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1569 mapN.xy *= normalScale; 1570 normal = normalize( tbn * mapN ); 1571#elif defined( USE_BUMPMAP )
1572 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1573#endif`,My=`#ifndef FLAT_SHADED 1574 varying vec3 vNormal; 1575 #ifdef USE_TANGENT 1576 varying vec3 vTangent; 1577 varying vec3 vBitangent; 1578 #endif 1579#endif`,wy=`#ifndef FLAT_SHADED 1580 varying vec3 vNormal; 1581 #ifdef USE_TANGENT 1582 varying vec3 vTangent; 1583 varying vec3 vBitangent; 1584 #endif 1585#endif`,by=`#ifndef FLAT_SHADED 1586 vNormal = normalize( transformedNormal ); 1587 #ifdef USE_TANGENT 1588 vTangent = normalize( transformedTangent ); 1589 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1590 #endif 1591#endif`,Ty=`#ifdef USE_NORMALMAP 1592 uniform sampler2D normalMap; 1593 uniform vec2 normalScale; 1594#endif 1595#ifdef USE_NORMALMAP_OBJECTSPACE 1596 uniform mat3 normalMatrix; 1597#endif 1598#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1599 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1600 vec3 q0 = dFdx( eye_pos.xyz ); 1601 vec3 q1 = dFdy( eye_pos.xyz ); 1602 vec2 st0 = dFdx( uv.st ); 1603 vec2 st1 = dFdy( uv.st ); 1604 vec3 N = surf_norm; 1605 vec3 q1perp = cross( q1, N ); 1606 vec3 q0perp = cross( N, q0 ); 1607 vec3 T = q1perp * st0.x + q0perp * st1.x; 1608 vec3 B = q1perp * st0.y + q0perp * st1.y; 1609 float det = max( dot( T, T ), dot( B, B ) ); 1610 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1611 return mat3( T * scale, B * scale, N ); 1612 } 1613#endif`,By=`#ifdef USE_CLEARCOAT 1614 vec3 clearcoatNormal = nonPerturbedNormal; 1615#endif`,Ry=`#ifdef USE_CLEARCOAT_NORMALMAP 1616 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1617 clearcoatMapN.xy *= clearcoatNormalScale; 1618 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1619#endif`,Dy=`#ifdef USE_CLEARCOATMAP 1620 uniform sampler2D clearcoatMap; 1621#endif 1622#ifdef USE_CLEARCOAT_NORMALMAP 1623 uniform sampler2D clearcoatNormalMap; 1624 uniform vec2 clearcoatNormalScale; 1625#endif 1626#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1627 uniform sampler2D clearcoatRoughnessMap; 1628#endif`,Ly=`#ifdef USE_IRIDESCENCEMAP 1629 uniform sampler2D iridescenceMap; 1630#endif 1631#ifdef USE_IRIDESCENCE_THICKNESSMAP 1632 uniform sampler2D iridescenceThicknessMap; 1633#endif`,Py=`#ifdef OPAQUE 1634diffuseColor.a = 1.0; 1635#endif 1636#ifdef USE_TRANSMISSION 1637diffuseColor.a *= material.transmissionAlpha; 1638#endif 1639gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Uy=`vec3 packNormalToRGB( const in vec3 normal ) { 1640 return normalize( normal ) * 0.5 + 0.5; 1641} 1642vec3 unpackRGBToNormal( const in vec3 rgb ) { 1643 return 2.0 * rgb.xyz - 1.0; 1644} 1645const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1646const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1647const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1648const float ShiftRight8 = 1. / 256.; 1649vec4 packDepthToRGBA( const in float v ) { 1650 vec4 r = vec4( fract( v * PackFactors ), v ); 1651 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1652} 1653float unpackRGBAToDepth( const in vec4 v ) { 1654 return dot( v, UnpackFactors ); 1655} 1656vec2 packDepthToRG( in highp float v ) { 1657 return packDepthToRGBA( v ).yx; 1658} 1659float unpackRGToDepth( const in highp vec2 v ) { 1660 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1661} 1662vec4 pack2HalfToRGBA( vec2 v ) { 1663 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1664 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1665} 1666vec2 unpackRGBATo2Half( vec4 v ) { 1667 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1668} 1669float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1670 return ( viewZ + near ) / ( near - far ); 1671} 1672float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1673 return depth * ( near - far ) - near; 1674} 1675float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1676 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1677} 1678float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1679 return ( near * far ) / ( ( far - near ) * depth - far ); 1680}`,Ny=`#ifdef PREMULTIPLIED_ALPHA 1681 gl_FragColor.rgb *= gl_FragColor.a; 1682#endif`,Fy=`vec4 mvPosition = vec4( transformed, 1.0 ); 1683#ifdef USE_BATCHING 1684 mvPosition = batchingMatrix * mvPosition; 1685#endif 1686#ifdef USE_INSTANCING 1687 mvPosition = instanceMatrix * mvPosition; 1688#endif 1689mvPosition = modelViewMatrix * mvPosition; 1690gl_Position = projectionMatrix * mvPosition;`,Oy=`#ifdef DITHERING 1691 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1692#endif`,Qy=`#ifdef DITHERING 1693 vec3 dithering( vec3 color ) { 1694 float grid_position = rand( gl_FragCoord.xy ); 1695 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1696 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1697 return color + dither_shift_RGB; 1698 } 1699#endif`,ky=`float roughnessFactor = roughness; 1700#ifdef USE_ROUGHNESSMAP 1701 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1702 roughnessFactor *= texelRoughness.g; 1703#endif`,Gy=`#ifdef USE_ROUGHNESSMAP 1704 uniform sampler2D roughnessMap; 1705#endif`,Hy
vendor: 8,706 bytes, lines 1705-1888
1705=`#if NUM_SPOT_LIGHT_COORDS > 0 1706 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1707#endif 1708#if NUM_SPOT_LIGHT_MAPS > 0 1709 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1710#endif 1711#ifdef USE_SHADOWMAP 1712 #if NUM_DIR_LIGHT_SHADOWS > 0 1713 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1714 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1715 struct DirectionalLightShadow { 1716 float shadowBias; 1717 float shadowNormalBias; 1718 float shadowRadius; 1719 vec2 shadowMapSize; 1720 }; 1721 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1722 #endif 1723 #if NUM_SPOT_LIGHT_SHADOWS > 0 1724 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1725 struct SpotLightShadow { 1726 float shadowBias; 1727 float shadowNormalBias; 1728 float shadowRadius; 1729 vec2 shadowMapSize; 1730 }; 1731 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1732 #endif 1733 #if NUM_POINT_LIGHT_SHADOWS > 0 1734 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1735 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1736 struct PointLightShadow { 1737 float shadowBias; 1738 float shadowNormalBias; 1739 float shadowRadius; 1740 vec2 shadowMapSize; 1741 float shadowCameraNear; 1742 float shadowCameraFar; 1743 }; 1744 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1745 #endif 1746 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1747 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1748 } 1749 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1750 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1751 } 1752 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1753 float occlusion = 1.0; 1754 vec2 distribution = texture2DDistribution( shadow, uv ); 1755 float hard_shadow = step( compare , distribution.x ); 1756 if (hard_shadow != 1.0 ) { 1757 float distance = compare - distribution.x ; 1758 float variance = max( 0.00000, distribution.y * distribution.y ); 1759 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 ); 1760 } 1761 return occlusion; 1762 } 1763 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1764 float shadow = 1.0; 1765 shadowCoord.xyz /= shadowCoord.w; 1766 shadowCoord.z += shadowBias; 1767 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1768 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1769 if ( frustumTest ) { 1770 #if defined( SHADOWMAP_TYPE_PCF ) 1771 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1772 float dx0 = - texelSize.x * shadowRadius; 1773 float dy0 = - texelSize.y * shadowRadius; 1774 float dx1 = + texelSize.x * shadowRadius; 1775 float dy1 = + texelSize.y * shadowRadius; 1776 float dx2 = dx0 / 2.0; 1777 float dy2 = dy0 / 2.0; 1778 float dx3 = dx1 / 2.0; 1779 float dy3 = dy1 / 2.0; 1780 shadow = ( 1781 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1790 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1791 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1792 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1793 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1794 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1795 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1796 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1797 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1798 ) * ( 1.0 / 17.0 ); 1799 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1800 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1801 float dx = texelSize.x; 1802 float dy = texelSize.y; 1803 vec2 uv = shadowCoord.xy; 1804 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1805 uv -= f * texelSize; 1806 shadow = ( 1807 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1808 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1809 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1810 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1811 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1812 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1813 f.x ) + 1814 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1815 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1816 f.x ) + 1817 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1818 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1819 f.y ) + 1820 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1821 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1822 f.y ) + 1823 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1824 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1825 f.x ), 1826 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1827 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1828 f.x ), 1829 f.y ) 1830 ) * ( 1.0 / 9.0 ); 1831 #elif defined( SHADOWMAP_TYPE_VSM ) 1832 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1833 #else 1834 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1835 #endif 1836 } 1837 return shadow; 1838 } 1839 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1840 vec3 absV = abs( v ); 1841 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1842 absV *= scaleToCube; 1843 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1844 vec2 planar = v.xy; 1845 float almostATexel = 1.5 * texelSizeY; 1846 float almostOne = 1.0 - almostATexel; 1847 if ( absV.z >= almostOne ) { 1848 if ( v.z > 0.0 ) 1849 planar.x = 4.0 - v.x; 1850 } else if ( absV.x >= almostOne ) { 1851 float signX = sign( v.x ); 1852 planar.x = v.z * signX + 2.0 * signX; 1853 } else if ( absV.y >= almostOne ) { 1854 float signY = sign( v.y ); 1855 planar.x = v.x + 2.0 * signY + 2.0; 1856 planar.y = v.z * signY - 2.0; 1857 } 1858 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1859 } 1860 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1861 float shadow = 1.0; 1862 vec3 lightToPosition = shadowCoord.xyz; 1863 1864 float lightToPositionLength = length( lightToPosition ); 1865 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1866 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1867 vec3 bd3D = normalize( lightToPosition ); 1868 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1869 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1870 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1871 shadow = ( 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1873 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1874 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1875 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1876 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1877 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1878 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1879 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1880 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1881 ) * ( 1.0 / 9.0 ); 1882 #else 1883 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1884 #endif 1885 } 1886 return shadow; 1887 } 1888#endif`,
1888Vy=`#if NUM_SPOT_LIGHT_COORDS > 0 1889 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1890 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1891#endif 1892#ifdef USE_SHADOWMAP 1893 #if NUM_DIR_LIGHT_SHADOWS > 0 1894 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1895 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1896 struct DirectionalLightShadow { 1897 float shadowBias; 1898 float shadowNormalBias; 1899 float shadowRadius; 1900 vec2 shadowMapSize; 1901 }; 1902 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1903 #endif 1904 #if NUM_SPOT_LIGHT_SHADOWS > 0 1905 struct SpotLightShadow { 1906 float shadowBias; 1907 float shadowNormalBias; 1908 float shadowRadius; 1909 vec2 shadowMapSize; 1910 }; 1911 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1912 #endif 1913 #if NUM_POINT_LIGHT_SHADOWS > 0 1914 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1915 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1916 struct PointLightShadow { 1917 float shadowBias; 1918 float shadowNormalBias; 1919 float shadowRadius; 1920 vec2 shadowMapSize; 1921 float shadowCameraNear; 1922 float shadowCameraFar; 1923 }; 1924 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1925 #endif 1926#endif`,zy=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1927 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1928 vec4 shadowWorldPosition; 1929#endif 1930#if defined( USE_SHADOWMAP ) 1931 #if NUM_DIR_LIGHT_SHADOWS > 0 1932 #pragma unroll_loop_start 1933 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1934 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1935 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1936 } 1937 #pragma unroll_loop_end 1938 #endif 1939 #if NUM_POINT_LIGHT_SHADOWS > 0 1940 #pragma unroll_loop_start 1941 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1942 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1943 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1944 } 1945 #pragma unroll_loop_end 1946 #endif 1947#endif 1948#if NUM_SPOT_LIGHT_COORDS > 0 1949 #pragma unroll_loop_start 1950 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1951 shadowWorldPosition = worldPosition; 1952 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1953 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1954 #endif 1955 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1956 } 1957 #pragma unroll_loop_end 1958#endif`,Wy=`float getShadowMask() { 1959 float shadow = 1.0; 1960 #ifdef USE_SHADOWMAP 1961 #if NUM_DIR_LIGHT_SHADOWS > 0 1962 DirectionalLightShadow directionalLight; 1963 #pragma unroll_loop_start 1964 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1965 directionalLight = directionalLightShadows[ i ]; 1966 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1967 } 1968 #pragma unroll_loop_end 1969 #endif 1970 #if NUM_SPOT_LIGHT_SHADOWS > 0 1971 SpotLightShadow spotLight; 1972 #pragma unroll_loop_start 1973 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1974 spotLight = spotLightShadows[ i ]; 1975 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1976 } 1977 #pragma unroll_loop_end 1978 #endif 1979 #if NUM_POINT_LIGHT_SHADOWS > 0 1980 PointLightShadow pointLight; 1981 #pragma unroll_loop_start 1982 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1983 pointLight = pointLightShadows[ i ]; 1984 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1985 } 1986 #pragma unroll_loop_end 1987 #endif 1988 #endif 1989 return shadow; 1990}`,$y=`#ifdef USE_SKINNING 1991 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1992 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1993 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1994 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1995#endif`,qy=`#ifdef USE_SKINNING 1996 uniform mat4 bindMatrix; 1997 uniform mat4 bindMatrixInverse; 1998 uniform highp sampler2D boneTexture; 1999 mat4 getBoneMatrix( const in float i ) { 2000 int size = textureSize( boneTexture, 0 ).x; 2001 int j = int( i ) * 4; 2002 int x = j % size; 2003 int y = j / size; 2004 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2005 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2006 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2007 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2008 return mat4( v1, v2, v3, v4 ); 2009 } 2010#endif`,Xy=`#ifdef USE_SKINNING 2011 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2012 vec4 skinned = vec4( 0.0 ); 2013 skinned += boneMatX * skinVertex * skinWeight.x; 2014 skinned += boneMatY * skinVertex * skinWeight.y; 2015 skinned += boneMatZ * skinVertex * skinWeight.z; 2016 skinned += boneMatW * skinVertex * skinWeight.w; 2017 transformed = ( bindMatrixInverse * skinned ).xyz; 2018#endif`,Yy=`#ifdef USE_SKINNING 2019 mat4 skinMatrix = mat4( 0.0 ); 2020 skinMatrix += skinWeight.x * boneMatX; 2021 skinMatrix += skinWeight.y * boneMatY; 2022 skinMatrix += skinWeight.z * boneMatZ; 2023 skinMatrix += skinWeight.w * boneMatW; 2024 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2025 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2026 #ifdef USE_TANGENT 2027 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2028 #endif 2029#endif`,Ky=`float specularStrength; 2030#ifdef USE_SPECULARMAP 2031 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2032 specularStrength = texelSpecular.r; 2033#else 2034 specularStrength = 1.0; 2035#endif`,Jy=`#ifdef USE_SPECULARMAP 2036 uniform sampler2D specularMap; 2037#endif`,jy=`#if defined( TONE_MAPPING ) 2038 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2039#endif`,Zy=`#ifndef saturate 2040#define saturate( a ) clamp( a, 0.0, 1.0 ) 2041#endif 2042uniform float toneMappingExposure; 2043vec3 LinearToneMapping( vec3 color ) { 2044 return saturate( toneMappingExposure * color ); 2045} 2046vec3 ReinhardToneMapping( vec3 color ) { 2047 color *= toneMappingExposure; 2048 return saturate( color / ( vec3( 1.0 ) + color ) ); 2049} 2050vec3 OptimizedCineonToneMapping( vec3 color ) { 2051 color *= toneMappingExposure; 2052 color = max( vec3( 0.0 ), color - 0.004 ); 2053 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2054} 2055vec3 RRTAndODTFit( vec3 v ) { 2056 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2057 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2058 return a / b; 2059} 2060vec3 ACESFilmicToneMapping( vec3 color ) { 2061 const mat3 ACESInputMat = mat3( 2062 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2063 vec3( 0.04823, 0.01566, 0.83777 ) 2064 ); 2065 const mat3 ACESOutputMat = mat3( 2066 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2067 vec3( -0.07367, -0.00605, 1.07602 ) 2068 ); 2069 color *= toneMappingExposure / 0.6; 2070 color = ACESInputMat * color; 2071 color = RRTAndODTFit( color ); 2072 color = ACESOutputMat * color; 2073 return saturate( color ); 2074} 2075const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2076 vec3( 1.6605, - 0.1246, - 0.0182 ), 2077 vec3( - 0.5876, 1.1329, - 0.1006 ), 2078 vec3( - 0.0728, - 0.0083, 1.1187 ) 2079); 2080const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2081 vec3( 0.6274, 0.0691, 0.0164 ), 2082 vec3( 0.3293, 0.9195, 0.0880 ), 2083 vec3( 0.0433, 0.0113, 0.8956 ) 2084); 2085vec3 agxDefaultContrastApprox( vec3 x ) { 2086 vec3 x2 = x * x; 2087 vec3 x4 = x2 * x2; 2088 return + 15.5 * x4 * x2 2089 - 40.14 * x4 * x 2090 + 31.96 * x4 2091 - 6.868 * x2 * x 2092 + 0.4298 * x2 2093 + 0.1191 * x 2094 - 0.00232; 2095} 2096vec3 AgXToneMapping( vec3 color ) { 2097 const mat3 AgXInsetMatrix = mat3( 2098 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2099 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2100 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2101 );
2102 const mat3 AgXOutsetMatrix = mat3( 2103 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2104 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2105 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2106 ); 2107 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2108 color *= toneMappingExposure; 2109 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2110 color = AgXInsetMatrix * color; 2111 color = max( color, 1e-10 ); color = log2( color ); 2112 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2113 color = clamp( color, 0.0, 1.0 ); 2114 color = agxDefaultContrastApprox( color ); 2115 color = AgXOutsetMatrix * color; 2116 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2117 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2118 color = clamp( color, 0.0, 1.0 ); 2119 return color; 2120} 2121vec3 NeutralToneMapping( vec3 color ) { 2122 float startCompression = 0.8 - 0.04; 2123 float desaturation = 0.15; 2124 color *= toneMappingExposure; 2125 float x = min(color.r, min(color.g, color.b)); 2126 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2127 color -= offset; 2128 float peak = max(color.r, max(color.g, color.b)); 2129 if (peak < startCompression) return color; 2130 float d = 1. - startCompression; 2131 float newPeak = 1. - d * d / (peak + d - startCompression); 2132 color *= newPeak / peak; 2133 float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.); 2134 return mix(color, newPeak * vec3(1, 1, 1), g); 2135} 2136vec3 CustomToneMapping( vec3 color ) { return color; }`,ex=`#ifdef USE_TRANSMISSION 2137 material.transmission = transmission; 2138 material.transmissionAlpha = 1.0; 2139 material.thickness = thickness; 2140 material.attenuationDistance = attenuationDistance; 2141 material.attenuationColor = attenuationColor; 2142 #ifdef USE_TRANSMISSIONMAP 2143 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2144 #endif 2145 #ifdef USE_THICKNESSMAP 2146 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2147 #endif 2148 vec3 pos = vWorldPosition; 2149 vec3 v = normalize( cameraPosition - pos ); 2150 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2151 vec4 transmitted = getIBLVolumeRefraction( 2152 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2153 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 2154 material.attenuationColor, material.attenuationDistance ); 2155 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2156 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2157#endif`,tx=`#ifdef USE_TRANSMISSION 2158 uniform float transmission; 2159 uniform float thickness; 2160 uniform float attenuationDistance; 2161 uniform vec3 attenuationColor; 2162 #ifdef USE_TRANSMISSIONMAP 2163 uniform sampler2D transmissionMap; 2164 #endif 2165 #ifdef USE_THICKNESSMAP 2166 uniform sampler2D thicknessMap; 2167 #endif 2168 uniform vec2 transmissionSamplerSize; 2169 uniform sampler2D transmissionSamplerMap; 2170 uniform mat4 modelMatrix; 2171 uniform mat4 projectionMatrix; 2172 varying vec3 vWorldPosition; 2173 float w0( float a ) { 2174 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2175 } 2176 float w1( float a ) { 2177 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2178 } 2179 float w2( float a ){ 2180 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2181 } 2182 float w3( float a ) { 2183 return ( 1.0 / 6.0 ) * ( a * a * a ); 2184 } 2185 float g0( float a ) { 2186 return w0( a ) + w1( a ); 2187 } 2188 float g1( float a ) { 2189 return w2( a ) + w3( a ); 2190 } 2191 float h0( float a ) { 2192 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2193 } 2194 float h1( float a ) { 2195 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2196 } 2197 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2198 uv = uv * texelSize.zw + 0.5; 2199 vec2 iuv = floor( uv ); 2200 vec2 fuv = fract( uv ); 2201 float g0x = g0( fuv.x ); 2202 float g1x = g1( fuv.x ); 2203 float h0x = h0( fuv.x ); 2204 float h1x = h1( fuv.x ); 2205 float h0y = h0( fuv.y ); 2206 float h1y = h1( fuv.y ); 2207 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2208 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2209 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2210 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2211 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2212 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2213 } 2214 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2215 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2216 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2217 vec2 fLodSizeInv = 1.0 / fLodSize; 2218 vec2 cLodSizeInv = 1.0 / cLodSize; 2219 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2220 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2221 return mix( fSample, cSample, fract( lod ) ); 2222 } 2223 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2224 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2225 vec3 modelScale; 2226 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2227 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2228 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2229 return normalize( refractionVector ) * thickness * modelScale; 2230 } 2231 float applyIorToRoughness( const in float roughness, const in float ior ) { 2232 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2233 } 2234 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2235 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2236 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2237 } 2238 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2239 if ( isinf( attenuationDistance ) ) { 2240 return vec3( 1.0 ); 2241 } else { 2242 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2243 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2244 } 2245 } 2246 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2247 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2248 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 2249 const in vec3 attenuationColor, const in float attenuationDistance ) { 2250 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2251 vec3 refractedRayExit = position + transmissionRay; 2252 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2253 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2254 refractionCoords += 1.0; 2255 refractionCoords /= 2.0; 2256 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2257 vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2258 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2259 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2260 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2261 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2262 } 2263#endif`,nx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2264 varying vec2 vUv; 2265#endif 2266#ifdef USE_MAP 2267 varying vec2 vMapUv; 2268#endif 2269#ifdef USE_ALPHAMAP
2270 varying vec2 vAlphaMapUv; 2271#endif 2272#ifdef USE_LIGHTMAP 2273 varying vec2 vLightMapUv; 2274#endif 2275#ifdef USE_AOMAP 2276 varying vec2 vAoMapUv; 2277#endif 2278#ifdef USE_BUMPMAP 2279 varying vec2 vBumpMapUv; 2280#endif 2281#ifdef USE_NORMALMAP 2282 varying vec2 vNormalMapUv; 2283#endif 2284#ifdef USE_EMISSIVEMAP 2285 varying vec2 vEmissiveMapUv; 2286#endif 2287#ifdef USE_METALNESSMAP 2288 varying vec2 vMetalnessMapUv; 2289#endif 2290#ifdef USE_ROUGHNESSMAP 2291 varying vec2 vRoughnessMapUv; 2292#endif 2293#ifdef USE_ANISOTROPYMAP 2294 varying vec2 vAnisotropyMapUv; 2295#endif 2296#ifdef USE_CLEARCOATMAP 2297 varying vec2 vClearcoatMapUv; 2298#endif 2299#ifdef USE_CLEARCOAT_NORMALMAP 2300 varying vec2 vClearcoatNormalMapUv; 2301#endif 2302#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2303 varying vec2 vClearcoatRoughnessMapUv; 2304#endif 2305#ifdef USE_IRIDESCENCEMAP 2306 varying vec2 vIridescenceMapUv; 2307#endif 2308#ifdef USE_IRIDESCENCE_THICKNESSMAP 2309 varying vec2 vIridescenceThicknessMapUv; 2310#endif 2311#ifdef USE_SHEEN_COLORMAP 2312 varying vec2 vSheenColorMapUv; 2313#endif 2314#ifdef USE_SHEEN_ROUGHNESSMAP 2315 varying vec2 vSheenRoughnessMapUv; 2316#endif 2317#ifdef USE_SPECULARMAP 2318 varying vec2 vSpecularMapUv; 2319#endif 2320#ifdef USE_SPECULAR_COLORMAP 2321 varying vec2 vSpecularColorMapUv; 2322#endif 2323#ifdef USE_SPECULAR_INTENSITYMAP 2324 varying vec2 vSpecularIntensityMapUv; 2325#endif 2326#ifdef USE_TRANSMISSIONMAP 2327 uniform mat3 transmissionMapTransform; 2328 varying vec2 vTransmissionMapUv; 2329#endif 2330#ifdef USE_THICKNESSMAP 2331 uniform mat3 thicknessMapTransform; 2332 varying vec2 vThicknessMapUv; 2333#endif`,ix=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2334 varying vec2 vUv; 2335#endif 2336#ifdef USE_MAP 2337 uniform mat3 mapTransform; 2338 varying vec2 vMapUv; 2339#endif 2340#ifdef USE_ALPHAMAP 2341 uniform mat3 alphaMapTransform; 2342 varying vec2 vAlphaMapUv; 2343#endif 2344#ifdef USE_LIGHTMAP 2345 uniform mat3 lightMapTransform; 2346 varying vec2 vLightMapUv; 2347#endif 2348#ifdef USE_AOMAP 2349 uniform mat3 aoMapTransform; 2350 varying vec2 vAoMapUv; 2351#endif 2352#ifdef USE_BUMPMAP 2353 uniform mat3 bumpMapTransform; 2354 varying vec2 vBumpMapUv; 2355#endif 2356#ifdef USE_NORMALMAP 2357 uniform mat3 normalMapTransform; 2358 varying vec2 vNormalMapUv; 2359#endif 2360#ifdef USE_DISPLACEMENTMAP 2361 uniform mat3 displacementMapTransform; 2362 varying vec2 vDisplacementMapUv; 2363#endif 2364#ifdef USE_EMISSIVEMAP 2365 uniform mat3 emissiveMapTransform; 2366 varying vec2 vEmissiveMapUv; 2367#endif 2368#ifdef USE_METALNESSMAP 2369 uniform mat3 metalnessMapTransform; 2370 varying vec2 vMetalnessMapUv; 2371#endif 2372#ifdef USE_ROUGHNESSMAP 2373 uniform mat3 roughnessMapTransform; 2374 varying vec2 vRoughnessMapUv; 2375#endif 2376#ifdef USE_ANISOTROPYMAP 2377 uniform mat3 anisotropyMapTransform; 2378 varying vec2 vAnisotropyMapUv; 2379#endif 2380#ifdef USE_CLEARCOATMAP 2381 uniform mat3 clearcoatMapTransform; 2382 varying vec2 vClearcoatMapUv; 2383#endif 2384#ifdef USE_CLEARCOAT_NORMALMAP 2385 uniform mat3 clearcoatNormalMapTransform; 2386 varying vec2 vClearcoatNormalMapUv; 2387#endif 2388#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2389 uniform mat3 clearcoatRoughnessMapTransform; 2390 varying vec2 vClearcoatRoughnessMapUv; 2391#endif 2392#ifdef USE_SHEEN_COLORMAP 2393 uniform mat3 sheenColorMapTransform; 2394 varying vec2 vSheenColorMapUv; 2395#endif 2396#ifdef USE_SHEEN_ROUGHNESSMAP 2397 uniform mat3 sheenRoughnessMapTransform; 2398 varying vec2 vSheenRoughnessMapUv; 2399#endif 2400#ifdef USE_IRIDESCENCEMAP 2401 uniform mat3 iridescenceMapTransform; 2402 varying vec2 vIridescenceMapUv; 2403#endif 2404#ifdef USE_IRIDESCENCE_THICKNESSMAP 2405 uniform mat3 iridescenceThicknessMapTransform; 2406 varying vec2 vIridescenceThicknessMapUv; 2407#endif 2408#ifdef USE_SPECULARMAP 2409 uniform mat3 specularMapTransform; 2410 varying vec2 vSpecularMapUv; 2411#endif 2412#ifdef USE_SPECULAR_COLORMAP 2413 uniform mat3 specularColorMapTransform; 2414 varying vec2 vSpecularColorMapUv; 2415#endif 2416#ifdef USE_SPECULAR_INTENSITYMAP 2417 uniform mat3 specularIntensityMapTransform; 2418 varying vec2 vSpecularIntensityMapUv; 2419#endif 2420#ifdef USE_TRANSMISSIONMAP 2421 uniform mat3 transmissionMapTransform; 2422 varying vec2 vTransmissionMapUv; 2423#endif 2424#ifdef USE_THICKNESSMAP 2425 uniform mat3 thicknessMapTransform; 2426 varying vec2 vThicknessMapUv; 2427#endif`,sx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2428 vUv = vec3( uv, 1 ).xy; 2429#endif 2430#ifdef USE_MAP 2431 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2432#endif 2433#ifdef USE_ALPHAMAP 2434 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2435#endif 2436#ifdef USE_LIGHTMAP 2437 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2438#endif 2439#ifdef USE_AOMAP 2440 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2441#endif 2442#ifdef USE_BUMPMAP 2443 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2444#endif 2445#ifdef USE_NORMALMAP 2446 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2447#endif 2448#ifdef USE_DISPLACEMENTMAP 2449 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2450#endif 2451#ifdef USE_EMISSIVEMAP 2452 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2453#endif 2454#ifdef USE_METALNESSMAP 2455 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2456#endif 2457#ifdef USE_ROUGHNESSMAP 2458 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2459#endif 2460#ifdef USE_ANISOTROPYMAP 2461 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2462#endif 2463#ifdef USE_CLEARCOATMAP 2464 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2465#endif 2466#ifdef USE_CLEARCOAT_NORMALMAP 2467 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2468#endif 2469#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2470 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2471#endif
2472#ifdef USE_IRIDESCENCEMAP 2473 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2474#endif 2475#ifdef USE_IRIDESCENCE_THICKNESSMAP 2476 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2477#endif 2478#ifdef USE_SHEEN_COLORMAP 2479 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2480#endif 2481#ifdef USE_SHEEN_ROUGHNESSMAP 2482 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2483#endif 2484#ifdef USE_SPECULARMAP 2485 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2486#endif 2487#ifdef USE_SPECULAR_COLORMAP 2488 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2489#endif 2490#ifdef USE_SPECULAR_INTENSITYMAP 2491 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2492#endif 2493#ifdef USE_TRANSMISSIONMAP 2494 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2495#endif 2496#ifdef USE_THICKNESSMAP 2497 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2498#endif`,rx=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2499 vec4 worldPosition = vec4( transformed, 1.0 ); 2500 #ifdef USE_BATCHING 2501 worldPosition = batchingMatrix * worldPosition; 2502 #endif 2503 #ifdef USE_INSTANCING 2504 worldPosition = instanceMatrix * worldPosition; 2505 #endif 2506 worldPosition = modelMatrix * worldPosition; 2507#endif`;const ox=`varying vec2 vUv; 2508uniform mat3 uvTransform; 2509void main() { 2510 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2511 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2512}`,ax=`uniform sampler2D t2D; 2513uniform float backgroundIntensity; 2514varying vec2 vUv; 2515void main() { 2516 vec4 texColor = texture2D( t2D, vUv ); 2517 #ifdef DECODE_VIDEO_TEXTURE 2518 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2519 #endif 2520 texColor.rgb *= backgroundIntensity; 2521 gl_FragColor = texColor; 2522 #include <tonemapping_fragment> 2523 #include <colorspace_fragment> 2524}`,lx=`varying vec3 vWorldDirection; 2525#include <common> 2526void main() { 2527 vWorldDirection = transformDirection( position, modelMatrix ); 2528 #include <begin_vertex> 2529 #include <project_vertex> 2530 gl_Position.z = gl_Position.w; 2531}`,cx=`#ifdef ENVMAP_TYPE_CUBE 2532 uniform samplerCube envMap; 2533#elif defined( ENVMAP_TYPE_CUBE_UV ) 2534 uniform sampler2D envMap; 2535#endif 2536uniform float flipEnvMap; 2537uniform float backgroundBlurriness; 2538uniform float backgroundIntensity; 2539uniform mat3 backgroundRotation; 2540varying vec3 vWorldDirection; 2541#include <cube_uv_reflection_fragment> 2542void main() { 2543 #ifdef ENVMAP_TYPE_CUBE 2544 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2545 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2546 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2547 #else 2548 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2549 #endif 2550 texColor.rgb *= backgroundIntensity; 2551 gl_FragColor = texColor; 2552 #include <tonemapping_fragment> 2553 #include <colorspace_fragment> 2554}`,hx=`varying vec3 vWorldDirection; 2555#include <common> 2556void main() { 2557 vWorldDirection = transformDirection( position, modelMatrix ); 2558 #include <begin_vertex> 2559 #include <project_vertex> 2560 gl_Position.z = gl_Position.w; 2561}`,ux=`uniform samplerCube tCube; 2562uniform float tFlip; 2563uniform float opacity; 2564varying vec3 vWorldDirection; 2565void main() { 2566 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2567 gl_FragColor = texColor; 2568 gl_FragColor.a *= opacity; 2569 #include <tonemapping_fragment> 2570 #include <colorspace_fragment> 2571}`,dx=`#include <common> 2572#include <batching_pars_vertex> 2573#include <uv_pars_vertex> 2574#include <displacementmap_pars_vertex> 2575#include <morphtarget_pars_vertex> 2576#include <skinning_pars_vertex> 2577#include <logdepthbuf_pars_vertex> 2578#include <clipping_planes_pars_vertex> 2579varying vec2 vHighPrecisionZW; 2580void main() { 2581 #include <uv_vertex> 2582 #include <batching_vertex> 2583 #include <skinbase_vertex> 2584 #include <morphinstance_vertex> 2585 #ifdef USE_DISPLACEMENTMAP 2586 #include <beginnormal_vertex> 2587 #include <morphnormal_vertex> 2588 #include <skinnormal_vertex> 2589 #endif 2590 #include <begin_vertex> 2591 #include <morphtarget_vertex> 2592 #include <skinning_vertex> 2593 #include <displacementmap_vertex> 2594 #include <project_vertex> 2595 #include <logdepthbuf_vertex> 2596 #include <clipping_planes_vertex> 2597 vHighPrecisionZW = gl_Position.zw; 2598}`,fx=`#if DEPTH_PACKING == 3200 2599 uniform float opacity; 2600#endif 2601#include <common> 2602#include <packing> 2603#include <uv_pars_fragment> 2604#include <map_pars_fragment> 2605#include <alphamap_pars_fragment> 2606#include <alphatest_pars_fragment> 2607#include <alphahash_pars_fragment> 2608#include <logdepthbuf_pars_fragment> 2609#include <clipping_planes_pars_fragment> 2610varying vec2 vHighPrecisionZW; 2611void main() { 2612 vec4 diffuseColor = vec4( 1.0 ); 2613 #include <clipping_planes_fragment> 2614 #if DEPTH_PACKING == 3200 2615 diffuseColor.a = opacity; 2616 #endif 2617 #include <map_fragment> 2618 #include <alphamap_fragment> 2619 #include <alphatest_fragment> 2620 #include <alphahash_fragment> 2621 #include <logdepthbuf_fragment> 2622 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2623 #if DEPTH_PACKING == 3200 2624 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2625 #elif DEPTH_PACKING == 3201 2626 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2627 #endif 2628}`,Ax=`#define DISTANCE 2629varying vec3 vWorldPosition; 2630#include <common> 2631#include <batching_pars_vertex> 2632#include <uv_pars_vertex> 2633#include <displacementmap_pars_vertex> 2634#include <morphtarget_pars_vertex> 2635#include <skinning_pars_vertex> 2636#include <clipping_planes_pars_vertex> 2637void main() { 2638 #include <uv_vertex> 2639 #include <batching_vertex> 2640 #include <skinbase_vertex> 2641 #include <morphinstance_vertex> 2642 #ifdef USE_DISPLACEMENTMAP 2643 #include <beginnormal_vertex> 2644 #include <morphnormal_vertex> 2645 #include <skinnormal_vertex> 2646 #endif 2647 #include <begin_vertex> 2648 #include <morphtarget_vertex> 2649 #include <skinning_vertex> 2650 #include <displacementmap_vertex> 2651 #include <project_vertex> 2652 #include <worldpos_vertex> 2653 #include <clipping_planes_vertex> 2654 vWorldPosition = worldPosition.xyz; 2655}`,px=`#define DISTANCE 2656uniform vec3 referencePosition; 2657uniform float nearDistance; 2658uniform float farDistance; 2659varying vec3 vWorldPosition; 2660#include <common> 2661#include <packing> 2662#include <uv_pars_fragment> 2663#include <map_pars_fragment> 2664#include <alphamap_pars_fragment> 2665#include <alphatest_pars_fragment> 2666#include <alphahash_pars_fragment> 2667#include <clipping_planes_pars_fragment> 2668void main () { 2669 vec4 diffuseColor = vec4( 1.0 ); 2670 #include <clipping_planes_fragment> 2671 #include <map_fragment> 2672 #include <alphamap_fragment> 2673 #include <alphatest_fragment> 2674 #include <alphahash_fragment> 2675 float dist = length( vWorldPosition - referencePosition ); 2676 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2677 dist = saturate( dist ); 2678 gl_FragColor = packDepthToRGBA( dist ); 2679}`,mx=`varying vec3 vWorldDirection; 2680#include <common> 2681void main() { 2682 vWorldDirection = transformDirection( position, modelMatrix ); 2683 #include <begin_vertex> 2684 #include <project_vertex> 2685}`,gx=`uniform sampler2D tEquirect; 2686varying vec3 vWorldDirection; 2687#include <common> 2688void main() { 2689 vec3 direction = normalize( vWorldDirection ); 2690 vec2 sampleUV = equirectUv( direction ); 2691 gl_FragColor = texture2D( tEquirect, sampleUV ); 2692 #include <tonemapping_fragment> 2693 #include <colorspace_fragment> 2694}`,_x=`uniform float scale; 2695attribute float lineDistance; 2696varying float vLineDistance; 2697#include <common> 2698#include <uv_pars_vertex> 2699#include <color_pars_vertex> 2700#include <fog_pars_vertex> 2701#include <morphtarget_pars_vertex> 2702#include <logdepthbuf_pars_vertex> 2703#include <clipping_planes_pars_vertex> 2704void main() { 2705 vLineDistance = scale * lineDistance; 2706 #include <uv_vertex> 2707 #include <color_vertex> 2708 #include <morphinstance_vertex> 2709 #include <morphcolor_vertex> 2710 #include <begin_vertex> 2711 #include <morphtarget_vertex> 2712 #include <project_vertex> 2713 #include <logdepthbuf_vertex> 2714 #include <clipping_planes_vertex> 2715 #include <fog_vertex> 2716}`,Ex=`uniform vec3 diffuse; 2717uniform float opacity; 2718uniform float dashSize; 2719uniform float totalSize; 2720varying float vLineDistance; 2721#include <common> 2722#include <color_pars_fragment> 2723#include <uv_pars_fragment> 2724#include <map_pars_fragment> 2725#include <fog_pars_fragment> 2726#include <logdepthbuf_pars_fragment> 2727#include <clipping_planes_pars_fragment> 2728void main() { 2729 vec4 diffuseColor = vec4( diffuse, opacity ); 2730 #include <clipping_planes_fragment> 2731 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2732 discard; 2733 } 2734 vec3 outgoingLight = vec3( 0.0 ); 2735 #include <logdepthbuf_fragment> 2736 #include <map_fragment> 2737 #include <color_fragment> 2738 outgoingLight = diffuseColor.rgb; 2739 #include <opaque_fragment> 2740 #include <tonemapping_fragment> 2741 #include <colorspace_fragment> 2742 #include <fog_fragment> 2743 #include <premultiplied_alpha_fragment> 2744}`,vx=`#include <common> 2745#include <batching_pars_vertex> 2746#include <uv_pars_vertex> 2747#include <envmap_pars_vertex> 2748#include <color_pars_vertex> 2749#include <fog_pars_vertex> 2750#include <morphtarget_pars_vertex> 2751#include <skinning_pars_vertex> 2752#include <logdepthbuf_pars_vertex> 2753#include <clipping_planes_pars_vertex> 2754void main() { 2755 #include <uv_vertex> 2756 #include <color_vertex> 2757 #include <morphinstance_vertex> 2758 #include <morphcolor_vertex> 2759 #include <batching_vertex> 2760 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2761 #include <beginnormal_vertex> 2762 #include <morphnormal_vertex> 2763 #include <skinbase_vertex> 2764 #include <skinnormal_vertex> 2765 #include <defaultnormal_vertex> 2766 #endif 2767 #include <begin_vertex> 2768 #include <morphtarget_vertex> 2769 #include <skinning_vertex> 2770 #include <project_vertex> 2771 #include <logdepthbuf_vertex> 2772 #include <clipping_planes_vertex> 2773 #include <worldpos_vertex> 2774 #include <envmap_vertex> 2775 #include <fog_vertex> 2776}
2776`,yx=`uniform vec3 diffuse; 2777uniform float opacity; 2778#ifndef FLAT_SHADED 2779 varying vec3 vNormal; 2780#endif 2781#include <common> 2782#include <dithering_pars_fragment> 2783#include <color_pars_fragment> 2784#include <uv_pars_fragment> 2785#include <map_pars_fragment> 2786#include <alphamap_pars_fragment> 2787#include <alphatest_pars_fragment> 2788#include <alphahash_pars_fragment> 2789#include <aomap_pars_fragment> 2790#include <lightmap_pars_fragment> 2791#include <envmap_common_pars_fragment> 2792#include <envmap_pars_fragment> 2793#include <fog_pars_fragment> 2794#include <specularmap_pars_fragment> 2795#include <logdepthbuf_pars_fragment> 2796#include <clipping_planes_pars_fragment> 2797void main() { 2798 vec4 diffuseColor = vec4( diffuse, opacity ); 2799 #include <clipping_planes_fragment> 2800 #include <logdepthbuf_fragment> 2801 #include <map_fragment> 2802 #include <color_fragment> 2803 #include <alphamap_fragment> 2804 #include <alphatest_fragment> 2805 #include <alphahash_fragment> 2806 #include <specularmap_fragment> 2807 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2808 #ifdef USE_LIGHTMAP 2809 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2810 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2811 #else 2812 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2813 #endif 2814 #include <aomap_fragment> 2815 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2816 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2817 #include <envmap_fragment> 2818 #include <opaque_fragment> 2819 #include <tonemapping_fragment> 2820 #include <colorspace_fragment> 2821 #include <fog_fragment> 2822 #include <premultiplied_alpha_fragment> 2823 #include <dithering_fragment> 2824}`,xx=`#define LAMBERT 2825varying vec3 vViewPosition; 2826#include <common> 2827#include <batching_pars_vertex> 2828#include <uv_pars_vertex> 2829#include <displacementmap_pars_vertex> 2830#include <envmap_pars_vertex> 2831#include <color_pars_vertex> 2832#include <fog_pars_vertex> 2833#include <normal_pars_vertex> 2834#include <morphtarget_pars_vertex> 2835#include <skinning_pars_vertex> 2836#include <shadowmap_pars_vertex> 2837#include <logdepthbuf_pars_vertex> 2838#include <clipping_planes_pars_vertex> 2839void main() { 2840 #include <uv_vertex> 2841 #include <color_vertex> 2842 #include <morphinstance_vertex> 2843 #include <morphcolor_vertex> 2844 #include <batching_vertex> 2845 #include <beginnormal_vertex> 2846 #include <morphnormal_vertex> 2847 #include <skinbase_vertex> 2848 #include <skinnormal_vertex> 2849 #include <defaultnormal_vertex> 2850 #include <normal_vertex> 2851 #include <begin_vertex> 2852 #include <morphtarget_vertex> 2853 #include <skinning_vertex> 2854 #include <displacementmap_vertex> 2855 #include <project_vertex> 2856 #include <logdepthbuf_vertex> 2857 #include <clipping_planes_vertex> 2858 vViewPosition = - mvPosition.xyz; 2859 #include <worldpos_vertex> 2860 #include <envmap_vertex> 2861 #include <shadowmap_vertex> 2862 #include <fog_vertex> 2863}`,Sx=`#define LAMBERT 2864uniform vec3 diffuse; 2865uniform vec3 emissive; 2866uniform float opacity; 2867#include <common> 2868#include <packing> 2869#include <dithering_pars_fragment> 2870#include <color_pars_fragment> 2871#include <uv_pars_fragment> 2872#include <map_pars_fragment> 2873#include <alphamap_pars_fragment> 2874#include <alphatest_pars_fragment> 2875#include <alphahash_pars_fragment> 2876#include <aomap_pars_fragment> 2877#include <lightmap_pars_fragment> 2878#include <emissivemap_pars_fragment> 2879#include <envmap_common_pars_fragment> 2880#include <envmap_pars_fragment> 2881#include <fog_pars_fragment> 2882#include <bsdfs> 2883#include <lights_pars_begin> 2884#include <normal_pars_fragment> 2885#include <lights_lambert_pars_fragment> 2886#include <shadowmap_pars_fragment> 2887#include <bumpmap_pars_fragment> 2888#include <normalmap_pars_fragment> 2889#include <specularmap_pars_fragment> 2890#include <logdepthbuf_pars_fragment> 2891#include <clipping_planes_pars_fragment> 2892void main() { 2893 vec4 diffuseColor = vec4( diffuse, opacity ); 2894 #include <clipping_planes_fragment> 2895 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2896 vec3 totalEmissiveRadiance = emissive; 2897 #include <logdepthbuf_fragment> 2898 #include <map_fragment> 2899 #include <color_fragment> 2900 #include <alphamap_fragment> 2901 #include <alphatest_fragment> 2902 #include <alphahash_fragment> 2903 #include <specularmap_fragment> 2904 #include <normal_fragment_begin> 2905 #include <normal_fragment_maps> 2906 #include <emissivemap_fragment> 2907 #include <lights_lambert_fragment> 2908 #include <lights_fragment_begin> 2909 #include <lights_fragment_maps> 2910 #include <lights_fragment_end> 2911 #include <aomap_fragment> 2912 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2913 #include <envmap_fragment> 2914 #include <opaque_fragment> 2915 #include <tonemapping_fragment> 2916 #include <colorspace_fragment> 2917 #include <fog_fragment> 2918 #include <premultiplied_alpha_fragment> 2919 #include <dithering_fragment> 2920}`,Ix=`#define MATCAP 2921varying vec3 vViewPosition; 2922#include <common> 2923#include <batching_pars_vertex> 2924#include <uv_pars_vertex> 2925#include <color_pars_vertex> 2926#include <displacementmap_pars_vertex> 2927#include <fog_pars_vertex> 2928#include <normal_pars_vertex> 2929#include <morphtarget_pars_vertex> 2930#include <skinning_pars_vertex> 2931#include <logdepthbuf_pars_vertex> 2932#include <clipping_planes_pars_vertex> 2933void main() { 2934 #include <uv_vertex> 2935 #include <color_vertex> 2936 #include <morphinstance_vertex> 2937 #include <morphcolor_vertex> 2938 #include <batching_vertex> 2939 #include <beginnormal_vertex> 2940 #include <morphnormal_vertex> 2941 #include <skinbase_vertex> 2942 #include <skinnormal_vertex> 2943 #include <defaultnormal_vertex> 2944 #include <normal_vertex> 2945 #include <begin_vertex> 2946 #include <morphtarget_vertex> 2947 #include <skinning_vertex> 2948 #include <displacementmap_vertex> 2949 #include <project_vertex> 2950 #include <logdepthbuf_vertex> 2951 #include <clipping_planes_vertex> 2952 #include <fog_vertex> 2953 vViewPosition = - mvPosition.xyz; 2954}`,Cx=`#define MATCAP 2955uniform vec3 diffuse; 2956uniform float opacity; 2957uniform sampler2D matcap; 2958varying vec3 vViewPosition; 2959#include <common> 2960#include <dithering_pars_fragment> 2961#include <color_pars_fragment> 2962#include <uv_pars_fragment> 2963#include <map_pars_fragment> 2964#include <alphamap_pars_fragment> 2965#include <alphatest_pars_fragment> 2966#include <alphahash_pars_fragment> 2967#include <fog_pars_fragment> 2968#include <normal_pars_fragment> 2969#include <bumpmap_pars_fragment> 2970#include <normalmap_pars_fragment> 2971#include <logdepthbuf_pars_fragment> 2972#include <clipping_planes_pars_fragment> 2973void main() { 2974 vec4 diffuseColor = vec4( diffuse, opacity ); 2975 #include <clipping_planes_fragment> 2976 #include <logdepthbuf_fragment> 2977 #include <map_fragment> 2978 #include <color_fragment> 2979 #include <alphamap_fragment> 2980 #include <alphatest_fragment> 2981 #include <alphahash_fragment> 2982 #include <normal_fragment_begin> 2983 #include <normal_fragment_maps> 2984 vec3 viewDir = normalize( vViewPosition ); 2985 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2986 vec3 y = cross( viewDir, x ); 2987 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2988 #ifdef USE_MATCAP
2989 vec4 matcapColor = texture2D( matcap, uv ); 2990 #else 2991 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2992 #endif 2993 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2994 #include <opaque_fragment> 2995 #include <tonemapping_fragment> 2996 #include <colorspace_fragment> 2997 #include <fog_fragment> 2998 #include <premultiplied_alpha_fragment> 2999 #include <dithering_fragment> 3000}`,Mx=`#define NORMAL 3001#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3002 varying vec3 vViewPosition; 3003#endif 3004#include <common> 3005#include <batching_pars_vertex> 3006#include <uv_pars_vertex> 3007#include <displacementmap_pars_vertex> 3008#include <normal_pars_vertex> 3009#include <morphtarget_pars_vertex> 3010#include <skinning_pars_vertex> 3011#include <logdepthbuf_pars_vertex> 3012#include <clipping_planes_pars_vertex> 3013void main() { 3014 #include <uv_vertex> 3015 #include <batching_vertex> 3016 #include <beginnormal_vertex> 3017 #include <morphinstance_vertex> 3018 #include <morphnormal_vertex> 3019 #include <skinbase_vertex> 3020 #include <skinnormal_vertex> 3021 #include <defaultnormal_vertex> 3022 #include <normal_vertex> 3023 #include <begin_vertex> 3024 #include <morphtarget_vertex> 3025 #include <skinning_vertex> 3026 #include <displacementmap_vertex> 3027 #include <project_vertex> 3028 #include <logdepthbuf_vertex> 3029 #include <clipping_planes_vertex> 3030#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3031 vViewPosition = - mvPosition.xyz; 3032#endif 3033}`,wx=`#define NORMAL 3034uniform float opacity; 3035#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3036 varying vec3 vViewPosition; 3037#endif 3038#include <packing> 3039#include <uv_pars_fragment> 3040#include <normal_pars_fragment> 3041#include <bumpmap_pars_fragment> 3042#include <normalmap_pars_fragment> 3043#include <logdepthbuf_pars_fragment> 3044#include <clipping_planes_pars_fragment> 3045void main() { 3046 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3047 #include <clipping_planes_fragment> 3048 #include <logdepthbuf_fragment> 3049 #include <normal_fragment_begin> 3050 #include <normal_fragment_maps> 3051 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3052 #ifdef OPAQUE 3053 gl_FragColor.a = 1.0; 3054 #endif 3055}`,bx=`#define PHONG 3056varying vec3 vViewPosition; 3057#include <common> 3058#include <batching_pars_vertex> 3059#include <uv_pars_vertex> 3060#include <displacementmap_pars_vertex> 3061#include <envmap_pars_vertex> 3062#include <color_pars_vertex> 3063#include <fog_pars_vertex> 3064#include <normal_pars_vertex> 3065#include <morphtarget_pars_vertex> 3066#include <skinning_pars_vertex> 3067#include <shadowmap_pars_vertex> 3068#include <logdepthbuf_pars_vertex> 3069#include <clipping_planes_pars_vertex> 3070void main() { 3071 #include <uv_vertex> 3072 #include <color_vertex> 3073 #include <morphcolor_vertex> 3074 #include <batching_vertex> 3075 #include <beginnormal_vertex> 3076 #include <morphinstance_vertex> 3077 #include <morphnormal_vertex> 3078 #include <skinbase_vertex> 3079 #include <skinnormal_vertex> 3080 #include <defaultnormal_vertex> 3081 #include <normal_vertex> 3082 #include <begin_vertex> 3083 #include <morphtarget_vertex> 3084 #include <skinning_vertex> 3085 #include <displacementmap_vertex> 3086 #include <project_vertex> 3087 #include <logdepthbuf_vertex> 3088 #include <clipping_planes_vertex> 3089 vViewPosition = - mvPosition.xyz; 3090 #include <worldpos_vertex> 3091 #include <envmap_vertex> 3092 #include <shadowmap_vertex> 3093 #include <fog_vertex> 3094}`,Tx=`#define PHONG 3095uniform vec3 diffuse; 3096uniform vec3 emissive; 3097uniform vec3 specular; 3098uniform float shininess; 3099uniform float opacity; 3100#include <common> 3101#include <packing> 3102#include <dithering_pars_fragment> 3103#include <color_pars_fragment> 3104#include <uv_pars_fragment> 3105#include <map_pars_fragment> 3106#include <alphamap_pars_fragment> 3107#include <alphatest_pars_fragment> 3108#include <alphahash_pars_fragment> 3109#include <aomap_pars_fragment> 3110#include <lightmap_pars_fragment> 3111#include <emissivemap_pars_fragment> 3112#include <envmap_common_pars_fragment> 3113#include <envmap_pars_fragment> 3114#include <fog_pars_fragment> 3115#include <bsdfs> 3116#include <lights_pars_begin> 3117#include <normal_pars_fragment> 3118#include <lights_phong_pars_fragment> 3119#include <shadowmap_pars_fragment> 3120#include <bumpmap_pars_fragment> 3121#include <normalmap_pars_fragment> 3122#include <specularmap_pars_fragment> 3123#include <logdepthbuf_pars_fragment> 3124#include <clipping_planes_pars_fragment> 3125void main() { 3126 vec4 diffuseColor = vec4( diffuse, opacity ); 3127 #include <clipping_planes_fragment> 3128 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3129 vec3 totalEmissiveRadiance = emissive; 3130 #include <logdepthbuf_fragment> 3131 #include <map_fragment> 3132 #include <color_fragment> 3133 #include <alphamap_fragment> 3134 #include <alphatest_fragment> 3135 #include <alphahash_fragment> 3136 #include <specularmap_fragment> 3137 #include <normal_fragment_begin> 3138 #include <normal_fragment_maps> 3139 #include <emissivemap_fragment> 3140 #include <lights_phong_fragment> 3141 #include <lights_fragment_begin> 3142 #include <lights_fragment_maps> 3143 #include <lights_fragment_end> 3144 #include <aomap_fragment> 3145 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3146 #include <envmap_fragment> 3147 #include <opaque_fragment> 3148 #include <tonemapping_fragment> 3149 #include <colorspace_fragment> 3150 #include <fog_fragment> 3151 #include <premultiplied_alpha_fragment> 3152 #include <dithering_fragment> 3153}`,Bx=`#define STANDARD 3154varying vec3 vViewPosition; 3155#ifdef USE_TRANSMISSION 3156 varying vec3 vWorldPosition; 3157#endif 3158#include <common> 3159#include <batching_pars_vertex> 3160#include <uv_pars_vertex> 3161#include <displacementmap_pars_vertex> 3162#include <color_pars_vertex> 3163#include <fog_pars_vertex> 3164#include <normal_pars_vertex> 3165#include <morphtarget_pars_vertex> 3166#include <skinning_pars_vertex> 3167#include <shadowmap_pars_vertex> 3168#include <logdepthbuf_pars_vertex> 3169#include <clipping_planes_pars_vertex> 3170void main() { 3171 #include <uv_vertex> 3172 #include <color_vertex> 3173 #include <morphinstance_vertex> 3174 #include <morphcolor_vertex> 3175 #include <batching_vertex> 3176 #include <beginnormal_vertex> 3177 #include <morphnormal_vertex> 3178 #include <skinbase_vertex> 3179 #include <skinnormal_vertex> 3180 #include <defaultnormal_vertex> 3181 #include <normal_vertex> 3182 #include <begin_vertex> 3183 #include <morphtarget_vertex> 3184 #include <skinning_vertex> 3185 #include <displacementmap_vertex> 3186 #include <project_vertex> 3187 #include <logdepthbuf_vertex> 3188 #include <clipping_planes_vertex> 3189 vViewPosition = - mvPosition.xyz; 3190 #include <worldpos_vertex> 3191 #include <shadowmap_vertex> 3192 #include <fog_vertex> 3193#ifdef USE_TRANSMISSION 3194 vWorldPosition = worldPosition.xyz; 3195#endif 3196}`,Rx=`#define STANDARD 3197#ifdef PHYSICAL 3198 #define IOR 3199 #define USE_SPECULAR 3200#endif 3201uniform vec3 diffuse; 3202uniform vec3 emissive; 3203uniform float roughness; 3204uniform float metalness; 3205uniform float opacity; 3206#ifdef IOR 3207 uniform float ior; 3208#endif 3209#ifdef USE_SPECULAR 3210 uniform float specularIntensity; 3211 uniform vec3 specularColor; 3212 #ifdef USE_SPECULAR_COLORMAP 3213 uniform sampler2D specularColorMap; 3214 #endif 3215 #ifdef USE_SPECULAR_INTENSITYMAP 3216 uniform sampler2D specularIntensityMap; 3217 #endif 3218#endif 3219#ifdef USE_CLEARCOAT 3220 uniform float clearcoat; 3221 uniform float clearcoatRoughness; 3222#endif
3223#ifdef USE_IRIDESCENCE 3224 uniform float iridescence; 3225 uniform float iridescenceIOR; 3226 uniform float iridescenceThicknessMinimum; 3227 uniform float iridescenceThicknessMaximum; 3228#endif 3229#ifdef USE_SHEEN 3230 uniform vec3 sheenColor; 3231 uniform float sheenRoughness; 3232 #ifdef USE_SHEEN_COLORMAP 3233 uniform sampler2D sheenColorMap; 3234 #endif 3235 #ifdef USE_SHEEN_ROUGHNESSMAP 3236 uniform sampler2D sheenRoughnessMap; 3237 #endif 3238#endif 3239#ifdef USE_ANISOTROPY 3240 uniform vec2 anisotropyVector; 3241 #ifdef USE_ANISOTROPYMAP 3242 uniform sampler2D anisotropyMap; 3243 #endif 3244#endif 3245varying vec3 vViewPosition; 3246#include <common> 3247#include <packing> 3248#include <dithering_pars_fragment> 3249#include <color_pars_fragment> 3250#include <uv_pars_fragment> 3251#include <map_pars_fragment> 3252#include <alphamap_pars_fragment> 3253#include <alphatest_pars_fragment> 3254#include <alphahash_pars_fragment> 3255#include <aomap_pars_fragment> 3256#include <lightmap_pars_fragment> 3257#include <emissivemap_pars_fragment> 3258#include <iridescence_fragment> 3259#include <cube_uv_reflection_fragment> 3260#include <envmap_common_pars_fragment> 3261#include <envmap_physical_pars_fragment> 3262#include <fog_pars_fragment> 3263#include <lights_pars_begin> 3264#include <normal_pars_fragment> 3265#include <lights_physical_pars_fragment> 3266#include <transmission_pars_fragment> 3267#include <shadowmap_pars_fragment> 3268#include <bumpmap_pars_fragment> 3269#include <normalmap_pars_fragment> 3270#include <clearcoat_pars_fragment> 3271#include <iridescence_pars_fragment> 3272#include <roughnessmap_pars_fragment> 3273#include <metalnessmap_pars_fragment> 3274#include <logdepthbuf_pars_fragment> 3275#include <clipping_planes_pars_fragment> 3276void main() { 3277 vec4 diffuseColor = vec4( diffuse, opacity ); 3278 #include <clipping_planes_fragment> 3279 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3280 vec3 totalEmissiveRadiance = emissive; 3281 #include <logdepthbuf_fragment> 3282 #include <map_fragment> 3283 #include <color_fragment> 3284 #include <alphamap_fragment> 3285 #include <alphatest_fragment> 3286 #include <alphahash_fragment> 3287 #include <roughnessmap_fragment> 3288 #include <metalnessmap_fragment> 3289 #include <normal_fragment_begin> 3290 #include <normal_fragment_maps> 3291 #include <clearcoat_normal_fragment_begin> 3292 #include <clearcoat_normal_fragment_maps> 3293 #include <emissivemap_fragment> 3294 #include <lights_physical_fragment> 3295 #include <lights_fragment_begin> 3296 #include <lights_fragment_maps> 3297 #include <lights_fragment_end> 3298 #include <aomap_fragment> 3299 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3300 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3301 #include <transmission_fragment> 3302 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3303 #ifdef USE_SHEEN 3304 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3305 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3306 #endif 3307 #ifdef USE_CLEARCOAT 3308 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3309 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3310 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3311 #endif 3312 #include <opaque_fragment> 3313 #include <tonemapping_fragment> 3314 #include <colorspace_fragment> 3315 #include <fog_fragment> 3316 #include <premultiplied_alpha_fragment> 3317 #include <dithering_fragment> 3318}`,Dx=`#define TOON 3319varying vec3 vViewPosition; 3320#include <common> 3321#include <batching_pars_vertex> 3322#include <uv_pars_vertex> 3323#include <displacementmap_pars_vertex> 3324#include <color_pars_vertex> 3325#include <fog_pars_vertex> 3326#include <normal_pars_vertex> 3327#include <morphtarget_pars_vertex> 3328#include <skinning_pars_vertex> 3329#include <shadowmap_pars_vertex> 3330#include <logdepthbuf_pars_vertex> 3331#include <clipping_planes_pars_vertex> 3332void main() { 3333 #include <uv_vertex> 3334 #include <color_vertex> 3335 #include <morphinstance_vertex> 3336 #include <morphcolor_vertex> 3337 #include <batching_vertex> 3338 #include <beginnormal_vertex> 3339 #include <morphnormal_vertex> 3340 #include <skinbase_vertex> 3341 #include <skinnormal_vertex> 3342 #include <defaultnormal_vertex> 3343 #include <normal_vertex> 3344 #include <begin_vertex> 3345 #include <morphtarget_vertex> 3346 #include <skinning_vertex> 3347 #include <displacementmap_vertex> 3348 #include <project_vertex> 3349 #include <logdepthbuf_vertex> 3350 #include <clipping_planes_vertex> 3351 vViewPosition = - mvPosition.xyz; 3352 #include <worldpos_vertex> 3353 #include <shadowmap_vertex> 3354 #include <fog_vertex> 3355}`,Lx=`#define TOON 3356uniform vec3 diffuse; 3357uniform vec3 emissive; 3358uniform float opacity; 3359#include <common> 3360#include <packing> 3361#include <dithering_pars_fragment> 3362#include <color_pars_fragment> 3363#include <uv_pars_fragment> 3364#include <map_pars_fragment> 3365#include <alphamap_pars_fragment> 3366#include <alphatest_pars_fragment> 3367#include <alphahash_pars_fragment> 3368#include <aomap_pars_fragment> 3369#include <lightmap_pars_fragment> 3370#include <emissivemap_pars_fragment> 3371#include <gradientmap_pars_fragment> 3372#include <fog_pars_fragment> 3373#include <bsdfs> 3374#include <lights_pars_begin> 3375#include <normal_pars_fragment> 3376#include <lights_toon_pars_fragment> 3377#include <shadowmap_pars_fragment> 3378#include <bumpmap_pars_fragment> 3379#include <normalmap_pars_fragment> 3380#include <logdepthbuf_pars_fragment> 3381#include <clipping_planes_pars_fragment> 3382void main() { 3383 vec4 diffuseColor = vec4( diffuse, opacity ); 3384 #include <clipping_planes_fragment> 3385 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3386 vec3 totalEmissiveRadiance = emissive; 3387 #include <logdepthbuf_fragment> 3388 #include <map_fragment> 3389 #include <color_fragment> 3390 #include <alphamap_fragment> 3391 #include <alphatest_fragment> 3392 #include <alphahash_fragment> 3393 #include <normal_fragment_begin> 3394 #include <normal_fragment_maps> 3395 #include <emissivemap_fragment> 3396 #include <lights_toon_fragment> 3397 #include <lights_fragment_begin> 3398 #include <lights_fragment_maps> 3399 #include <lights_fragment_end> 3400 #include <aomap_fragment> 3401 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3402 #include <opaque_fragment> 3403 #include <tonemapping_fragment> 3404 #include <colorspace_fragment> 3405 #include <fog_fragment> 3406 #include <premultiplied_alpha_fragment> 3407 #include <dithering_fragment> 3408}`,Px=`uniform float size; 3409uniform float scale; 3410#include <common> 3411#include <color_pars_vertex> 3412#include <fog_pars_vertex> 3413#include <morphtarget_pars_vertex> 3414#include <logdepthbuf_pars_vertex> 3415#include <clipping_planes_pars_vertex> 3416#ifdef USE_POINTS_UV 3417 varying vec2 vUv; 3418 uniform mat3 uvTransform; 3419#endif 3420void main() { 3421 #ifdef USE_POINTS_UV 3422 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3423 #endif 3424 #include <color_vertex> 3425 #include <morphinstance_vertex> 3426 #include <morphcolor_vertex> 3427 #include <begin_vertex> 3428 #include <morphtarget_vertex> 3429 #include <project_vertex> 3430 gl_PointSize = size; 3431 #ifdef USE_SIZEATTENUATION 3432 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3433 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3434 #endif 3435 #include <logdepthbuf_vertex> 3436 #include <clipping_planes_vertex> 3437 #include <worldpos_vertex> 3438 #include <fog_vertex> 3439}`,Ux=`uniform vec3 diffuse; 3440uniform float opacity; 3441#include <common> 3442#include <color_pars_fragment> 3443#include <map_particle_pars_fragment> 3444#include <alphatest_pars_fragment> 3445#include <alphahash_pars_fragment> 3446#include <fog_pars_fragment> 3447#include <logdepthbuf_pars_fragment> 3448#include <clipping_planes_pars_fragment> 3449void main() { 3450 vec4 diffuseColor = vec4( diffuse, opacity ); 3451 #include <clipping_planes_fragment> 3452 vec3 outgoingLight = vec3( 0.0 ); 3453 #include <logdepthbuf_fragment> 3454 #include <map_particle_fragment> 3455 #include <color_fragment> 3456 #include <alphatest_fragment> 3457 #include <alphahash_fragment> 3458 outgoingLight = diffuseColor.rgb; 3459 #include <opaque_fragment> 3460 #include <tonemapping_fragment> 3461 #include <colorspace_fragment> 3462 #include <fog_fragment> 3463 #include <premultiplied_alpha_fragment> 3464}`,Nx=`#include <common> 3465#include <batching_pars_vertex> 3466#include <fog_pars_vertex> 3467#include <morphtarget_pars_vertex> 3468#include <skinning_pars_vertex> 3469#include <logdepthbuf_pars_vertex> 3470#include <shadowmap_pars_vertex> 3471void main() { 3472 #include <batching_vertex> 3473 #include <beginnormal_vertex> 3474 #include <morphinstance_vertex> 3475 #include <morphnormal_vertex> 3476 #include <skinbase_vertex> 3477 #include <skinnormal_vertex> 3478 #include <defaultnormal_vertex> 3479 #include <begin_vertex> 3480 #include <morphtarget_vertex> 3481 #include <skinning_vertex> 3482 #include <project_vertex> 3483 #include <logdepthbuf_vertex> 3484 #include <worldpos_vertex> 3485 #include <shadowmap_vertex> 3486 #include <fog_vertex> 3487}`,Fx=`uniform vec3 color; 3488uniform float opacity; 3489#include <common> 3490#include <packing> 3491#include <fog_pars_fragment> 3492#include <bsdfs> 3493#include <lights_pars_begin> 3494#include <logdepthbuf_pars_fragment> 3495#include <shadowmap_pars_fragment> 3496#include <shadowmask_pars_fragment> 3497void main() { 3498 #include <logdepthbuf_fragment> 3499 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3500 #include <tonemapping_fragment> 3501 #include <colorspace_fragment> 3502 #include <fog_fragment> 3503}`,Ox=`uniform float rotation; 3504uniform vec2 center; 3505#include <common> 3506#include <uv_pars_vertex> 3507#include <fog_pars_vertex> 3508#include <logdepthbuf_pars_vertex> 3509#include <clipping_planes_pars_vertex> 3510void main() { 3511 #include <uv_vertex> 3512 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3513 vec2 scale; 3514 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3515 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3516 #ifndef USE_SIZEATTENUATION 3517 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3518 if ( isPerspective ) scale *= - mvPosition.z; 3519 #endif 3520 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3521 vec2 rotatedPosition; 3522 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3523 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3524 mvPosition.xy += rotatedPosition; 3525 gl_Position = projectionMatrix * mvPosition; 3526 #include <logdepthbuf_vertex> 3527 #include <clipping_planes_vertex> 3528 #include <fog_vertex> 3529}`,Qx=`uniform vec3 diffuse; 3530uniform float opacity; 3531#include <common> 3532#include <uv_pars_fragment> 3533#include <map_pars_fragment> 3534#include <alphamap_pars_fragment> 3535#include <alphatest_pars_fragment> 3536#include <alphahash_pars_fragment> 3537#include <fog_pars_fragment> 3538#include <logdepthbuf_pars_fragment> 3539#include <clipping_planes_pars_fragment> 3540void main() { 3541 vec4 diffuseColor = vec4( diffuse, opacity ); 3542 #include <clipping_planes_fragment> 3543 vec3 outgoingLight = vec3( 0.0 ); 3544 #include <logdepthbuf_fragment> 3545 #include <map_fragment> 3546 #include <alphamap_fragment> 3547 #include <alphatest_fragment> 3548 #include <alphahash_fragment> 3549 outgoingLight = diffuseColor.rgb; 3550 #include <opaque_fragment> 3551 #include <tonemapping_fragment> 3552 #include <colorspace_fragment> 3553 #include <fog_fragment> 3554}`,ke={alphahash_fragment:ov,alphahash_pars_fragment:av,alphamap_fragment:lv,alphamap_pars_fragment:cv,alphatest_fragment:hv,alphatest_pars_fragment:uv,aomap_fragment:dv,aomap_pars_fragment:fv,batching_pars_vertex:Av,batching_vertex:pv,begin_vertex:mv,beginnormal_vertex:gv,bsdfs:_v,iridescence_fragment:Ev,bumpmap_pars_fragment:vv,clipping_planes_fragment:yv,clipping_planes_pars_fragment:xv,clipping_planes_pars_vertex:Sv,clipping_planes_vertex:Iv,color_fragment:Cv,color_pars_fragment:Mv,color_pars_vertex:wv,color_vertex:bv,common:Tv,cube_uv_reflection_fragment:Bv,defaultnormal_vertex:Rv,displacementmap_pars_vertex:Dv,displacementmap_vertex:Lv,emissivemap_fragment:Pv,emissivemap_pars_fragment:Uv,colorspace_fragment:Nv,colorspace_pars_fragment:Fv,envmap_fragment:Ov,envmap_common_pars_fragment:Qv,envmap_pars_fragment:kv,envmap_pars_vertex:Gv,envmap_physical_pars_fragment:Zv,envmap_vertex:Hv,fog_vertex:Vv,fog_pars_vertex:zv,fog_fragment:Wv,fog_pars_fragment:$v,gradientmap_pars_fragment:qv,lightmap_fragment:Xv,lightmap_pars_fragment:Yv,lights_lambert_fragment:Kv,lights_lambert_pars_fragment:Jv,lights_pars_begin:jv,lights_toon_fragment:ey,lights_toon_pars_fragment:ty,lights_phong_fragment:ny,lights_phong_pars_fragment:iy,lights_physical_fragment:sy,lights_physical_pars_fragment:ry,lights_fragment_begin:oy,lights_fragment_maps:ay,lights_fragment_end:ly,logdepthbuf_fragment:cy,logdepthbuf_pars_fragment:hy,logdepthbuf_pars_vertex:uy,logdepthbuf_vertex:dy,map_fragment:fy,map_pars_fragment:Ay,map_particle_fragment:py,map_particle_pars_fragment:my,metalnessmap_fragment:gy,metalnessmap_pars_fragment:_y,morphinstance_vertex:Ey,morphcolor_vertex:vy,morphnormal_vertex:yy,morphtarget_pars_vertex:xy,morphtarget_vertex:Sy,normal_fragment_begin:Iy,normal_fragment_maps:Cy,normal_pars_fragment:My,normal_pars_vertex:wy,normal_vertex:by,normalmap_pars_fragment:Ty,clearcoat_normal_fragment_begin:By,clearcoat_normal_fragment_maps:Ry,clearcoat_pars_fragment:Dy,iridescence_pars_fragment:Ly,opaque_fragment:Py,packing:Uy,premultiplied_alpha_fragment:Ny,project_vertex:Fy,dithering_fragment:Oy,dithering_pars_fragment:Qy,roughnessmap_fragment:ky,roughnessmap_pars_fragment:Gy,shadowmap_pars_fragment:Hy,shadowmap_pars_vertex:Vy,shadowmap_vertex:zy,shadowmask_pars_fragment:Wy,skinbase_vertex:$y,skinning_pars_vertex:qy,skinning_vertex:Xy,skinnormal_vertex:Yy,specularmap_fragment:Ky,specularmap_pars_fragment:Jy,tonemapping_fragment:jy,tonemapping_pars_fragment:Zy,transmission_fragment:ex,transmission_pars_fragment:tx,uv_pars_fragment:nx,uv_pars_vertex:ix,uv_vertex:sx,worldpos_vertex:rx,background_vert:ox,background_frag:ax,backgroundCube_vert:lx,backgroundCube_frag:cx,cube_vert:hx,cube_frag:ux,depth_vert:dx,depth_frag:fx,distanceRGBA_vert:Ax,distanceRGBA_frag:px,equirect_vert:mx,equirect_frag:gx,linedashed_vert:_x,linedashed_frag:Ex,meshbasic_vert:vx,meshbasic_frag:yx,meshlambert_vert:xx,meshlambert_frag:Sx,meshmatcap_vert:Ix,meshmatcap_frag:Cx,meshnormal_vert:Mx,meshnormal_frag:wx,meshphong_vert:bx,meshphong_frag:Tx,meshphysical_vert:Bx,meshphysical_frag:Rx,meshtoon_vert:Dx,meshtoon_frag:Lx,points_vert:Px,points_frag:Ux,shadow_vert:Nx,shadow_frag:Fx,sprite_vert:Ox,sprite_frag:Qx},re={common:{diffuse:{value:new Ce(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new Se(1,1)}}
vendor: 7,272 bytes, line 3554
3554,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ce(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 Ce(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Ce(16777215)},opacity:{value:1},center:{value:new Se(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},Vn={basic:{uniforms:tn([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:tn([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new Ce(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:tn([re.common,re.specularmap,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.fog,re.lights,{emissive:{value:new Ce(0)},specular:{value:new Ce(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:tn([re.common,re.envmap,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.roughnessmap,re.metalnessmap,re.fog,re.lights,{emissive:{value:new Ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:tn([re.common,re.aomap,re.lightmap,re.emissivemap,re.bumpmap,re.normalmap,re.displacementmap,re.gradientmap,re.fog,re.lights,{emissive:{value:new Ce(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:tn([re.common,re.bumpmap,re.normalmap,re.displacementmap,re.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:tn([re.points,re.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:tn([re.common,re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:tn([re.common,re.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:tn([re.common,re.bumpmap,re.normalmap,re.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:tn([re.sprite,re.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:tn([re.common,re.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:tn([re.lights,re.fog,{color:{value:new Ce(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};Vn.physical={uniforms:tn([Vn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new Se(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Ce(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new Se},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Ce(0)},specularColor:{value:new Ce(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new Se},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};const fa={r:0,b:0,g:0},Ji=new Cn,kx=new Me;function Gx(r,e,t,n,i,s,o){const a=new Ce(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(A,p){let x=!1,_=p.isScene===!0?p.background:null;_&&_.isTexture&&(_=(p.backgroundBlurriness>0?t:e).get(_)),_===null?g(a,l):_&&_.isColor&&(g(_,1),x=!0);const S=r.xr.getEnvironmentBlendMode();S==="additive"?n.buffers.color.setClear(0,0,0,1,o):S==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||x)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),_&&(_.isCubeTexture||_.mapping===Dl)?(h===void 0&&(h=new ot(new bs(1,1,1),new an({name:"Backgroun
3554dCubeMaterial",uniforms:br(Vn.backgroundCube.uniforms),vertexShader:Vn.backgroundCube.vertexShader,fragmentShader:Vn.backgroundCube.fragmentShader,side:Ht,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(C,I,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),Ji.copy(p.backgroundRotation),Ji.x*=-1,Ji.y*=-1,Ji.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Ji.y*=-1,Ji.z*=-1),h.material.uniforms.envMap.value=_,h.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(kx.makeRotationFromEuler(Ji)),h.material.toneMapped=Je.getTransfer(_.colorSpace)!==ut,(u!==_||d!==_.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=_,d=_.version,f=r.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new ot(new Yn(2,2),new an({name:"BackgroundMaterial",uniforms:br(Vn.background.uniforms),vertexShader:Vn.background.vertexShader,fragmentShader:Vn.background.fragmentShader,side:Nn,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=_,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=Je.getTransfer(_.colorSpace)!==ut,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(u!==_||d!==_.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=_,d=_.version,f=r.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function g(A,p){A.getRGB(fa,yg(r)),n.buffers.color.setClear(fa.r,fa.g,fa.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(A,p=1){a.set(A),l=p,g(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,g(a,l)},render:m}}function Hx(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,o=!1;function a(E,L,F,R,P){let N=!1;const G=u(R,F,L);s!==G&&(s=G,c(s.object)),N=f(E,R,F,P),N&&m(E,R,F,P),P!==null&&e.update(P,r.ELEMENT_ARRAY_BUFFER),(N||o)&&(o=!1,S(E,L,F,R),P!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(P).buffer))}function l(){return r.createVertexArray()}function c(E){return r.bindVertexArray(E)}function h(E){return r.deleteVertexArray(E)}function u(E,L,F){const R=F.wireframe===!0;let P=n[E.id];P===void 0&&(P={},n[E.id]=P);let N=P[L.id];N===void 0&&(N={},P[L.id]=N);let G=N[R];return G===void 0&&(G=d(l()),N[R]=G),G}function d(E){const L=[],F=[],R=[];for(let P=0;P<t;P++)L[P]=0,F[P]=0,R[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:F,attributeDivisors:R,object:E,attributes:{},index:null}}function f(E,L,F,R){const P=s.attributes,N=L.attributes;let G=0;const $=F.getAttributes();for(const O in $)if($[O].location>=0){const q=P[O];let ee=N[O];if(ee===void 0&&(O==="instanceMatrix"&&E.instanceMatrix&&(ee=E.instanceMatrix),O==="instanceColor"&&E.instanceColor&&(ee=E.instanceColor)),q===void 0||q.attribute!==ee||ee&&q.data!==ee.data)return!0;G++}return s.attributesNum!==G||s.index!==R}function m(E,L,F,R){const P={},N=L.attributes;let G=0;const $=F.getAttributes();for(const O in $)if($[O].location>=0){let q=N[O];q===void 0&&(O==="instanceMatrix"&&E.instanceMatrix&&(q=E.instanceMatrix),O==="instanceColor"&&E.instanceColor&&(q=E.instanceColor));const ee={};ee.attribute=q,q&&q.data&&(ee.data=q.data),P[O]=ee,G++}s.attributes=P,s.attributesNum=G,s.index=R}function g(){const E=s.newAttributes;for(let L=0,F=E.length;L<F;L++)E[L]=0}function A(E){p(E,0)}function p(E,L){const F=s.newAttributes,R=s.enabledAttributes,P=s.attributeDivisors;F[E]=1,R[E]===0&&(r.enableVertexAttribArray(E),R[E]=1),P[E]!==L&&(r.vertexAttribDivisor(E,L),P[E]=L)}function x(){const E=s.newAttributes,L=s.enabledAttributes;for(let F=0,R=L.length;F<R;F++)L[F]!==E[F]&&(r.disableVertexAttribArray(F),L[F]=0)}function _(E,L,F,R,P,N,G){G===!0?r.vertexAttribIPointer(E,L,F,P,N):r.vertexAttribPointer(E,L,F,R,P,N)}function S(E,L,F,R){g();const P=R.attributes,N=F.getAttributes(),G=L.defaultAttributeValues;for(const $ in N){const O=N[$];if(O.location>=0){let X=P[$];if(X===void 0&&($==="instanceMatrix"&&E.instanceMatrix&&(X=E.instanceMatrix),$==="instanceColor"&&E.instanceColor&&(X=E.instanceColor)),X!==void 0){const q=X.normalized,ee=X.itemSize,ue=e.get(X);if(ue===void 0)continue;const we=ue.buffer,z=ue.type,K=ue.bytesPerElement,le=z===r.INT||z===r.UNSIGNED_INT||X.gpuType===Ou;if(X.isInterleavedBufferAttribute){const oe=X.data,Be=oe.stride,Oe=X.offset;if(oe.isInstancedInterleavedBuffer){for(let Ve=0;Ve<O.locationSize;Ve++)p(O.location+Ve,oe.meshPerAttribute);E.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ve=0;Ve<O.locationSize;Ve++)A(O.location+Ve);r.bindBuffer(r.ARRAY_BUFFER,we);for(let Ve=0;Ve<O.locationSize;Ve++)_(O.location+Ve,ee/O.locationSize,z,q,Be*K,(Oe+ee/O.locationSize*Ve)*K,le)}else{if(X.isInstancedBufferAttribute){for(let oe=0;oe<O.locationSize;oe++)p(O.location+oe,X.meshPerAttribute);E.isInstancedMesh!==!0&&R._maxInstanceCount===void 0&&(R._maxInstanceCount=X.meshPerAttribute*X.count)}else for(let oe=0;oe<O.locationSize;oe++)A(O.location+oe);r.bindBuffer(r.ARRAY_BUFFER,we);for(let oe=0;oe<O.locationSize;oe++)_(O.location+oe,ee/O.locationSize,z,q,ee*K,ee/O.locationSize*oe*K,le)}}else if(G!==void 0){const q=G[$];if(q!==void 0)switch(q.length){case 2:r.vertexAttrib2fv(O.location,q);break;case 3:r.vertexAttrib3fv(O.location,q);break;case 4:r.vertexAttrib4fv(O.location,q);break;default:r.vertexAttrib1fv(O.location,q)}}}}x()}function C(){b();for(const E in n){const L=n[E];for(const F in L){const R=L[F];for(const P in R)h(R[P].object),delete R[P];delete L[F]}delete n[E]}}function I(E){if(n[E.id]===void 0)return;const L=n[E.id];for(const F in L){const R=L[F];for(const P in R)h(R[P].object),delete R[P];delete L[F]}delete n[E.id]}function w(E){for(const L in n){const F=n[L];if(F[E.id]===void 0)continue;const R=F[E.id];for(const P in R)h(R[P].object),delete R[P];delete F[E.id]}}function b(){v(),o=!0,s!==i&&(s=i,c(s.object))}function v(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:b,resetDefaultState:v,dispose:C,releaseStatesOfGeometry:I,releaseStatesOfProgram:w,initAttributes:g,enableAttribute:A,disableUnusedAttributes:x}}function Vx(r,e,t){let n;function i(l){n=l}function s(l,c){r.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,h){h!==0&&(r.drawArraysInstanced(n,l,c,h),t.update(c,n,h))}
vendor: 13,791 bytes, lines 3554-3629
3554function a(l,c,h){if(h===0)return;const u=e.get("WEBGL_multi_draw");if(u===null)for(let d=0;d<h;d++)this.render(l[d],c[d]);else{u.multiDrawArraysWEBGL(n,l,0,c,0,h);let d=0;for(let f=0;f<h;f++)d+=c[f];t.update(d,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function zx(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const _=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(_){if(_==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";_="mediump"}return _==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=t.precision!==void 0?t.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=t.logarithmicDepthBuffer===!0,c=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=r.getParameter(r.MAX_TEXTURE_SIZE),d=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),f=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),g=r.getParameter(r.MAX_VARYING_VECTORS),A=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),p=h>0,x=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:i,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:A,vertexTextures:p,maxSamples:x}}function Wx(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new rs,a=new De,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,g=u.clipIntersection,A=u.clipShadows,p=r.get(u);if(!i||m===null||m.length===0||s&&!A)s?h(null):c();else{const x=s?0:n,_=x*4;let S=p.clippingState||null;l.value=S,S=h(m,d,_,f);for(let C=0;C!==_;++C)S[C]=t[C];p.clippingState=S,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){const g=u!==null?u.length:0;let A=null;if(g!==0){if(A=l.value,m!==!0||A===null){const p=f+g*4,x=d.matrixWorldInverse;a.getNormalMatrix(x),(A===null||A.length<p)&&(A=new Float32Array(p));for(let _=0,S=f;_!==g;++_,S+=4)o.copy(u[_]).applyMatrix4(x,a),o.normal.toArray(A,S),A[S+3]=o.constant}l.value=A,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,A}}function $x(r){let e=new WeakMap;function t(o,a){return a===fl?o.mapping=Es:a===tu&&(o.mapping=Cr),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===fl||a===tu)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new $u(l.height);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ur extends xg{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=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=o,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,o){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=o,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,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),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 Ar=4,df=[.125,.215,.35,.446,.526,.582],fs=20,fc=new Ur,ff=new Ce;let Ac=null,pc=0,mc=0,gc=!1;const os=(1+Math.sqrt(5))/2,Ws=1/os,Af=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,os,Ws),new D(0,os,-Ws),new D(Ws,0,os),new D(-Ws,0,os),new D(os,Ws,0),new D(-os,Ws,0)];class pf{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){Ac=this._renderer.getRenderTarget(),pc=this._renderer.getActiveCubeFace(),mc=this._renderer.getActiveMipmapLevel(),gc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,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=_f(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gf(),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(Ac,pc,mc),this._renderer.xr.enabled=gc,e.scissorTest=!1,Aa(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Es||e.mapping===Cr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ac=this._renderer.getRenderTarget(),pc=this._renderer.getActiveCubeFace(),mc=this._renderer.getActiveMipmapLevel(),gc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;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:Xe,minFilter:Xe,generateMipmaps:!1,type:Gt,format:_t,colorSpace:it,depthBuffer:!1},i=mf(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mf(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=qx(s)),this._blurMaterial=Xx(s,e,t)}return i}_compileMaterial(e){const t=new ot(this._lodPlanes[0],e);this._renderer.compile(t,fc)}_sceneToCubeUV(e,t,n,i){const a=new Ft(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,d=h.toneMapping;h.getClearColor(ff),h.toneMapping=_i,h.autoClear=!1;const f=new xn({name:"PMREM.Background",side:Ht,depthWrite:!1,depthTest:!1}),m=new ot(new bs,f);let g=!1;const A=e.background;A?A.isColor&&(f.color.copy(A),e.background=null,g=!0):(f.color.copy(ff),g=!0);for(let p=0;p<6;p++){const x=p%3;x===0?(a.up.set(0,l[p],0),a.lookAt(c[p],0,0)):x===1?(a.up.set(0,0,l[p]),a.lookAt(0,c[p],0)):(a.up.set(0,l[p],0),a.lookAt(0,0,c[p]));const _=this._cubeSize;Aa(i,x*_,p>2?_:0,_,_),h.setRenderTarget(i),g&&h.render(m,a),h.render(e,a)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=d,h.autoClear=u,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Es||e.mapping===Cr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=_f()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gf());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new ot(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Aa(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,fc)}_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]),o=Af[(i-1)%Af.length];this._blur(e,i-1,i,s,o)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new ot(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*fs-1),g=s/m,A=isFinite(s)?1+Math.floor(h*g):fs;A>fs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${A} samples when the maximum is set to ${fs}`);const p=[];let x=0;for(let w=0;w<fs;++w){const b=w/g,v=Math.exp(-b*b/2);p.push(v),w===0?x+=v:w<A&&(x+=2*v)}for(let w=0;w<p.length;w++)p[w]=p[w]/x;d.envMap.value=e.texture,d.samples.value=A,d.weights.value=p,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:_}=this;d.dTheta.value=m,d.mipInt.value=_-n;const S=this._sizeLods[i],C=3*S*(i>_-Ar?i-_+Ar:0),I=4*(this._cubeSize-S);Aa(t,C,I,3*S,2*S),l.setRenderTarget(t),l.render(u,fc)}}function qx(r){const e=[],t=[],n=[];let i=r;const s=r-Ar+1+df.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);t.push(a);let l=1/a;o>r-Ar?l=df[o-r+Ar-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,g=3,A=2,p=1,x=new Float32Array(g*m*f),_=new Float32Array(A*m*f),S=new Float32Array(p*m*f);for(let I=0;I<f;I++){const w=I%3*2/3-1,b=I>2?0:-1,v=[w,b,0,w+2/3,b,0,w+2/3,b+1,0,w,b,0,w+2/3,b+1,0,w,b+1,0];x.set(v,g*m*I),_.set(d,A*m*I);const E=[I,I,I,I,I,I];S.set(E,p*m*I)}const C=new pn;C.setAttribute("position",new Et(x,g)),C.setAttribute("uv",new Et(_,A)),C.setAttribute("faceIndex",new Et(S,p)),e.push(C),i>Ar&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function mf(r,e,t){const n=new In(r,e,t);return n.texture.mapping=Dl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Aa(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function Xx(r,e,t){const n=new Float32Array(fs),i=new D(0,1,0);return new an({name:"SphericalGaussianBlur",defines:{n:fs,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:Xu(),fragmentShader:` 3555 3556 precision mediump float; 3557 precision mediump int; 3558 3559 varying vec3 vOutputDirection; 3560 3561 uniform sampler2D envMap; 3562 uniform int samples; 3563 uniform float weights[ n ]; 3564 uniform bool latitudinal; 3565 uniform float dTheta; 3566 uniform float mipInt; 3567 uniform vec3 poleAxis; 3568 3569 #define ENVMAP_TYPE_CUBE_UV 3570 #include <cube_uv_reflection_fragment> 3571 3572 vec3 getSample( float theta, vec3 axis ) { 3573 3574 float cosTheta = cos( theta ); 3575 // Rodrigues' axis-angle rotation 3576 vec3 sampleDirection = vOutputDirection * cosTheta 3577 + cross( axis, vOutputDirection ) * sin( theta ) 3578 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3579 3580 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3581 3582 } 3583 3584 void main() { 3585 3586 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3587 3588 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3589 3590 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3591 3592 } 3593 3594 axis = normalize( axis ); 3595 3596 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3597 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3598 3599 for ( int i = 1; i < n; i++ ) { 3600 3601 if ( i >= samples ) { 3602 3603 break; 3604 3605 } 3606 3607 float theta = dTheta * float( i ); 3608 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3609 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3610 3611 } 3612 3613 } 3614 `,blending:qn,depthTest:!1,depthWrite:!1})}function gf(){return new an({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Xu(),fragmentShader:` 3615 3616 precision mediump float; 3617 precision mediump int; 3618 3619 varying vec3 vOutputDirection; 3620 3621 uniform sampler2D envMap; 3622 3623 #include <common> 3624 3625 void main() { 3626 3627 vec3 outputDirection = normalize( vOutputDirection ); 3628 vec2 uv = equirectUv( outputDirection ); 3629
3630 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3631 3632 } 3633 `,blending:qn,depthTest:!1,depthWrite:!1})}function _f(){return new an({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Xu(),fragmentShader:` 3634 3635 precision mediump float; 3636 precision mediump int; 3637 3638 uniform float flipEnvMap; 3639 3640 varying vec3 vOutputDirection; 3641 3642 uniform samplerCube envMap; 3643 3644 void main() { 3645 3646 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3647 3648 } 3649 `,blending:qn,depthTest:!1,depthWrite:!1})}function Xu(){return` 3650 3651 precision mediump float; 3652 precision mediump int; 3653 3654 attribute float faceIndex; 3655 3656 varying vec3 vOutputDirection; 3657 3658 // RH coordinate system; PMREM face-indexing convention 3659 vec3 getDirection( vec2 uv, float face ) { 3660 3661 uv = 2.0 * uv - 1.0; 3662 3663 vec3 direction = vec3( uv, 1.0 ); 3664 3665 if ( face == 0.0 ) { 3666 3667 direction = direction.zyx; // ( 1, v, u ) pos x 3668 3669 } else if ( face == 1.0 ) { 3670 3671 direction = direction.xzy; 3672 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3673 3674 } else if ( face == 2.0 ) { 3675 3676 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3677 3678 } else if ( face == 3.0 ) { 3679 3680 direction = direction.zyx; 3681 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3682 3683 } else if ( face == 4.0 ) { 3684 3685 direction = direction.xzy; 3686 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3687 3688 } else if ( face == 5.0 ) { 3689 3690 direction.z *= -1.0; // ( u, v, -1 ) neg z 3691 3692 } 3693 3694 return direction; 3695 3696 } 3697 3698 void main() { 3699 3700 vOutputDirection = getDirection( uv, faceIndex ); 3701 gl_Position = vec4( position, 1.0 ); 3702 3703 } 3704 `}function Yx(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===fl||l===tu,h=l===Es||l===Cr;if(c||h){let u=e.get(a);const d=u!==void 0?u.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new pf(r)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),u.texture;if(u!==void 0)return u.texture;{const f=a.image;return c&&f&&f.height>0||h&&f&&i(f)?(t===null&&(t=new pf(r)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function i(a){let l=0;const c=6;for(let h=0;h<c;h++)a[h]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function Kx(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(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Jx(r,e,t,n){const i={},s=new WeakMap;function o(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);for(const m in d.morphAttributes){const g=d.morphAttributes[m];for(let A=0,p=g.length;A<p;A++)e.remove(g[A])}d.removeEventListener("dispose",o),delete i[d.id];const f=s.get(d);
vendor: 20,351 bytes, lines 3704-3737
3704f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(u,d){return i[d.id]===!0||(d.addEventListener("dispose",o),i[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const m in d)e.update(d[m],r.ARRAY_BUFFER);const f=u.morphAttributes;for(const m in f){const g=f[m];for(let A=0,p=g.length;A<p;A++)e.update(g[A],r.ARRAY_BUFFER)}}function c(u){const d=[],f=u.index,m=u.attributes.position;let g=0;if(f!==null){const x=f.array;g=f.version;for(let _=0,S=x.length;_<S;_+=3){const C=x[_+0],I=x[_+1],w=x[_+2];d.push(C,I,I,w,w,C)}}else if(m!==void 0){const x=m.array;g=m.version;for(let _=0,S=x.length/3-1;_<S;_+=3){const C=_+0,I=_+1,w=_+2;d.push(C,I,I,w,w,C)}}else return;const A=new(Ag(d)?vg:Eg)(d,1);A.version=g;const p=s.get(u);p&&e.remove(p),s.set(u,A)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:a,update:l,getWireframeAttribute:h}}function jx(r,e,t){let n;function i(u){n=u}let s,o;function a(u){s=u.type,o=u.bytesPerElement}function l(u,d){r.drawElements(n,d,s,u*o),t.update(d,n,1)}function c(u,d,f){f!==0&&(r.drawElementsInstanced(n,d,s,u*o,f),t.update(d,n,f))}function h(u,d,f){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let g=0;g<f;g++)this.render(u[g]/o,d[g]);else{m.multiDrawElementsWEBGL(n,d,0,s,u,0,f);let g=0;for(let A=0;A<f;A++)g+=d[A];t.update(g,n,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function Zx(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=a*(s/3);break;case r.LINES:t.lines+=a*(s/2);break;case r.LINE_STRIP:t.lines+=a*(s-1);break;case r.LINE_LOOP:t.lines+=a*s;break;case r.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){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 eS(r,e,t){const n=new WeakMap,i=new rt;function s(o,a,l){const c=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(a);if(d===void 0||d.count!==u){let v=function(){w.dispose(),n.delete(a),a.removeEventListener("dispose",v)};d!==void 0&&d.texture.dispose();const f=a.morphAttributes.position!==void 0,m=a.morphAttributes.normal!==void 0,g=a.morphAttributes.color!==void 0,A=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],x=a.morphAttributes.color||[];let _=0;f===!0&&(_=1),m===!0&&(_=2),g===!0&&(_=3);let S=a.attributes.position.count*_,C=1;S>e.maxTextureSize&&(C=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const I=new Float32Array(S*C*4*u),w=new mg(I,S,C,u);w.type=Bt,w.needsUpdate=!0;const b=_*4;for(let E=0;E<u;E++){const L=A[E],F=p[E],R=x[E],P=S*C*4*E;for(let N=0;N<L.count;N++){const G=N*b;f===!0&&(i.fromBufferAttribute(L,N),I[P+G+0]=i.x,I[P+G+1]=i.y,I[P+G+2]=i.z,I[P+G+3]=0),m===!0&&(i.fromBufferAttribute(F,N),I[P+G+4]=i.x,I[P+G+5]=i.y,I[P+G+6]=i.z,I[P+G+7]=0),g===!0&&(i.fromBufferAttribute(R,N),I[P+G+8]=i.x,I[P+G+9]=i.y,I[P+G+10]=i.z,I[P+G+11]=R.itemSize===4?i.w:1)}}d={count:u,texture:w,size:new Se(S,C)},n.set(a,d),a.addEventListener("dispose",v)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",o.morphTexture,t);else{let f=0;for(let g=0;g<c.length;g++)f+=c[g];const m=a.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function tS(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(i.get(u)!==c&&(e.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return u}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class Cg extends nt{constructor(e,t,n,i,s,o,a,l,c,h){if(h=h!==void 0?h:vr,h!==vr&&h!==bo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===vr&&(n=ys),n===void 0&&h===bo&&(n=Fo),super(null,i,s,o,a,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Tt,this.minFilter=l!==void 0?l:Tt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const Mg=new nt,wg=new Cg(1,1);wg.compareFunction=fg;const bg=new mg,Tg=new gg,Bg=new Sg,Ef=[],vf=[],yf=new Float32Array(16),xf=new Float32Array(9),Sf=new Float32Array(4);function Nr(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=Ef[i];if(s===void 0&&(s=new Float32Array(i),Ef[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Rt(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 Dt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Pl(r,e){let t=vf[e];t===void 0&&(t=new Int32Array(e),vf[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function nS(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function iS(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(Rt(t,e))return;r.uniform2fv(this.addr,e),Dt(t,e)}}function sS(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(Rt(t,e))return;r.uniform3fv(this.addr,e),Dt(t,e)}}function rS(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(Rt(t,e))return;r.uniform4fv(this.addr,e),Dt(t,e)}}function oS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,n))return;Sf.set(n),r.uniformMatrix2fv(this.addr,!1,Sf),Dt(t,n)}}function aS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,n))return;xf.set(n),r.uniformMatrix3fv(this.addr,!1,xf),Dt(t,n)}}function lS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Dt(t,e)}else{if(Rt(t,n))return;yf.set(n),r.uniformMatrix4fv(this.addr,!1,yf),Dt(t,n)}}function cS(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function hS(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(Rt(t,e))return;r.uniform2iv(this.addr,e),Dt(t,e)}}function uS(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(Rt(t,e))return;r.uniform3iv(this.addr,e),Dt(t,e)}}function dS(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(Rt(t,e))return;r.uniform4iv(this.addr,e),Dt(t,e)}}function fS(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function AS(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(Rt(t,e))return;r.uniform2uiv(this.addr,e),Dt(t,e)}}function pS(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(Rt(t,e))return;r.uniform3uiv(this.addr,e),Dt(t,e)}}function mS(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(Rt(t,e))return;r.uniform4uiv(this.addr,e),Dt(t,e)}}function gS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);const s=this.type===r.SAMPLER_2D_SHADOW?wg:Mg;t.setTexture2D(e||s,i)}function _S(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Tg,i)}function ES(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Bg,i)}function vS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||bg,i)}function yS(r){switch(r){case 5126:return nS;case 35664:return iS;case 35665:return sS;case 35666:return rS;case 35674:return oS;case 35675:return aS;case 35676:return lS;case 5124:case 35670:return cS;case 35667:case 35671:return hS;case 35668:case 35672:return uS;case 35669:case 35673:return dS;case 5125:return fS;case 36294:return AS;case 36295:return pS;case 36296:return mS;case 35678:case 36198:case 36298:case 36306:case 35682:return gS;case 35679:case 36299:case 36307:return _S;case 35680:case 36300:case 36308:case 36293:return ES;case 36289:case 36303:case 36311:case 36292:return vS}}function xS(r,e){r.uniform1fv(this.addr,e)}function SS(r,e){const t=Nr(e,this.size,2);r.uniform2fv(this.addr,t)}function IS(r,e){const t=Nr(e,this.size,3);r.uniform3fv(this.addr,t)}function CS(r,e){const t=Nr(e,this.size,4);r.uniform4fv(this.addr,t)}function MS(r,e){const t=Nr(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function wS(r,e){const t=Nr(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function bS(r,e){const t=Nr(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function TS(r,e){r.uniform1iv(this.addr,e)}function BS(r,e){r.uniform2iv(this.addr,e)}function RS(r,e){r.uniform3iv(this.addr,e)}function DS(r,e){r.uniform4iv(this.addr,e)}function LS(r,e){r.uniform1uiv(this.addr,e)}function PS(r,e){r.uniform2uiv(this.addr,e)}function US(r,e){r.uniform3uiv(this.addr,e)}function NS(r,e){r.uniform4uiv(this.addr,e)}function FS(r,e,t){const n=this.cache,i=e.length,s=Pl(t,i);Rt(n,s)||(r.uniform1iv(this.addr,s),Dt(n,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||Mg,s[o])}function OS(r,e,t){const n=this.cache,i=e.length,s=Pl(t,i);Rt(n,s)||(r.uniform1iv(this.addr,s),Dt(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||Tg,s[o])}function QS(r,e,t){const n=this.cache,i=e.length,s=Pl(t,i);Rt(n,s)||(r.uniform1iv(this.addr,s),Dt(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||Bg,s[o])}function kS(r,e,t){const n=this.cache,i=e.length,s=Pl(t,i);Rt(n,s)||(r.uniform1iv(this.addr,s),Dt(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||bg,s[o])}function GS(r){switch(r){case 5126:return xS;case 35664:return SS;case 35665:return IS;case 35666:return CS;case 35674:return MS;case 35675:return wS;case 35676:return bS;case 5124:case 35670:return TS;case 35667:case 35671:return BS;case 35668:case 35672:return RS;case 35669:case 35673:return DS;case 5125:return LS;case 36294:return PS;case 36295:return US;case 36296:return NS;case 35678:case 36198:case 36298:case 36306:case 35682:return FS;case 35679:case 36299:case 36307:return OS;case 35680:case 36300:case 36308:case 36293:return QS;case 36289:case 36303:case 36311:case 36292:return kS}}class HS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=yS(t.type)}}class VS{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=GS(t.type)}}class zS{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,t[a.id],n)}}}const _c=/(\w+)(\])?(\[|\.)?/g;function If(r,e){r.seq.push(e),r.map[e.id]=e}function WS(r,e,t){const n=r.name,i=n.length;for(_c.lastIndex=0;;){const s=_c.exec(n),o=_c.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){If(t,c===void 0?new HS(a,r,e):new VS(a,r,e));break}else{let u=t.map[a];u===void 0&&(u=new zS(a),If(t,u)),t=u}}}class ja{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);WS(s,o,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,o=t.length;s!==o;++s){const a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function Cf(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const $S=37297;let qS=0;function XS(r,e){const t=r.split(` 3705`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` 3706`)}function YS(r){const e=Je.getPrimaries(Je.workingColorSpace),t=Je.getPrimaries(r);let n;switch(e===t?n="":e===_l&&t===gl?n="LinearDisplayP3ToLinearSRGB":e===gl&&t===_l&&(n="LinearSRGBToLinearDisplayP3"),r){case it:case Oo:return[n,"LinearTransferOETF"];case gt:case Ll:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Mf(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` 3707 3708`+i+` 3709 3710`+XS(r.getShaderSource(e),o)}else return i}function KS(r,e){const t=YS(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function JS(r,e){let t;switch(e){case Y_:t="Linear";break;case K_:t="Reinhard";break;case J_:t="OptimizedCineon";break;case Rl:t="ACESFilmic";break;case tg:t="AgX";break;case Fu:t="Neutral";break;case j_:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function jS(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(mo).join(` 3711`)}function ZS(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3712`)}function eI(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),o=s.name;let a=1;s.type===r.FLOAT_MAT2&&(a=2),s.type===r.FLOAT_MAT3&&(a=3),s.type===r.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:a}}return t}function mo(r){return r!==""}function wf(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 bf(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tI=/^[ \t]*#include +<([\w\d./]+)>/gm;function hu(r){return r.replace(tI,iI)}const nI=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function iI(r,e){let t=ke[e];if(t===void 0){const n=nI.get(e);if(n!==void 0)t=ke[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return hu(t)}const sI=/#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 Tf(r){return r.replace(sI,rI)}function rI(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 Bf(r){let e=`precision ${r.precision} float; 3713 precision ${r.precision} int; 3714 precision ${r.precision} sampler2D; 3715 precision ${r.precision} samplerCube; 3716 precision ${r.precision} sampler3D; 3717 precision ${r.precision} sampler2DArray; 3718 precision ${r.precision} sampler2DShadow; 3719 precision ${r.precision} samplerCubeShadow; 3720 precision ${r.precision} sampler2DArrayShadow; 3721 precision ${r.precision} isampler2D; 3722 precision ${r.precision} isampler3D; 3723 precision ${r.precision} isamplerCube; 3724 precision ${r.precision} isampler2DArray; 3725 precision ${r.precision} usampler2D; 3726 precision ${r.precision} usampler3D; 3727 precision ${r.precision} usamplerCube; 3728 precision ${r.precision} usampler2DArray; 3729 `;return r.precision==="highp"?e+=` 3730#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3731#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3732#define LOW_PRECISION`),e}function oI(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Zm?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===y_?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===fi&&(e="SHADOWMAP_TYPE_VSM"),e}function aI(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Es:case Cr:e="ENVMAP_TYPE_CUBE";break;case Dl:e="ENVMAP_TYPE_CUBE_UV";break}return e}function lI(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Cr:e="ENVMAP_MODE_REFRACTION";break}return e}function cI(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case eg:e="ENVMAP_BLENDING_MULTIPLY";break;case q_:e="ENVMAP_BLENDING_MIX";break;case X_:e="ENVMAP_BLENDING_ADD";break}return e}function hI(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 uI(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=oI(t),c=aI(t),h=lI(t),u=cI(t),d=hI(t),f=jS(t),m=ZS(s),g=i.createProgram();let A,p,x=t.glslVersion?"#version "+t.glslVersion+` 3733`:"";t.isRawShaderMaterial?(A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(mo).join(` 3734`),A.length>0&&(A+=` 3735`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(mo).join(` 3736`),p.length>0&&(p+=` 3737`)):(A=[Bf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3737IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#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",` 3738`].filter(mo).join(` 3739`),p=[Bf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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_IR
3739IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==_i?"#define TONE_MAPPING":"",t.toneMapping!==_i?ke.tonemapping_pars_fragment:"",t.toneMapping!==_i?JS("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.colorspace_pars_fragment,KS("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3740`].filter(mo).join(` 3741`)),o=hu(o),o=wf(o,t),o=bf(o,t),a=hu(a),a=wf(a,t),a=bf(a,t),o=Tf(o),a=Tf(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es 3742`,A=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3743`)+` 3744`+A,p=["#define varying in",t.glslVersion===zd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===zd?"":"#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(` 3745`)+` 3746`+p);const _=x+A+o,S=x+p+a,C=Cf(i,i.VERTEX_SHADER,_),I=Cf(i,i.FRAGMENT_SHADER,S);i.attachShader(g,C),i.attachShader(g,I),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function w(L){if(r.debug.checkShaderErrors){const F=i.getProgramInfoLog(g).trim(),R=i.getShaderInfoLog(C).trim(),P=i.getShaderInfoLog(I).trim();let N=!0,G=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(N=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,C,I);else{const $=Mf(i,C,"vertex"),O=Mf(i,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` 3747 3748Material Name: `+L.name+` 3749Material Type: `+L.type+` 3750 3751Program Info Log: `+F+` 3752`+$+` 3753`+O)}else F!==""?console.warn("THREE.WebGLProgram: Program Info Log:",F):(R===""||P==="")&&(G=!1);G&&(L.diagnostics={runnable:N,programLog:F,vertexShader:{log:R,prefix:A},fragmentShader:{log:P,prefix:p}})}i.deleteShader(C),i.deleteShader(I),b=new ja(i,g),v=eI(i,g)}let b;this.getUniforms=function(){return b===void 0&&w(this),b};let v;this.getAttributes=function(){return v===void 0&&w(this),v};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(g,$S)),E},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=qS++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=C,this.fragmentShader=I,this}let dI=0;class fI{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),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.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 AI(e),t.set(e,n)),n}}class AI{constructor(e){this.id=dI++,this.code=e,this.usedTimes=0}}
vendor: 89,412 bytes, lines 3753-3805
3753function pI(r,e,t,n,i,s,o){const a=new Wu,l=new fI,c=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(v){return c.add(v),v===0?"uv":`uv${v}`}function A(v,E,L,F,R){const P=F.fog,N=R.geometry,G=v.isMeshStandardMaterial?F.environment:null,$=(v.isMeshStandardMaterial?t:e).get(v.envMap||G),O=$&&$.mapping===Dl?$.image.height:null,X=m[v.type];v.precision!==null&&(f=i.getMaxPrecision(v.precision),f!==v.precision&&console.warn("THREE.WebGLProgram.getParameters:",v.precision,"not supported, using",f,"instead."));const q=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,ee=q!==void 0?q.length:0;let ue=0;N.morphAttributes.position!==void 0&&(ue=1),N.morphAttributes.normal!==void 0&&(ue=2),N.morphAttributes.color!==void 0&&(ue=3);let we,z,K,le;if(X){const Vt=Vn[X];we=Vt.vertexShader,z=Vt.fragmentShader}else we=v.vertexShader,z=v.fragmentShader,l.update(v),K=l.getVertexShaderID(v),le=l.getFragmentShaderID(v);const oe=r.getRenderTarget(),Be=R.isInstancedMesh===!0,Oe=R.isBatchedMesh===!0,Ve=!!v.map,Q=!!v.matcap,Ge=!!$,Ee=!!v.aoMap,vt=!!v.lightMap,Re=!!v.bumpMap,st=!!v.normalMap,T=!!v.displacementMap,y=!!v.emissiveMap,W=!!v.metalnessMap,Y=!!v.roughnessMap,J=v.anisotropy>0,j=v.clearcoat>0,Ie=v.iridescence>0,Z=v.sheen>0,ge=v.transmission>0,be=J&&!!v.anisotropyMap,se=j&&!!v.clearcoatMap,he=j&&!!v.clearcoatNormalMap,Le=j&&!!v.clearcoatRoughnessMap,de=Ie&&!!v.iridescenceMap,fe=Ie&&!!v.iridescenceThicknessMap,We=Z&&!!v.sheenColorMap,qe=Z&&!!v.sheenRoughnessMap,Ze=!!v.specularMap,Ye=!!v.specularColorMap,ft=!!v.specularIntensityMap,pe=ge&&!!v.transmissionMap,B=ge&&!!v.thicknessMap,ie=!!v.gradientMap,ne=!!v.alphaMap,me=v.alphaTest>0,_e=!!v.alphaHash,at=!!v.extensions;let At=_i;v.toneMapped&&(oe===null||oe.isXRRenderTarget===!0)&&(At=r.toneMapping);const yt={shaderID:X,shaderType:v.type,shaderName:v.name,vertexShader:we,fragmentShader:z,defines:v.defines,customVertexShaderID:K,customFragmentShaderID:le,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:f,batching:Oe,instancing:Be,instancingColor:Be&&R.instanceColor!==null,instancingMorph:Be&&R.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:oe===null?r.outputColorSpace:oe.isXRRenderTarget===!0?oe.texture.colorSpace:it,alphaToCoverage:!!v.alphaToCoverage,map:Ve,matcap:Q,envMap:Ge,envMapMode:Ge&&$.mapping,envMapCubeUVHeight:O,aoMap:Ee,lightMap:vt,bumpMap:Re,normalMap:st,displacementMap:d&&T,emissiveMap:y,normalMapObjectSpace:st&&v.normalMapType===hE,normalMapTangentSpace:st&&v.normalMapType===dg,metalnessMap:W,roughnessMap:Y,anisotropy:J,anisotropyMap:be,clearcoat:j,clearcoatMap:se,clearcoatNormalMap:he,clearcoatRoughnessMap:Le,iridescence:Ie,iridescenceMap:de,iridescenceThicknessMap:fe,sheen:Z,sheenColorMap:We,sheenRoughnessMap:qe,specularMap:Ze,specularColorMap:Ye,specularIntensityMap:ft,transmission:ge,transmissionMap:pe,thicknessMap:B,gradientMap:ie,opaque:v.transparent===!1&&v.blending===Er&&v.alphaToCoverage===!1,alphaMap:ne,alphaTest:me,alphaHash:_e,combine:v.combine,mapUv:Ve&&g(v.map.channel),aoMapUv:Ee&&g(v.aoMap.channel),lightMapUv:vt&&g(v.lightMap.channel),bumpMapUv:Re&&g(v.bumpMap.channel),normalMapUv:st&&g(v.normalMap.channel),displacementMapUv:T&&g(v.displacementMap.channel),emissiveMapUv:y&&g(v.emissiveMap.channel),metalnessMapUv:W&&g(v.metalnessMap.channel),roughnessMapUv:Y&&g(v.roughnessMap.channel),anisotropyMapUv:be&&g(v.anisotropyMap.channel),clearcoatMapUv:se&&g(v.clearcoatMap.channel),clearcoatNormalMapUv:he&&g(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Le&&g(v.clearcoatRoughnessMap.channel),iridescenceMapUv:de&&g(v.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&g(v.iridescenceThicknessMap.channel),sheenColorMapUv:We&&g(v.sheenColorMap.channel),sheenRoughnessMapUv:qe&&g(v.sheenRoughnessMap.channel),specularMapUv:Ze&&g(v.specularMap.channel),specularColorMapUv:Ye&&g(v.specularColorMap.channel),specularIntensityMapUv:ft&&g(v.specularIntensityMap.channel),transmissionMapUv:pe&&g(v.transmissionMap.channel),thicknessMapUv:B&&g(v.thicknessMap.channel),alphaMapUv:ne&&g(v.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(st||J),vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:R.isPoints===!0&&!!N.attributes.uv&&(Ve||ne),fog:!!P,useFog:v.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:v.flatShading===!0,sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:R.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:ee,morphTextureStride:ue,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:v.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:At,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Ve&&v.map.isVideoTexture===!0&&Je.getTransfer(v.map.colorSpace)===ut,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Yt,flipSided:v.side===Ht,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:at&&v.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:at&&v.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return yt.vertexUv1s=c.has(1),yt.vertexUv2s=c.has(2),yt.vertexUv3s=c.has(3),c.clear(),yt}function p(v){const E=[];if(v.shaderID?E.push(v.shaderID):(E.push(v.customVertexShaderID),E.push(v.customFragmentShaderID)),v.defines!==void 0)for(const L in v.defines)E.push(L),E.push(v.defines[L]);return v.isRawShaderMaterial===!1&&(x(E,v),_(E,v),E.push(r.outputColorSpace)),E.push(v.customProgramCacheKey),E.join()}function x(v,E){v.push(E.precision),v.push(E.outputColorSpace),v.push(E.envMapMode),v.push(E.envMapCubeUVHeight),v.push(E.mapUv),v.push(E.alphaMapUv),v.push(E.lightMapUv),v.push(E.aoMapUv),v.push(E.bumpMapUv),v.push(E.normalMapUv),v.push(E.displacementMapUv),v.push(E.emissiveMapUv),v.push(E.metalnessMapUv),v.push(E.roughnessMapUv),v.push(E.anisotropyMapUv),v.push(E.clearcoatMapUv),v.push(E.clearcoatNormalMapUv),v.push(E.clearcoatRoughnessMapUv),v.push(E.iridescenceMapUv),v.push(E.iridescenceThicknessMapUv),v.push(E.sheenColorMapUv),v.push(E.sheenRoughnessMapUv),v.push(E.specularMapUv),v.push(E.specularColorMapUv),v.push(E.specularIntensityMapUv),v.push(E.transmissionMapUv),v.push(E.thicknessMapUv),v.push(E.combine),v.push(E.fogExp2),v.push(E.sizeAttenuation),v.push(E.morphTargetsCount),v.push(E.morphAttributeCount),v.push(E.numDirLights),v.push(E.numPointLights),v.push(E.numSpotLights),v.push(E.numSpotLightMaps),v.push(E.numHemiLights),v.push(E.numRectAreaLights),v.push(E.numDirLightShadows),v.push(E.numPointLightShadows),v.push(E.numSpotLightShadows),v.push(E.numSpotLightShadowsWithMaps),v.push(E.numLightProbes),v.push(E.shadowMapType),v.push(E.toneMapping),v.push(E.numClippingPlanes),v.push(E.numClipIntersection),v.push(E.depthPacking)}function _(v,E){a.disableAll(),E.supportsVertexTextures&&a.enable(0),E.instancing&&a.enable(1),E.instancingColor&&a.enable(2),E.instancingMorph&&a.enable(3),E.matcap&&a.enable(4),E.envMap&&a.enable(5),E.normalMapObjectSpace&&a.enable(6),E.normalMapTangentSpace&&a.enable(7),E.clearcoat&&a.enable(8),E.iridescence&&a.enable(9),E.alphaTest&&a.enable(10),E.vertexColors&&a.enable(11),E.vertexAlphas&&a.enable(12),E.vertexUv1s&&a.enable(13),E.vertexUv2s&&a.enable(14),E.vertexUv3s&&a.enable(15),E.vertexTangents&&a.enable(16),E.anisotropy&&a.enable(17),E.alphaHash&&a.enable(18),E.batching&&a.enable(19),v.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.skinning&&a.enable(4),E.morphTargets&&a.enable(5),E.morphNormals&&a.enable(6),E.morphColors&&a.enable(7),E.premultipliedAlpha&&a.enable(8),E.shadowMapEnabled&&a.enable(9),E.useLegacyLights&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),E.decodeVideoTexture&&a.enable(19),E.alphaToCoverage&&a.enable(20),v.push(a.mask)}function S(v){const E=m[v.type];let L;if(E){const F=Vn[E];L=ev.clone(F.uniforms)}else L=v.uniforms;return L}function C(v,E){let L;for(let F=0,R=h.length;F<R;F++){const P=h[F];if(P.cacheKey===E){L=P,++L.usedTimes;break}}return L===void 0&&(L=new uI(r,E,v,s),h.push(L)),L}function I(v){if(--v.usedTimes===0){const E=h.indexOf(v);h[E]=h[h.length-1],h.pop(),v.destroy()}}function w(v){l.remove(v)}function b(){l.dispose()}return{getParameters:A,getProgramCacheKey:p,getUniforms:S,acquireProgram:C,releaseProgram:I,releaseShaderCache:w,programs:h,dispose:b}}function mI(){let r=new WeakMap;function e(s){let o=r.get(s);return o===void 0&&(o={},r.set(s,o)),o}function t(s){r.delete(s)}function n(s,o,a){r.get(s)[o]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function gI(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 Rf(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 Df(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(u,d,f,m,g,A){let p=r[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:g,group:A},r[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=g,p.group=A),e++,p}function a(u,d,f,m,g,A){const p=o(u,d,f,m,g,A);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(u,d,f,m,g,A){const p=o(u,d,f,m,g,A);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,d){t.length>1&&t.sort(u||gI),n.length>1&&n.sort(d||Rf),i.length>1&&i.sort(d||Rf)}function h(){for(let u=e,d=r.length;u<d;u++){const f=r[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:l,finish:h,sort:c}}function _I(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new Df,r.set(n,[o])):i>=s.length?(o=new Df,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function EI(){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 D,color:new Ce};break;case"SpotLight":t={position:new D,direction:new D,color:new Ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Ce,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Ce,groundColor:new Ce};break;case"RectAreaLight":t={color:new Ce,position:new D,halfWidth:new D,halfHeight:new D};break}return r[e.id]=t,t}}}function vI(){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 yI=0;function xI(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function SI(r){const e=new EI,t=vI(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new D);const i=new D,s=new Me,o=new Me;function a(c,h){let u=0,d=0,f=0;for(let L=0;L<9;L++)n.probe[L].set(0,0,0);let m=0,g=0,A=0,p=0,x=0,_=0,S=0,C=0,I=0,w=0,b=0;c.sort(xI);const v=h===!0?Math.PI:1;for(let L=0,F=c.length;L<F;L++){const R=c[L],P=R.color,N=R.intensity,G=R.distance,$=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)u+=P.r*N*v,d+=P.g*N*v,f+=P.b*N*v;else if(R.isLightProbe){for(let O=0;O<9;O++)n.probe[O].addScaledVector(R.sh.coefficients[O],N);b++}else if(R.isDirectionalLight){const O=e.get(R);if(O.color.copy(R.color).multiplyScalar(R.intensity*v),R.castShadow){const X=R.shadow,q=t.get(R);q.shadowBias=X.bias,q.shadowNormalBias=X.normalBias,q.shadowRadius=X.radius,q.shadowMapSize=X.mapSize,n.directionalShadow[m]=q,n.directionalShadowMap[m]=$,n.directionalShadowMatrix[m]=R.shadow.matrix,_++}n.directional[m]=O,m++}else if(R.isSpotLight){const O=e.get(R);O.position.setFromMatrixPosition(R.matrixWorld),O.color.copy(P).multiplyScalar(N*v),O.distance=G,O.coneCos=Math.cos(R.angle),O.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),O.decay=R.decay,n.spot[A]=O;const X=R.shadow;if(R.map&&(n.spotLightMap[I]=R.map,I++,X.updateMatrices(R),R.castShadow&&w++),n.spotLightMatrix[A]=X.matrix,R.castShadow){const q=t.get(R);q.shadowBias=X.bias,q.shadowNormalBias=X.normalBias,q.shadowRadius=X.radius,q.shadowMapSize=X.mapSize,n.spotShadow[A]=q,n.spotShadowMap[A]=$,C++}A++}else if(R.isRectAreaLight){const O=e.get(R);O.color.copy(P).multiplyScalar(N),O.halfWidth.set(R.width*.5,0,0),O.halfHeight.set(0,R.height*.5,0),n.rectArea[p]=O,p++}else if(R.isPointLight){const O=e.get(R);if(O.color.copy(R.color).multiplyScalar(R.intensity*v),O.distance=R.distance,O.decay=R.decay,R.castShadow){const X=R.shadow,q=t.get(R);q.shadowBias=X.bias,q.shadowNormalBias=X.normalBias,q.shadowRadius=X.radius,q.shadowMapSize=X.mapSize,q.shadowCameraNear=X.camera.near,q.shadowCameraFar=X.camera.far,n.pointShadow[g]=q,n.pointShadowMap[g]=$,n.pointShadowMatrix[g]=R.shadow.matrix,S++}n.point[g]=O,g++}else if(R.isHemisphereLight){const O=e.get(R);O.skyColor.copy(R.color).multiplyScalar(N*v),O.groundColor.copy(R.groundColor).multiplyScalar(N*v),n.hemi[x]=O,x++}}p>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=re.LTC_FLOAT_1,n.rectAreaLTC2=re.LTC_FLOAT_2):(n.rectAreaLTC1=re.LTC_HALF_1,n.rectAreaLTC2=re.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=d,n.ambient[2]=f;const E=n.hash;(E.directionalLength!==m||E.pointLength!==g||E.spotLength!==A||E.rectAreaLength!==p||E.hemiLength!==x||E.numDirectionalShadows!==_||E.numPointShadows!==S||E.numSpotShadows!==C||E.numSpotMaps!==I||E.numLightProbes!==b)&&(n.directional.length=m,n.spot.length=A,n.rectArea.length=p,n.point.length=g,n.hemi.length=x,n.directionalShadow.length=_,n.directionalShadowMap.length=_,n.pointShadow.length=S,n.pointShadowMap.length=S,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=_,n.pointShadowMatrix.length=S,n.spotLightMatrix.length=C+I-w,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=b,E.directionalLength=m,E.pointLength=g,E.spotLength=A,E.rectAreaLength=p,E.hemiLength=x,E.numDirectionalShadows=_,E.numPointShadows=S,E.numSpotShadows=C,E.numSpotMaps=I,E.numLightProbes=b,n.version=yI++)}function l(c,h){let u=0,d=0,f=0,m=0,g=0;const A=h.matrixWorldInverse;for(let p=0,x=c.length;p<x;p++){const _=c[p];if(_.isDirectionalLight){const S=n.directional[u];S.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),S.direction.sub(i),S.direction.transformDirection(A),u++}else if(_.isSpotLight){const S=n.spot[f];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(A),S.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),S.direction.sub(i),S.direction.transformDirection(A),f++}else if(_.isRectAreaLight){const S=n.rectArea[m];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(A),o.identity(),s.copy(_.matrixWorld),s.premultiply(A),o.extractRotation(s),S.halfWidth.set(_.width*.5,0,0),S.halfHeight.set(0,_.height*.5,0),S.halfWidth.applyMatrix4(o),S.halfHeight.applyMatrix4(o),m++}else if(_.isPointLight){const S=n.point[d];S.position.setFromMatrixPosition(_.matrixWorld),S.position.applyMatrix4(A),d++}else if(_.isHemisphereLight){const S=n.hemi[g];S.direction.setFromMatrixPosition(_.matrixWorld),S.direction.transformDirection(A),g++}}}return{setup:a,setupView:l,state:n}}function Lf(r){const e=new SI(r),t=[],n=[];function i(){t.length=0,n.length=0}function s(h){t.push(h)}function o(h){n.push(h)}function a(h){e.setup(t,h)}function l(h){e.setupView(t,h)}return{init:i,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function II(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Lf(r),e.set(i,[a])):s>=o.length?(a=new Lf(r),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class Rg extends Un{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=lE,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 CI extends Un{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const MI=`void main() { 3754 gl_Position = vec4( position, 1.0 ); 3755}`,wI=`uniform sampler2D shadow_pass; 3756uniform vec2 resolution; 3757uniform float radius; 3758#include <packing> 3759void main() { 3760 const float samples = float( VSM_SAMPLES ); 3761 float mean = 0.0; 3762 float squared_mean = 0.0; 3763 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3764 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3765 for ( float i = 0.0; i < samples; i ++ ) { 3766 float uvOffset = uvStart + i * uvStride; 3767 #ifdef HORIZONTAL_PASS 3768 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3769 mean += distribution.x; 3770 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3771 #else 3772 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3773 mean += depth; 3774 squared_mean += depth * depth; 3775 #endif 3776 } 3777 mean = mean / samples; 3778 squared_mean = squared_mean / samples; 3779 float std_dev = sqrt( squared_mean - mean * mean ); 3780 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3781}`;function bI(r,e,t){let n=new qu;const i=new Se,s=new Se,o=new rt,a=new Rg({depthPacking:cE}),l=new CI,c={},h=t.maxTextureSize,u={[Nn]:Ht,[Ht]:Nn,[Yt]:Yt},d=new an({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Se},radius:{value:4}},vertexShader:MI,fragmentShader:wI}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new pn;m.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ot(m,d),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Zm;let p=this.type;this.render=function(I,w,b){if(A.enabled===!1||A.autoUpdate===!1&&A.needsUpdate===!1||I.length===0)return;const v=r.getRenderTarget(),E=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),F=r.state;F.setBlending(qn),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const R=p!==fi&&this.type===fi,P=p===fi&&this.type!==fi;for(let N=0,G=I.length;N<G;N++){const $=I[N],O=$.shadow;if(O===void 0){console.warn("THREE.WebGLShadowMap:",$,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;i.copy(O.mapSize);const X=O.getFrameExtents();if(i.multiply(X),s.copy(O.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/X.x),i.x=s.x*X.x,O.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/X.y),i.y=s.y*X.y,O.mapSize.y=s.y)),O.map===null||R===!0||P===!0){const ee=this.type!==fi?{minFilter:Tt,magFilter:Tt}:{};O.map!==null&&O.map.dispose(),O.map=new In(i.x,i.y,ee),O.map.texture.name=$.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const q=O.getViewportCount();for(let ee=0;ee<q;ee++){const ue=O.getViewport(ee);o.set(s.x*ue.x,s.y*ue.y,s.x*ue.z,s.y*ue.w),F.viewport(o),O.updateMatrices($,ee),n=O.getFrustum(),S(w,b,O.camera,$,this.type)}O.isPointLightShadow!==!0&&this.type===fi&&x(O,b),O.needsUpdate=!1}p=this.type,A.needsUpdate=!1,r.setRenderTarget(v,E,L)};function x(I,w){const b=e.update(g);d.defines.VSM_SAMPLES!==I.blurSamples&&(d.defines.VSM_SAMPLES=I.blurSamples,f.defines.VSM_SAMPLES=I.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),I.mapPass===null&&(I.mapPass=new In(i.x,i.y)),d.uniforms.shadow_pass.value=I.map.texture,d.uniforms.resolution.value=I.mapSize,d.uniforms.radius.value=I.radius,r.setRenderTarget(I.mapPass),r.clear(),r.renderBufferDirect(w,null,b,d,g,null),f.uniforms.shadow_pass.value=I.mapPass.texture,f.uniforms.resolution.value=I.mapSize,f.uniforms.radius.value=I.radius,r.setRenderTarget(I.map),r.clear(),r.renderBufferDirect(w,null,b,f,g,null)}function _(I,w,b,v){let E=null;const L=b.isPointLight===!0?I.customDistanceMaterial:I.customDepthMaterial;if(L!==void 0)E=L;else if(E=b.isPointLight===!0?l:a,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const F=E.uuid,R=w.uuid;let P=c[F];P===void 0&&(P={},c[F]=P);let N=P[R];N===void 0&&(N=E.clone(),P[R]=N,w.addEventListener("dispose",C)),E=N}if(E.visible=w.visible,E.wireframe=w.wireframe,v===fi?E.side=w.shadowSide!==null?w.shadowSide:w.side:E.side=w.shadowSide!==null?w.shadowSide:u[w.side],E.alphaMap=w.alphaMap,E.alphaTest=w.alphaTest,E.map=w.map,E.clipShadows=w.clipShadows,E.clippingPlanes=w.clippingPlanes,E.clipIntersection=w.clipIntersection,E.displacementMap=w.displacementMap,E.displacementScale=w.displacementScale,E.displacementBias=w.displacementBias,E.wireframeLinewidth=w.wireframeLinewidth,E.linewidth=w.linewidth,b.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const F=r.properties.get(E);F.light=b}return E}function S(I,w,b,v,E){if(I.visible===!1)return;if(I.layers.test(w.layers)&&(I.isMesh||I.isLine||I.isPoints)&&(I.castShadow||I.receiveShadow&&E===fi)&&(!I.frustumCulled||n.intersectsObject(I))){I.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,I.matrixWorld);const R=e.update(I),P=I.material;if(Array.isArray(P)){const N=R.groups;for(let G=0,$=N.length;G<$;G++){const O=N[G],X=P[O.materialIndex];if(X&&X.visible){const q=_(I,X,v,E);I.onBeforeShadow(r,I,w,b,R,q,O),r.renderBufferDirect(b,null,R,q,I,O),I.onAfterShadow(r,I,w,b,R,q,O)}}}else if(P.visible){const N=_(I,P,v,E);I.onBeforeShadow(r,I,w,b,R,N,null),r.renderBufferDirect(b,null,R,N,I,null),I.onAfterShadow(r,I,w,b,R,N,null)}}const F=I.children;for(let R=0,P=F.length;R<P;R++)S(F[R],w,b,v,E)}function C(I){I.target.removeEventListener("dispose",C);for(const b in c){const v=c[b],E=I.target.uuid;E in v&&(v[E].dispose(),delete v[E])}}}function TI(r){function e(){let B=!1;const ie=new rt;let ne=null;const me=new rt(0,0,0,0);return{setMask:function(_e){ne!==_e&&!B&&(r.colorMask(_e,_e,_e,_e),ne=_e)},setLocked:function(_e){B=_e},setClear:function(_e,at,At,yt,Vt){Vt===!0&&(_e*=yt,at*=yt,At*=yt),ie.set(_e,at,At,yt),me.equals(ie)===!1&&(r.clearColor(_e,at,At,yt),me.copy(ie))},reset:function(){B=!1,ne=null,me.set(-1,0,0,0)}}}function t(){let B=!1,ie=null,ne=null,me=null;return{setTest:function(_e){_e?le(r.DEPTH_TEST):oe(r.DEPTH_TEST)},setMask:function(_e){ie!==_e&&!B&&(r.depthMask(_e),ie=_e)},setFunc:function(_e){if(ne!==_e){switch(_e){case k_:r.depthFunc(r.NEVER);break;case G_:r.depthFunc(r.ALWAYS);break;case H_:r.depthFunc(r.LESS);break;case dl:r.depthFunc(r.LEQUAL);break;case V_:r.depthFunc(r.EQUAL);break;case z_:r.depthFunc(r.GEQUAL);break;case W_:r.depthFunc(r.GREATER);break;case $_:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}ne=_e}},setLocked:function(_e){B=_e},setClear:function(_e){me!==_e&&(r.clearDepth(_e),me=_e)},reset:function(){B=!1,ie=null,ne=null,me=null}}}function n(){let B=!1,ie=null,ne=null,me=null,_e=null,at=null,At=null,yt=null,Vt=null;return{setTest:function(ct){B||(ct?le(r.STENCIL_TEST):oe(r.STENCIL_TEST))},setMask:function(ct){ie!==ct&&!B&&(r.stencilMask(ct),ie=ct)},setFunc:function(ct,Qn,kn){(ne!==ct||me!==Qn||_e!==kn)&&(r.stencilFunc(ct,Qn,kn),ne=ct,me=Qn,_e=kn)},setOp:function(ct,Qn,kn){(at!==ct||At!==Qn||yt!==kn)&&(r.stencilOp(ct,Qn,kn),at=ct,At=Qn,yt=kn)},setLocked:function(ct){B=ct},setClear:function(ct){Vt!==ct&&(r.clearStencil(ct),Vt=ct)},reset:function(){B=!1,ie=null,ne=null,me=null,_e=null,at=null,At=null,yt=null,Vt=null}}}const i=new e,s=new t,o=new n,a=new WeakMap,l=new WeakMap;let c={},h={},u=new WeakMap,d=[],f=null,m=!1,g=null,A=null,p=null,x=null,_=null,S=null,C=null,I=new Ce(0,0,0),w=0,b=!1,v=null,E=null,L=null,F=null,R=null;const P=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=!1,G=0;const $=r.getParameter(r.VERSION);$.indexOf("WebGL")!==-1?(G=parseFloat(/^WebGL (\d)/.exec($)[1]),N=G>=1):$.indexOf("OpenGL ES")!==-1&&(G=parseFloat(/^OpenGL ES (\d)/.exec($)[1]),N=G>=2);let O=null,X={};const q=r.getParameter(r.SCISSOR_BOX),ee=r.getParameter(r.VIEWPORT),ue=new rt().fromArray(q),we=new rt().fromArray(ee);function z(B,ie,ne,me){const _e=new Uint8Array(4),at=r.createTexture();r.bindTexture(B,at),r.texParameteri(B,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(B,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let At=0;At<ne;At++)B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY?r.texImage3D(ie,0,r.RGBA,1,1,me,0,r.RGBA,r.UNSIGNED_BYTE,_e):r.texImage2D(ie+At,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,_e);return at}const K={};K[r.TEXTURE_2D]=z(r.TEXTURE_2D,r.TEXTURE_2D,1),K[r.TEXTURE_CUBE_MAP]=z(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),K[r.TEXTURE_2D_ARRAY]=z(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),K[r.TEXTURE_3D]=z(r.TEXTURE_3D,r.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),o.setClear(0),le(r.DEPTH_TEST),s.setFunc(dl),Re(!1),st(_d),le(r.CULL_FACE),Ee(qn);function le(B){c[B]!==!0&&(r.enable(B),c[B]=!0)}function oe(B){c[B]!==!1&&(r.disable(B),c[B]=!1)}function Be(B,ie){return h[B]!==ie?(r.bindFramebuffer(B,ie),h[B]=ie,B===r.DRAW_FRAMEBUFFER&&(h[r.FRAMEBUFFER]=ie),B===r.FRAMEBUFFER&&(h[r.DRAW_FRAMEBUFFER]=ie),!0):!1}function Oe(B,ie){let ne=d,me=!1;if(B){ne=u.get(ie),ne===void 0&&(ne=[],u.set(ie,ne));const _e=B.textures;if(ne.length!==_e.length||ne[0]!==r.COLOR_ATTACHMENT0){for(let at=0,At=_e.length;at<At;at++)ne[at]=r.COLOR_ATTACHMENT0+at;ne.length=_e.length,me=!0}}else ne[0]!==r.BACK&&(ne[0]=r.BACK,me=!0);me&&r.drawBuffers(ne)}function Ve(B){return f!==B?(r.useProgram(B),f=B,!0):!1}const Q={[ds]:r.FUNC_ADD,[S_]:r.FUNC_SUBTRACT,[I_]:r.FUNC_REVERSE_SUBTRACT};Q[C_]=r.MIN,Q[M_]=r.MAX;const Ge={[w_]:r.ZERO,[b_]:r.ONE,[T_]:r.SRC_COLOR,[Zh]:r.SRC_ALPHA,[U_]:r.SRC_ALPHA_SATURATE,[L_]:r.DST_COLOR,[R_]:r.DST_ALPHA,[B_]:r.ONE_MINUS_SRC_COLOR,[eu]:r.ONE_MINUS_SRC_ALPHA,[P_]:r.ONE_MINUS_DST_COLOR,[D_]:r.ONE_MINUS_DST_ALPHA,[N_]:r.CONSTANT_COLOR,[F_]:r.ONE_MINUS_CONSTANT_COLOR,[O_]:r.CONSTANT_ALPHA,[Q_]:r.ONE_MINUS_CONSTANT_ALPHA};function Ee(B,ie,ne,me,_e,at,At,yt,Vt,ct){if(B===qn){m===!0&&(oe(r.BLEND),m=!1);return}if(m===!1&&(le(r.BLEND),m=!0),B!==x_){if(B!==g||ct!==b){if((A!==ds||_!==ds)&&(r.blendEquation(r.FUNC_ADD),A=ds,_=ds),ct)switch(B){case Er:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ed:r.blendFunc(r.ONE,r.ONE);break;case vd:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case yd:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",B);break}else switch(B){case Er:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ed:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case vd:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case yd:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",B);break}p=null,x=null,S=null,C=null,I.set(0,0,0),w=0,g=B,b=ct}return}_e=_e||ie,at=at||ne,At=At||me,(ie!==A||_e!==_)&&(r.blendEquationSeparate(Q[ie],Q[_e]),A=ie,_=_e),(ne!==p||me!==x||at!==S||At!==C)&&(r.blendFuncSeparate(Ge[ne],Ge[me],Ge[at],Ge[At]),p=ne,x=me,S=at,C=At),(yt.equals(I)===!1||Vt!==w)&&(r.blendColor(yt.r,yt.g,yt.b,Vt),I.copy(yt),w=Vt),g=B,b=!1}function vt(B,ie){B.side===Yt?oe(r.CULL_FACE):le(r.CULL_FACE);let ne=B.side===Ht;ie&&(ne=!ne),Re(ne),B.blending===Er&&B.transparent===!1?Ee(qn):Ee(B.blending,B.blendEquation,B.blendSrc,B.blendDst,B.blendEquationAlpha,B.blendSrcAlpha,B.blendDstAlpha,B.blendColor,B.blendAlpha,B.premultipliedAlpha),s.setFunc(B.depthFunc),s.setTest(B.depthTest),s.setMask(B.depthWrite),i.setMask(B.colorWrite);const me=B.stencilWrite;o.setTest(me),me&&(o.setMask(B.stencilWriteMask),o.setFunc(B.stencilFunc,B.stencilRef,B.stencilFuncMask),o.setOp(B.stencilFail,B.stencilZFail,B.stencilZPass)),y(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),B.alphaToCoverage===!0?le(r.SAMPLE_ALPHA_TO_COVERAGE):oe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Re(B){v!==B&&(B?r.frontFace(r.CW):r.frontFace(r.CCW),v=B)}function st(B){B!==E_?(le(r.CULL_FACE),B!==E&&(B===_d?r.cullFace(r.BACK):B===v_?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):oe(r.CULL_FACE),E=B}function T(B){B!==L&&(N&&r.lineWidth(B),L=B)}function y(B,ie,ne){B?(le(r.POLYGON_OFFSET_FILL),(F!==ie||R!==ne)&&(r.polygonOffset(ie,ne),F=ie,R=ne)):oe(r.POLYGON_OFFSET_FILL)}function W(B){B?le(r.SCISSOR_TEST):oe(r.SCISSOR_TEST)}function Y(B){B===void 0&&(B=r.TEXTURE0+P-1),O!==B&&(r.activeTexture(B),O=B)}function J(B,ie,ne){ne===void 0&&(O===null?ne=r.TEXTURE0+P-1:ne=O);let me=X[ne];me===void 0&&(me={type:void 0,texture:void 0},X[ne]=me),(me.type!==B||me.texture!==ie)&&(O!==ne&&(r.activeTexture(ne),O=ne),r.bindTexture(B,ie||K[B]),me.type=B,me.texture=ie)}function j(){const B=X[O];B!==void 0&&B.type!==void 0&&(r.bindTexture(B.type,null),B.type=void 0,B.texture=void 0)}function Ie(){try{r.compressedTexImage2D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function Z(){try{r.compressedTexImage3D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function ge(){try{r.texSubImage2D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function be(){try{r.texSubImage3D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function se(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function he(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function Le(){try{r.texStorage2D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function de(){try{r.texStorage3D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function fe(){try{r.texImage2D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function We(){try{r.texImage3D.apply(r,arguments)}catch(B){console.error("THREE.WebGLState:",B)}}function qe(B){ue.equals(B)===!1&&(r.scissor(B.x,B.y,B.z,B.w),ue.copy(B))}function Ze(B){we.equals(B)===!1&&(r.viewport(B.x,B.y,B.z,B.w),we.copy(B))}function Ye(B,ie){let ne=l.get(ie);ne===void 0&&(ne=new WeakMap,l.set(ie,ne));let me=ne.get(B);me===void 0&&(me=r.getUniformBlockIndex(ie,B.name),ne.set(B,me))}function ft(B,ie){const me=l.get(ie).get(B);a.get(ie)!==me&&(r.uniformBlockBinding(ie,me,B.__bindingPointIndex),a.set(ie,me))}function pe(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,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),c={},O=null,X={},h={},u=new WeakMap,d=[],f=null,m=!1,g=null,A=null,p=null,x=null,_=null,S=null,C=null,I=new Ce(0,0,0),w=0,b=!1,v=null,E=null,L=null,F=null,R=null,ue.set(0,0,r.canvas.width,r.canvas.height),we.set(0,0,r.canvas.width,r.canvas.height),i.reset(),s.reset(),o.reset()}return{buffers:{color:i,depth:s,stencil:o},enable:le,disable:oe,bindFramebuffer:Be,drawBuffers:Oe,useProgram:Ve,setBlending:Ee,setMaterial:vt,setFlipSided:Re,setCullFace:st,setLineWidth:T,setPolygonOffset:y,setScissorTest:W,activeTexture:Y,bindTexture:J,unbindTexture:j,compressedTexImage2D:Ie,compressedTexImage3D:Z,texImage2D:fe,texImage3D:We,updateUBOMapping:Ye,uniformBlockBinding:ft,texStorage2D:Le,texStorage3D:de,texSubImage2D:ge,texSubImage3D:be,compressedTexSubImage2D:se,compressedTexSubImage3D:he,scissor:qe,viewport:Ze,reset:pe}}function BI(r,e,t,n,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Se,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(T,y){return f?new OffscreenCanvas(T,y):To("canvas")}function g(T,y,W){let Y=1;const J=st(T);if((J.width>W||J.height>W)&&(Y=W/Math.max(J.width,J.height)),Y<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const j=Math.floor(Y*J.width),Ie=Math.floor(Y*J.height);u===void 0&&(u=m(j,Ie));const Z=y?m(j,Ie):u;return Z.width=j,Z.height=Ie,Z.getContext("2d").drawImage(T,0,0,j,Ie),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+j+"x"+Ie+")."),Z}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),T;return T}function A(T){return T.generateMipmaps&&T.minFilter!==Tt&&T.minFilter!==Xe}function p(T){r.generateMipmap(T)}function x(T,y,W,Y,J=!1){if(T!==null){if(r[T]!==void 0)return r[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let j=y;if(y===r.RED&&(W===r.FLOAT&&(j=r.R32F),W===r.HALF_FLOAT&&(j=r.R16F),W===r.UNSIGNED_BYTE&&(j=r.R8)),y===r.RED_INTEGER&&(W===r.UNSIGNED_BYTE&&(j=r.R8UI),W===r.UNSIGNED_SHORT&&(j=r.R16UI),W===r.UNSIGNED_INT&&(j=r.R32UI),W===r.BYTE&&(j=r.R8I),W===r.SHORT&&(j=r.R16I),W===r.INT&&(j=r.R32I)),y===r.RG&&(W===r.FLOAT&&(j=r.RG32F),W===r.HALF_FLOAT&&(j=r.RG16F),W===r.UNSIGNED_BYTE&&(j=r.RG8)),y===r.RG_INTEGER&&(W===r.UNSIGNED_BYTE&&(j=r.RG8UI),W===r.UNSIGNED_SHORT&&(j=r.RG16UI),W===r.UNSIGNED_INT&&(j=r.RG32UI),W===r.BYTE&&(j=r.RG8I),W===r.SHORT&&(j=r.RG16I),W===r.INT&&(j=r.RG32I)),y===r.RGB&&W===r.UNSIGNED_INT_5_9_9_9_REV&&(j=r.RGB9_E5),y===r.RGBA){const Ie=J?ml:Je.getTransfer(Y);W===r.FLOAT&&(j=r.RGBA32F),W===r.HALF_FLOAT&&(j=r.RGBA16F),W===r.UNSIGNED_BYTE&&(j=Ie===ut?r.SRGB8_ALPHA8:r.RGBA8),W===r.UNSIGNED_SHORT_4_4_4_4&&(j=r.RGBA4),W===r.UNSIGNED_SHORT_5_5_5_1&&(j=r.RGB5_A1)}return(j===r.R16F||j===r.R32F||j===r.RG16F||j===r.RG32F||j===r.RGBA16F||j===r.RGBA32F)&&e.get("EXT_color_buffer_float"),j}function _(T,y){return A(T)===!0||T.isFramebufferTexture&&T.minFilter!==Tt&&T.minFilter!==Xe?Math.log2(Math.max(y.width,y.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?y.mipmaps.length:1}function S(T){const y=T.target;y.removeEventListener("dispose",S),I(y),y.isVideoTexture&&h.delete(y)}function C(T){const y=T.target;y.removeEventListener("dispose",C),b(y)}function I(T){const y=n.get(T);if(y.__webglInit===void 0)return;const W=T.source,Y=d.get(W);if(Y){const J=Y[y.__cacheKey];J.usedTimes--,J.usedTimes===0&&w(T),Object.keys(Y).length===0&&d.delete(W)}n.remove(T)}function w(T){const y=n.get(T);r.deleteTexture(y.__webglTexture);const W=T.source,Y=d.get(W);delete Y[y.__cacheKey],o.memory.textures--}function b(T){const y=n.get(T);if(T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(y.__webglFramebuffer[Y]))for(let J=0;J<y.__webglFramebuffer[Y].length;J++)r.deleteFramebuffer(y.__webglFramebuffer[Y][J]);else r.deleteFramebuffer(y.__webglFramebuffer[Y]);y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer[Y])}else{if(Array.isArray(y.__webglFramebuffer))for(let Y=0;Y<y.__webglFramebuffer.length;Y++)r.deleteFramebuffer(y.__webglFramebuffer[Y]);else r.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let Y=0;Y<y.__webglColorRenderbuffer.length;Y++)y.__webglColorRenderbuffer[Y]&&r.deleteRenderbuffer(y.__webglColorRenderbuffer[Y]);y.__webglDepthRenderbuffer&&r.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const W=T.textures;for(let Y=0,J=W.length;Y<J;Y++){const j=n.get(W[Y]);j.__webglTexture&&(r.deleteTexture(j.__webglTexture),o.memory.textures--),n.remove(W[Y])}n.remove(T)}let v=0;function E(){v=0}function L(){const T=v;return T>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+i.maxTextures),v+=1,T}function F(T){const y=[];return y.push(T.wrapS),y.push(T.wrapT),y.push(T.wrapR||0),y.push(T.magFilter),y.push(T.minFilter),y.push(T.anisotropy),y.push(T.internalFormat),y.push(T.format),y.push(T.type),y.push(T.generateMipmaps),y.push(T.premultiplyAlpha),y.push(T.flipY),y.push(T.unpackAlignment),y.push(T.colorSpace),y.join()}function R(T,y){const W=n.get(T);if(T.isVideoTexture&&vt(T),T.isRenderTargetTexture===!1&&T.version>0&&W.__version!==T.version){const Y=T.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ue(W,T,y);return}}t.bindTexture(r.TEXTURE_2D,W.__webglTexture,r.TEXTURE0+y)}function P(T,y){const W=n.get(T);if(T.version>0&&W.__version!==T.version){ue(W,T,y);return}t.bindTexture(r.TEXTURE_2D_ARRAY,W.__webglTexture,r.TEXTURE0+y)}function N(T,y){const W=n.get(T);if(T.version>0&&W.__version!==T.version){ue(W,T,y);return}t.bindTexture(r.TEXTURE_3D,W.__webglTexture,r.TEXTURE0+y)}function G(T,y){const W=n.get(T);if(T.version>0&&W.__version!==T.version){we(W,T,y);return}t.bindTexture(r.TEXTURE_CUBE_MAP,W.__webglTexture,r.TEXTURE0+y)}const $={[Fn]:r.REPEAT,[Ct]:r.CLAMP_TO_EDGE,[vs]:r.MIRRORED_REPEAT},O={[Tt]:r.NEAREST,[No]:r.NEAREST_MIPMAP_NEAREST,[Fi]:r.NEAREST_MIPMAP_LINEAR,[Xe]:r.LINEAR,[gs]:r.LINEAR_MIPMAP_NEAREST,[on]:r.LINEAR_MIPMAP_LINEAR},X={[uE]:r.NEVER,[gE]:r.ALWAYS,[dE]:r.LESS,[fg]:r.LEQUAL,[fE]:r.EQUAL,[mE]:r.GEQUAL,[AE]:r.GREATER,[pE]:r.NOTEQUAL};function q(T,y){if(y.type===Bt&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===Xe||y.magFilter===gs||y.magFilter===Fi||y.magFilter===on||y.minFilter===Xe||y.minFilter===gs||y.minFilter===Fi||y.minFilter===on)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(T,r.TEXTURE_WRAP_S,$[y.wrapS]),r.texParameteri(T,r.TEXTURE_WRAP_T,$[y.wrapT]),(T===r.TEXTURE_3D||T===r.TEXTURE_2D_ARRAY)&&r.texParameteri(T,r.TEXTURE_WRAP_R,$[y.wrapR]),r.texParameteri(T,r.TEXTURE_MAG_FILTER,O[y.magFilter]),r.texParameteri(T,r.TEXTURE_MIN_FILTER,O[y.minFilter]),y.compareFunction&&(r.texParameteri(T,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(T,r.TEXTURE_COMPARE_FUNC,X[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===Tt||y.minFilter!==Fi&&y.minFilter!==on||y.type===Bt&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");r.texParameterf(T,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function ee(T,y){let W=!1;T.__webglInit===void 0&&(T.__webglInit=!0,y.addEventListener("dispose",S));const Y=y.source;let J=d.get(Y);J===void 0&&(J={},d.set(Y,J));const j=F(y);if(j!==T.__cacheKey){J[j]===void 0&&(J[j]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,W=!0),J[j].usedTimes++;const Ie=J[T.__cacheKey];Ie!==void 0&&(J[T.__cacheKey].usedTimes--,Ie.usedTimes===0&&w(y)),T.__cacheKey=j,T.__webglTexture=J[j].texture}return W}function ue(T,y,W){let Y=r.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(Y=r.TEXTURE_2D_ARRAY),y.isData3DTexture&&(Y=r.TEXTURE_3D);const J=ee(T,y),j=y.source;t.bindTexture(Y,T.__webglTexture,r.TEXTURE0+W);const Ie=n.get(j);if(j.version!==Ie.__version||J===!0){t.activeTexture(r.TEXTURE0+W);const Z=Je.getPrimaries(Je.workingColorSpace),ge=y.colorSpace===vn?null:Je.getPrimaries(y.colorSpace),be=y.colorSpace===vn||Z===ge?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,be);let se=g(y.image,!1,i.maxTextureSize);se=Re(y,se);const he=s.convert(y.format,y.colorSpace),Le=s.convert(y.type);let de=x(y.internalFormat,he,Le,y.colorSpace,y.isVideoTexture);q(Y,y);let fe;const We=y.mipmaps,qe=y.isVideoTexture!==!0&&de!==Qu,Ze=Ie.__version===void 0||J===!0,Ye=j.dataReady,ft=_(y,se);if(y.isDepthTexture)de=r.DEPTH_COMPONENT16,y.type===Bt?de=r.DEPTH_COMPONENT32F:y.type===ys?de=r.DEPTH_COMPONENT24:y.type===Fo&&(de=r.DEPTH24_STENCIL8),Ze&&(qe?t.texStorage2D(r.TEXTURE_2D,1,de,se.width,se.height):t.texImage2D(r.TEXTURE_2D,0,de,se.width,se.height,0,he,Le,null));else if(y.isDataTexture)if(We.length>0){qe&&Ze&&t.texStorage2D(r.TEXTURE_2D,ft,de,We[0].width,We[0].height);for(let pe=0,B=We.length;pe<B;pe++)fe=We[pe],qe?Ye&&t.texSubImage2D(r.TEXTURE_2D,pe,0,0,fe.width,fe.height,he,Le,fe.data):t.texImage2D(r.TEXTURE_2D,pe,de,fe.width,fe.height,0,he,Le,fe.data);y.generateMipmaps=!1}else qe?(Ze&&t.texStorage2D(r.TEXTURE_2D,ft,de,se.width,se.height),Ye&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,se.width,se.height,he,Le,se.data)):t.texImage2D(r.TEXTURE_2D,0,de,se.width,se.height,0,he,Le,se.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){qe&&Ze&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ft,de,We[0].width,We[0].height,se.depth);for(let pe=0,B=We.length;pe<B;pe++)fe=We[pe],y.format!==_t?he!==null?qe?Ye&&t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,pe,0,0,0,fe.width,fe.height,se.depth,he,fe.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,pe,de,fe.width,fe.height,se.depth,0,fe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?Ye&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,pe,0,0,0,fe.width,fe.height,se.depth,he,Le,fe.data):t.texImage3D(r.TEXTURE_2D_ARRAY,pe,de,fe.width,fe.height,se.depth,0,he,Le,fe.data)}else{qe&&Ze&&t.texStorage2D(r.TEXTURE_2D,ft,de,We[0].width,We[0].height);for(let pe=0,B=We.length;pe<B;pe++)fe=We[pe],y.format!==_t?he!==null?qe?Ye&&t.compressedTexSubImage2D(r.TEXTURE_2D,pe,0,0,fe.width,fe.height,he,fe.data):t.compressedTexImage2D(r.TEXTURE_2D,pe,de,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?Ye&&t.texSubImage2D(r.TEXTURE_2D,pe,0,0,fe.width,fe.height,he,Le,fe.data):t.texImage2D(r.TEXTURE_2D,pe,de,fe.width,fe.height,0,he,Le,fe.data)}else if(y.isDataArrayTexture)qe?(Ze&&t.texStorage3D(r.TEXTURE_2D_ARRAY,ft,de,se.width,se.height,se.depth),Ye&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,se.width,se.height,se.depth,he,Le,se.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,de,se.width,se.height,se.depth,0,he,Le,se.data);else if(y.isData3DTexture)qe?(Ze&&t.texStorage3D(r.TEXTURE_3D,ft,de,se.width,se.height,se.depth),Ye&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,se.width,se.height,se.depth,he,Le,se.data)):t.texImage3D(r.TEXTURE_3D,0,de,se.width,se.height,se.depth,0,he,Le,se.data);else if(y.isFramebufferTexture){if(Ze)if(qe)t.texStorage2D(r.TEXTURE_2D,ft,de,se.width,se.height);else{let pe=se.width,B=se.height;for(let ie=0;ie<ft;ie++)t.texImage2D(r.TEXTURE_2D,ie,de,pe,B,0,he,Le,null),pe>>=1,B>>=1}}else if(We.length>0){if(qe&&Ze){const pe=st(We[0]);t.texStorage2D(r.TEXTURE_2D,ft,de,pe.width,pe.height)}for(let pe=0,B=We.length;pe<B;pe++)fe=We[pe],qe?Ye&&t.texSubImage2D(r.TEXTURE_2D,pe,0,0,he,Le,fe):t.texImage2D(r.TEXTURE_2D,pe,de,he,Le,fe);y.generateMipmaps=!1}else if(qe){if(Ze){const pe=st(se);t.texStorage2D(r.TEXTURE_2D,ft,de,pe.width,pe.height)}Ye&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,he,Le,se)}else t.texImage2D(r.TEXTURE_2D,0,de,he,Le,se);A(y)&&p(Y),Ie.__version=j.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function we(T,y,W){if(y.image.length!==6)return;const Y=ee(T,y),J=y.source;t.bindTexture(r.TEXTURE_CUBE_MAP,T.__webglTexture,r.TEXTURE0+W);const j=n.get(J);if(J.version!==j.__version||Y===!0){t.activeTexture(r.TEXTURE0+W);const Ie=Je.getPrimaries(Je.workingColorSpace),Z=y.colorSpace===vn?null:Je.getPrimaries(y.colorSpace),ge=y.colorSpace===vn||Ie===Z?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ge);const be=y.isCompressedTexture||y.image[0].isCompressedTexture,se=y.image[0]&&y.image[0].isDataTexture,he=[];for(let B=0;B<6;B++)!be&&!se?he[B]=g(y.image[B],!0,i.maxCubemapSize):he[B]=se?y.image[B].image:y.image[B],he[B]=Re(y,he[B]);const Le=he[0],de=s.convert(y.format,y.colorSpace),fe=s.convert(y.type),We=x(y.internalFormat,de,fe,y.colorSpace),qe=y.isVideoTexture!==!0,Ze=j.__version===void 0||Y===!0,Ye=J.dataReady;let ft=_(y,Le);q(r.TEXTURE_CUBE_MAP,y);let pe;if(be){qe&&Ze&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ft,We,Le.width,Le.height);for(let B=0;B<6;B++){pe=he[B].mipmaps;for(let ie=0;ie<pe.length;ie++){const ne=pe[ie];y.format!==_t?de!==null?qe?Ye&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie,0,0,ne.width,ne.height,de,ne.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie,We,ne.width,ne.height,0,ne.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):qe?Ye&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie,0,0,ne.width,ne.height,de,fe,ne.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie,We,ne.width,ne.height,0,de,fe,ne.data)}}}else{if(pe=y.mipmaps,qe&&Ze){pe.length>0&&ft++;const B=st(he[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ft,We,B.width,B.height)}for(let B=0;B<6;B++)if(se){qe?Ye&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,he[B].width,he[B].height,de,fe,he[B].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,We,he[B].width,he[B].height,0,de,fe,he[B].data);for(let ie=0;ie<pe.length;ie++){const me=pe[ie].image[B].image;qe?Ye&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie+1,0,0,me.width,me.height,de,fe,me.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie+1,We,me.width,me.height,0,de,fe,me.data)}}else{qe?Ye&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,de,fe,he[B]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,We,de,fe,he[B]);for(let ie=0;ie<pe.length;ie++){const ne=pe[ie];qe?Ye&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie+1,0,0,de,fe,ne.image[B]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+B,ie+1,We,de,fe,ne.image[B])}}}A(y)&&p(r.TEXTURE_CUBE_MAP),j.__version=J.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function z(T,y,W,Y,J,j){const Ie=s.convert(W.format,W.colorSpace),Z=s.convert(W.type),ge=x(W.internalFormat,Ie,Z,W.colorSpace);if(!n.get(y).__hasExternalTextures){const se=Math.max(1,y.width>>j),he=Math.max(1,y.height>>j);J===r.TEXTURE_3D||J===r.TEXTURE_2D_ARRAY?t.texImage3D(J,j,ge,se,he,y.depth,0,Ie,Z,null):t.texImage2D(J,j,ge,se,he,0,Ie,Z,null)}t.bindFramebuffer(r.FRAMEBUFFER,T),Ee(y)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Y,J,n.get(W).__webglTexture,0,Ge(y)):(J===r.TEXTURE_2D||J>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Y,J,n.get(W).__webglTexture,j),t.bindFramebuffer(r.FRAMEBUFFER,null)}function K(T,y,W){if(r.bindRenderbuffer(r.RENDERBUFFER,T),y.depthBuffer&&!y.stencilBuffer){let Y=r.DEPTH_COMPONENT24;if(W||Ee(y)){const J=y.depthTexture;J&&J.isDepthTexture&&(J.type===Bt?Y=r.DEPTH_COMPONENT32F:J.type===ys&&(Y=r.DEPTH_COMPONENT24));const j=Ge(y);Ee(y)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,j,Y,y.width,y.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,j,Y,y.width,y.height)}else r.renderbufferStorage(r.RENDERBUFFER,Y,y.width,y.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,T)}else if(y.depthBuffer&&y.stencilBuffer){const Y=Ge(y);W&&Ee(y)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Y,r.DEPTH24_STENCIL8,y.width,y.height):Ee(y)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Y,r.DEPTH24_STENCIL8,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,y.width,y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,T)}else{const Y=y.textures;for(let J=0;J<Y.length;J++){const j=Y[J],Ie=s.convert(j.format,j.colorSpace),Z=s.convert(j.type),ge=x(j.internalFormat,Ie,Z,j.colorSpace),be=Ge(y);W&&Ee(y)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,be,ge,y.width,y.height):Ee(y)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,be,ge,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,ge,y.width,y.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function le(T,y){if(y&&y.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,T),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(y.depthTexture).__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),R(y.depthTexture,0);const Y=n.get(y.depthTexture).__webglTexture,J=Ge(y);if(y.depthTexture.format===vr)Ee(y)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Y,0,J):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Y,0);else if(y.depthTexture.format===bo)Ee(y)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Y,0,J):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Y,0);else throw new Error("Unknown depthTexture format")}function oe(T){const y=n.get(T),W=T.isWebGLCubeRenderTarget===!0;if(T.depthTexture&&!y.__autoAllocateDepthBuffer){if(W)throw new Error("target.depthTexture not supported in Cube render targets");le(y.__webglFramebuffer,T)}else if(W){y.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[Y]),y.__webglDepthbuffer[Y]=r.createRenderbuffer(),K(y.__webglDepthbuffer[Y],T,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer=r.createRenderbuffer(),K(y.__webglDepthbuffer,T,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function Be(T,y,W){const Y=n.get(T);y!==void 0&&z(Y.__webglFramebuffer,T,T.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),W!==void 0&&oe(T)}function Oe(T){const y=T.texture,W=n.get(T),Y=n.get(y);T.addEventListener("dispose",C);const J=T.textures,j=T.isWebGLCubeRenderTarget===!0,Ie=J.length>1;if(Ie||(Y.__webglTexture===void 0&&(Y.__webglTexture=r.createTexture()),Y.__version=y.version,o.memory.textures++),j){W.__webglFramebuffer=[];for(let Z=0;Z<6;Z++)if(y.mipmaps&&y.mipmaps.length>0){W.__webglFramebuffer[Z]=[];for(let ge=0;ge<y.mipmaps.length;ge++)W.__webglFramebuffer[Z][ge]=r.createFramebuffer()}else W.__webglFramebuffer[Z]=r.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){W.__webglFramebuffer=[];for(let Z=0;Z<y.mipmaps.length;Z++)W.__webglFramebuffer[Z]=r.createFramebuffer()}else W.__webglFramebuffer=r.createFramebuffer();if(Ie)for(let Z=0,ge=J.length;Z<ge;Z++){const be=n.get(J[Z]);be.__webglTexture===void 0&&(be.__webglTexture=r.createTexture(),o.memory.textures++)}if(T.samples>0&&Ee(T)===!1){W.__webglMultisampledFramebuffer=r.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let Z=0;Z<J.length;Z++){const ge=J[Z];W.__webglColorRenderbuffer[Z]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,W.__webglColorRenderbuffer[Z]);const be=s.convert(ge.format,ge.colorSpace),se=s.convert(ge.type),he=x(ge.internalFormat,be,se,ge.colorSpace,T.isXRRenderTarget===!0),Le=Ge(T);r.renderbufferStorageMultisample(r.RENDERBUFFER,Le,he,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Z,r.RENDERBUFFER,W.__webglColorRenderbuffer[Z])}r.bindRenderbuffer(r.RENDERBUFFER,null),T.depthBuffer&&(W.__webglDepthRenderbuffer=r.createRenderbuffer(),K(W.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(j){t.bindTexture(r.TEXTURE_CUBE_MAP,Y.__webglTexture),q(r.TEXTURE_CUBE_MAP,y);for(let Z=0;Z<6;Z++)if(y.mipmaps&&y.mipmaps.length>0)for(let ge=0;ge<y.mipmaps.length;ge++)z(W.__webglFramebuffer[Z][ge],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Z,ge);else z(W.__webglFramebuffer[Z],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0);A(y)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ie){for(let Z=0,ge=J.length;Z<ge;Z++){const be=J[Z],se=n.get(be);t.bindTexture(r.TEXTURE_2D,se.__webglTexture),q(r.TEXTURE_2D,be),z(W.__webglFramebuffer,T,be,r.COLOR_ATTACHMENT0+Z,r.TEXTURE_2D,0),A(be)&&p(r.TEXTURE_2D)}t.unbindTexture()}else{let Z=r.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(Z=T.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Z,Y.__webglTexture),q(Z,y),y.mipmaps&&y.mipmaps.length>0)for(let ge=0;ge<y.mipmaps.length;ge++)z(W.__webglFramebuffer[ge],T,y,r.COLOR_ATTACHMENT0,Z,ge);else z(W.__webglFramebuffer,T,y,r.COLOR_ATTACHMENT0,Z,0);A(y)&&p(Z),t.unbindTexture()}T.depthBuffer&&oe(T)}function Ve(T){const y=T.textures;for(let W=0,Y=y.length;W<Y;W++){const J=y[W];if(A(J)){const j=T.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ie=n.get(J).__webglTexture;t.bindTexture(j,Ie),p(j),t.unbindTexture()}}}function Q(T){if(T.samples>0&&Ee(T)===!1){const y=T.textures,W=T.width,Y=T.height;let J=r.COLOR_BUFFER_BIT;const j=[],Ie=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Z=n.get(T),ge=y.length>1;if(ge)for(let be=0;be<y.length;be++)t.bindFramebuffer(r.FRAMEBUFFER,Z.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+be,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Z.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+be,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Z.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Z.__webglFramebuffer);for(let be=0;be<y.length;be++){j.push(r.COLOR_ATTACHMENT0+be),T.depthBuffer&&j.push(Ie);const se=Z.__ignoreDepthValues!==void 0?Z.__ignoreDepthValues:!1;if(se===!1&&(T.depthBuffer&&(J|=r.DEPTH_BUFFER_BIT),T.stencilBuffer&&Z.__isTransmissionRenderTarget!==!0&&(J|=r.STENCIL_BUFFER_BIT)),ge&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Z.__webglColorRenderbuffer[be]),se===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[Ie]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[Ie])),ge){const he=n.get(y[be]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,he,0)}r.blitFramebuffer(0,0,W,Y,0,0,W,Y,J,r.NEAREST),l&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,j)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ge)for(let be=0;be<y.length;be++){t.bindFramebuffer(r.FRAMEBUFFER,Z.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+be,r.RENDERBUFFER,Z.__webglColorRenderbuffer[be]);const se=n.get(y[be]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Z.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+be,r.TEXTURE_2D,se,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Z.__webglMultisampledFramebuffer)}}function Ge(T){return Math.min(i.maxSamples,T.samples)}function Ee(T){const y=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function vt(T){const y=o.render.frame;h.get(T)!==y&&(h.set(T,y),T.update())}function Re(T,y){const W=T.colorSpace,Y=T.format,J=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||W!==it&&W!==vn&&(Je.getTransfer(W)===ut?(Y!==_t||J!==It)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),y}function st(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=L,this.resetTextureUnits=E,this.setTexture2D=R,this.setTexture2DArray=P,this.setTexture3D=N,this.setTextureCube=G,this.rebindTextures=Be,this.setupRenderTarget=Oe,this.updateRenderTargetMipmap=Ve,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=oe,this.setupFrameBufferTexture=z,this.useMultisampledRTT=Ee}function RI(r,e){function t(n,i=vn){let s;const o=Je.getTransfer(i);if(n===It)return r.UNSIGNED_BYTE;if(n===rg)return r.UNSIGNED_SHORT_4_4_4_4;if(n===og)return r.UNSIGNED_SHORT_5_5_5_1;if(n===eE)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===ng)return r.BYTE;if(n===ig)return r.SHORT;if(n===sg)return r.UNSIGNED_SHORT;if(n===Ou)return r.INT;if(n===ys)return r.UNSIGNED_INT;if(n===Bt)return r.FLOAT;if(n===Gt)return r.HALF_FLOAT;if(n===tE)return r.ALPHA;if(n===nE)return r.RGB;if(n===_t)return r.RGBA;if(n===iE)return r.LUMINANCE;if(n===sE)return r.LUMINANCE_ALPHA;if(n===vr)return r.DEPTH_COMPONENT;if(n===bo)return r.DEPTH_STENCIL;if(n===ps)return r.RED;if(n===ag)return r.RED_INTEGER;if(n===ur)return r.RG;if(n===lg)return r.RG_INTEGER;if(n===cg)return r.RGBA_INTEGER;if(n===Ya||n===$l||n===ql||n===Ka)if(o===ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ya)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===$l)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ql)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ka)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ya)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===$l)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ql)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ka)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===nu||n===Id||n===iu||n===Cd)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===nu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Id)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===iu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Cd)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qu)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===su||n===ru)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===su)return o===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ru)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ou||n===Md||n===wd||n===bd||n===Al||n===Td||n===Bd||n===Rd||n===Dd||n===Ld||n===Pd||n===Ud||n===Nd||n===Fd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ou)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Md)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===wd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===bd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Al)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Td)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Bd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Rd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Dd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ld)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ud)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Nd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Fd)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ja||n===Od||n===Qd)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ja)return o===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Od)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Qd)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===rE||n===kd||n===Gd||n===Hd)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ja)return s.COMPRESSED_RED_RGTC1_EXT;if(n===kd)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Gd)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Hd)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Fo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}class DI extends Ft{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Oi extends lt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LI={type:"move"};class Ec{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oi,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 Oi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D),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}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data: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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const g of e.hand.values()){const A=t.getJointPose(g,n),p=this._getHandJoint(c,g);A!==null&&(p.matrix.fromArray(A.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=A.radius),p.visible=A!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(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),l.matrixWorldNeedsUpdate=!0,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));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(LI)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Oi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const PI=` 3782void main() { 3783 3784 gl_Position = vec4( position, 1.0 ); 3785 3786}`,UI=` 3787uniform sampler2DArray depthColor; 3788uniform float depthWidth; 3789uniform float depthHeight; 3790 3791void main() { 3792 3793 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3794 3795 if ( coord.x >= 1.0 ) { 3796 3797 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3798 3799 } else { 3800 3801 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3802 3803 } 3804 3805}`;class NI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new nt,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,i=new an({vertexShader:PI,fragmentShader:UI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ot(new Yn(20,20),i)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class FI extends On{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const g=new NI,A=t.getContextAttributes();let p=null,x=null;const _=[],S=[],C=new Se;let I=null;const w=new Ft;w.layers.enable(1),w.viewport=new rt;const b=new Ft;b.layers.enable(2),b.viewport=new rt;const v=[w,b],E=new DI;E.layers.enable(1),E.layers.enable(2);let L=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let K=_[z];return K===void 0&&(K=new Ec,_[z]=K),K.getTargetRaySpace()},this.getControllerGrip=function(z){let K=_[z];return K===void 0&&(K=new Ec,_[z]=K),K.getGripSpace()},this.getHand=function(z){let K=_[z];return K===void 0&&(K=new Ec,_[z]=K),K.getHandSpace()};function R(z){const K=S.indexOf(z.inputSource);if(K===-1)return;const le=_[K];le!==void 0&&(le.update(z.inputSource,z.frame,c||o),le.dispatchEvent({type:z.type,data:z.inputSource}))}function P(){i.removeEventListener("select",R),i.removeEventListener("selectstart",R),i.removeEventListener("selectend",R),i.removeEventListener("squeeze",R),i.removeEventListener("squeezestart",R),i.removeEventListener("squeezeend",R),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",N);for(let z=0;z<_.length;z++){const K=S[z];K!==null&&(S[z]=null,_[z].disconnect(K))}L=null,F=null,g.reset(),e.setRenderTarget(p),f=null,d=null,u=null,i=null,x=null,we.stop(),n.isPresenting=!1,e.setPixelRatio(I),e.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){s=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){a=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(z){c=z},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(z){if(i=z,i!==null){if(p=e.getRenderTarget(),i.addEventListener("select",R),i.addEventListener("selectstart",R),i.addEventListener("selectend",R),i.addEventListener("squeeze",R),i.addEventListener("squeezestart",R),i.addEventListener("squeezeend",R),i.addEventListener("end",P),i.addEventListener("inputsourceschange",N),A.xrCompatible!==!0&&await t.makeXRCompatible(),I=e.getPixelRatio(),e.getSize(C),i.renderState.layers===void 0){const K={antialias:A.antialias,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,K),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),x=new In(f.framebufferWidth,f.framebufferHeight,{format:_t,type:It,colorSpace:e.outputColorSpace,stencilBuffer:A.stencil})}else{let K=null,le=null,oe=null;A.depth&&(oe=A.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=A.stencil?bo:vr,le=A.stencil?Fo:ys);const Be={colorFormat:t.RGBA8,depthFormat:oe,scaleFactor:s};u=new XRWebGLBinding(i,t),d=u.createProjectionLayer(Be),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),x=new In(d.textureWidth,d.textureHeight,{format:_t,type:It,depthTexture:new Cg(d.textureWidth,d.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:A.stencil,colorSpace:e.outputColorSpace,samples:A.antialias?4:0});const Oe=e.properties.get(x);Oe.__ignoreDepthValues=d.ignoreDepthValues}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),we.setContext(i),we.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function N(z){for(let K=0;K<z.removed.length;K++){const le=z.removed[K],oe=S.indexOf(le);oe>=0&&(S[oe]=null,_[oe].disconnect(le))}for(let K=0;K<z.added.length;K++){const le=z.added[K];let oe=S.indexOf(le);if(oe===-1){for(let Oe=0;Oe<_.length;Oe++)if(Oe>=S.length){S.push(le),oe=Oe;break}else if(S[Oe]===null){S[Oe]=le,oe=Oe;break}if(oe===-1)break}const Be=_[oe];Be&&Be.connect(le)}}const G=new D,$=new D;function O(z,K,le){G.setFromMatrixPosition(K.matrixWorld),$.setFromMatrixPosition(le.matrixWorld);const oe=G.distanceTo($),Be=K.projectionMatrix.elements,Oe=le.projectionMatrix.elements,Ve=Be[14]/(Be[10]-1),Q=Be[14]/(Be[10]+1),Ge=(Be[9]+1)/Be[5],Ee=(Be[9]-1)/Be[5],vt=(Be[8]-1)/Be[0],Re=(Oe[8]+1)/Oe[0],st=Ve*vt,T=Ve*Re,y=oe/(-vt+Re),W=y*-vt;K.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(W),z.translateZ(y),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert();const Y=Ve+y,J=Q+y,j=st-W,Ie=T+(oe-W),Z=Ge*Q/J*Y,ge=Ee*Q/J*Y;z.projectionMatrix.makePerspective(j,Ie,Z,ge,Y,J),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}function X(z,K){K===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices(K.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(i===null)return;g.texture!==null&&(z.near=g.depthNear,z.far=g.depthFar),E.near=b.near=w.near=z.near,E.far=b.far=w.far=z.far,(L!==E.near||F!==E.far)&&(i.updateRenderState({depthNear:E.near,depthFar:E.far}),L=E.near,F=E.far,w.near=L,w.far=F,b.near=L,b.far=F,w.updateProjectionMatrix(),b.updateProjectionMatrix(),z.updateProjectionMatrix());const K=z.parent,le=E.cameras;X(E,K);for(let oe=0;oe<le.length;oe++)X(le[oe],K);le.length===2?O(E,w,b):E.projectionMatrix.copy(w.projectionMatrix),q(z,E,K)};function q(z,K,le){le===null?z.matrix.copy(K.matrixWorld):(z.matrix.copy(le.matrixWorld),z.matrix.invert(),z.matrix.multiply(K.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy(K.projectionMatrix),z.projectionMatrixInverse.copy(K.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=wr*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return E},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(z){l=z,d!==null&&(d.fixedFoveation=z),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=z)},this.hasDepthSensing=function(){return g.texture!==null};let ee=null;function ue(z,K){if(h=K.getViewerPose(c||o),m=K,h!==null){const le=h.views;f!==null&&(e.setRenderTargetFramebuffer(x,f.framebuffer),e.setRenderTarget(x));let oe=!1;le.length!==E.cameras.length&&(E.cameras.length=0,oe=!0);for(let Oe=0;Oe<le.length;Oe++){const Ve=le[Oe];let Q=null;if(f!==null)Q=f.getViewport(Ve);else{const Ee=u.getViewSubImage(d,Ve);Q=Ee.viewport,Oe===0&&(e.setRenderTargetTextures(x,Ee.colorTexture,d.ignoreDepthValues?void 0:Ee.depthStencilTexture),e.setRenderTarget(x))}let Ge=v[Oe];Ge===void 0&&(Ge=new Ft,Ge.layers.enable(Oe),Ge.viewport=new rt,v[Oe]=Ge),Ge.matrix.fromArray(Ve.transform.matrix),Ge.matrix.decompose(Ge.position,Ge.quaternion,Ge.scale),Ge.projectionMatrix.fromArray(Ve.projectionMatrix),Ge.projectionMatrixInverse.copy(Ge.projectionMatrix).invert(),Ge.viewport.set(Q.x,Q.y,Q.width,Q.height),Oe===0&&(E.matrix.copy(Ge.matrix),E.matrix.decompose(E.position,E.quaternion,E.scale)),oe===!0&&E.cameras.push(Ge)}const Be=i.enabledFeatures;if(Be&&Be.includes("depth-sensing")){const Oe=u.getDepthInformation(le[0]);Oe&&Oe.isValid&&Oe.texture&&g.init(e,Oe,i.renderState)}}for(let le=0;le<_.length;le++){const oe=S[le],Be=_[le];oe!==null&&Be!==void 0&&Be.update(oe,K,c||o)}g.render(e,E),ee&&ee(z,K),K.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:K}),m=null}const we=new Ig;we.setAnimationLoop(ue),this.setAnimationLoop=function(z){ee=z},this.dispose=function(){}}}const ji=new Cn,OI=new Me;function QI(r,e){function t(A,p){A.matrixAutoUpdate===!0&&A.updateMatrix(),p.value.copy(A.matrix)}function n(A,p){p.color.getRGB(A.fogColor.value,yg(r)),p.isFog?(A.fogNear.value=p.near,A.fogFar.value=p.far):p.isFogExp2&&(A.fogDensity.value=p.density)}function i(A,p,x,_,S){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(A,p):p.isMeshToonMaterial?(s(A,p),u(A,p)):p.isMeshPhongMaterial?(s(A,p),h(A,p)):p.isMeshStandardMaterial?(s(A,p),d(A,p),p.isMeshPhysicalMaterial&&f(A,p,S)):p.isMeshMatcapMaterial?(s(A,p),m(A,p)):p.isMeshDepthMaterial?s(A,p):p.isMeshDistanceMaterial?(s(A,p),g(A,p)):p.isMeshNormalMaterial?s(A,p):p.isLineBasicMaterial?(o(A,p),p.isLineDashedMaterial&&a(A,p)):p.isPointsMaterial?l(A,p,x,_):p.isSpriteMaterial?c(A,p):p.isShadowMaterial?(A.color.value.copy(p.color),A.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(A,p){A.opacity.value=p.opacity,p.color&&A.diffuse.value.copy(p.color),p.emissive&&A.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(A.map.value=p.map,t(p.map,A.mapTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.bumpMap&&(A.bumpMap.value=p.bumpMap,t(p.bumpMap,A.bumpMapTransform),A.bumpScale.value=p.bumpScale,p.side===Ht&&(A.bumpScale.value*=-1)),p.normalMap&&(A.normalMap.value=p.normalMap,t(p.normalMap,A.normalMapTransform),A.normalScale.value.copy(p.normalScale),p.side===Ht&&A.normalScale.value.negate()),p.displacementMap&&(A.displacementMap.value=p.displacementMap,t(p.displacementMap,A.displacementMapTransform),A.displacementScale.value=p.displacementScale,A.displacementBias.value=p.displacementBias),p.emissiveMap&&(A.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,A.emissiveMapTransform)),p.specularMap&&(A.specularMap.value=p.specularMap,t(p.specularMap,A.specularMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest);const x=e.get(p),_=x.envMap,S=x.envMapRotation;if(_&&(A.envMap.value=_,ji.copy(S),ji.x*=-1,ji.y*=-1,ji.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(ji.y*=-1,ji.z*=-1),A.envMapRotation.value.setFromMatrix4(OI.makeRotationFromEuler(ji)),A.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.reflectivity.value=p.reflectivity,A.ior.value=p.ior,A.refractionRatio.value=p.refractionRatio),p.lightMap){A.lightMap.value=p.lightMap;const C=r._useLegacyLights===!0?Math.PI:1;A.lightMapIntensity.value=p.lightMapIntensity*C,t(p.lightMap,A.lightMapTransform)}p.aoMap&&(A.aoMap.value=p.aoMap,A.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,A.aoMapTransform))}function o(A,p){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,p.map&&(A.map.value=p.map,t(p.map,A.mapTransform))}function a(A,p){A.dashSize.value=p.dashSize,A.totalSize.value=p.dashSize+p.gapSize,A.scale.value=p.scale}function l(A,p,x,_){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,A.size.value=p.size*x,A.scale.value=_*.5,p.map&&(A.map.value=p.map,t(p.map,A.uvTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest)}function c(A,p){A.diffuse.value.copy(p.color),A.opacity.value=p.opacity,A.rotation.value=p.rotation,p.map&&(A.map.value=p.map,t(p.map,A.mapTransform)),p.alphaMap&&(A.alphaMap.value=p.alphaMap,t(p.alphaMap,A.alphaMapTransform)),p.alphaTest>0&&(A.alphaTest.value=p.alphaTest)}function h(A,p){A.specular.value.copy(p.specular),A.shininess.value=Math.max(p.shininess,1e-4)}function u(A,p){p.gradientMap&&(A.gradientMap.value=p.gradientMap)}function d(A,p){A.metalness.value=p.metalness,p.metalnessMap&&(A.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,A.metalnessMapTransform)),A.roughness.value=p.roughness,p.roughnessMap&&(A.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,A.roughnessMapTransform)),p.envMap&&(A.envMapIntensity.value=p.envMapIntensity)}function f(A,p,x){A.ior.value=p.ior,p.sheen>0&&(A.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),A.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(A.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,A.sheenColorMapTransform)),p.sheenRoughnessMap&&(A.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,A.sheenRoughnessMapTransform))),p.clearcoat>0&&(A.clearcoat.value=p.clearcoat,A.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(A.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,A.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(A.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ht&&A.clearcoatNormalScale.value.negate())),p.iridescence>0&&(A.iridescence.value=p.iridescence,A.iridescenceIOR.value=p.iridescenceIOR,A.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(A.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,A.iridescenceMapTransform)),p.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),p.transmission>0&&(A.transmission.value=p.transmission,A.transmissionSamplerMap.value=x.texture,A.transmissionSamplerSize.value.set(x.width,x.height),p.transmissionMap&&(A.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,A.transmissionMapTransform)),A.thickness.value=p.thickness,p.thicknessMap&&(A.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=p.attenuationDistance,A.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(A.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(A.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=p.specularIntensity,A.specularColor.value.copy(p.specularColor),p.specularColorMap&&(A.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,A.specularColorMapTransform)),p.specularIntensityMap&&(A.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,A.specularIntensityMapTransform))}function m(A,p){p.matcap&&(A.matcap.value=p.matcap)}function g(A,p){const x=e.get(p).light;A.referencePosition.value.setFromMatrixPosition(x.matrixWorld),A.nearDistance.value=x.shadow.camera.near,A.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function kI(r,e,t,n){let i={},s={},o=[];const a=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,_){const S=_.program;n.uniformBlockBinding(x,S)}function c(x,_){let S=i[x.id];S===void 0&&(m(x),S=h(x),i[x.id]=S,x.addEventListener("dispose",A));const C=_.program;n.updateUBOMapping(x,C);const I=e.render.frame;s[x.id]!==I&&(d(x),s[x.id]=I)}function h(x){const _=u();x.__bindingPointIndex=_;const S=r.createBuffer(),C=x.__size,I=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,S),r.bufferData(r.UNIFORM_BUFFER,C,I),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,_,S),S}function u(){for(let x=0;x<a;x++)if(o.indexOf(x)===-1)return o.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(x){const _=i[x.id],S=x.uniforms,C=x.__cache;r.bindBuffer(r.UNIFORM_BUFFER,_);for(let I=0,w=S.length;I<w;I++){const b=Array.isArray(S[I])?S[I]:[S[I]];for(let v=0,E=b.length;v<E;v++){const L=b[v];if(f(L,I,v,C)===!0){const F=L.__offset,R=Array.isArray(L.value)?L.value:[L.value];let P=0;for(let N=0;N<R.length;N++){const G=R[N],$=g(G);typeof G=="number"||typeof G=="boolean"?(L.__data[0]=G,r.bufferSubData(r.UNIFORM_BUFFER,F+P,L.__data)):G.isMatrix3?(L.__data[0]=G.elements[0],L.__data[1]=G.elements[1],L.__data[2]=G.elements[2],L.__data[3]=0,L.__data[4]=G.elements[3],L.__data[5]=G.elements[4],L.__data[6]=G.elements[5],L.__data[7]=0,L.__data[8]=G.elements[6],L.__data[9]=G.elements[7],L.__data[10]=G.elements[8],L.__data[11]=0):(G.toArray(L.__data,P),P+=$.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,F,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(x,_,S,C){const I=x.value,w=_+"_"+S;if(C[w]===void 0)return typeof I=="number"||typeof I=="boolean"?C[w]=I:C[w]=I.clone(),!0;{const b=C[w];if(typeof I=="number"||typeof I=="boolean"){if(b!==I)return C[w]=I,!0}else if(b.equals(I)===!1)return b.copy(I),!0}return!1}function m(x){const _=x.uniforms;let S=0;const C=16;for(let w=0,b=_.length;w<b;w++){const v=Array.isArray(_[w])?_[w]:[_[w]];for(let E=0,L=v.length;E<L;E++){const F=v[E],R=Array.isArray(F.value)?F.value:[F.value];for(let P=0,N=R.length;P<N;P++){const G=R[P],$=g(G),O=S%C;O!==0&&C-O<$.boundary&&(S+=C-O),F.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=S,S+=$.storage}}}const I=S%C;return I>0&&(S+=C-I),x.__size=S,x.__cache={},this}function g(x){const _={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(_.boundary=4,_.storage=4):x.isVector2?(_.boundary=8,_.storage=8):x.isVector3||x.isColor?(_.boundary=16,_.storage=12):x.isVector4?(_.boundary=16,_.storage=16):x.isMatrix3?(_.boundary=48,_.storage=48):x.isMatrix4?(_.boundary=64,_.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),_}function A(x){const _=x.target;_.removeEventListener("dispose",A);const S=o.indexOf(_.__bindingPointIndex);o.splice(S,1),r.deleteBuffer(i[_.id]),delete i[_.id],delete s[_.id]}function p(){for(const x in i)r.deleteBuffer(i[x]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Yu{constructor(e={}){const{canvas:t=PE(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const f=new Uint32Array(4),m=new Int32Array(4);let g=null,A=null;const p=[],x=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=gt,this._useLegacyLights=!1,this.toneMapping=_i,this.toneMappingExposure=1;const _=this;let S=!1,C=0,I=0,w=null,b=-1,v=null;const E=new rt,L=new rt;let F=null;const R=new Ce(0);let P=0,N=t.width,G=t.height,$=1,O=null,X=null;const q=new rt(0,0,N,G),ee=new rt(0,0,N,G);let ue=!1;const we=new qu;let z=!1,K=!1;const le=new Me,oe=new Se,Be=new D,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ve(){return w===null?$:1}let Q=n;function Ge(M,U){const H=t.getContext(M,U);return H!==null?H:null}try{const M={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Nu}`),t.addEventListener("webglcontextlost",ie,!1),t.addEventListener("webglcontextrestored",ne,!1),t.addEventListener("webglcontextcreationerror",me,!1),Q===null){const U="webgl2";if(Q=Ge(U,M),Q===null)throw Ge(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Ee,vt,Re,st,T,y,W,Y,J,j,Ie,Z,ge,be,se,he,Le,de,fe,We,qe,Ze,Ye,ft;function pe(){Ee=new Kx(Q),Ee.init(),vt=new zx(Q,Ee,e),Ze=new RI(Q,Ee),Re=new TI(Q),st=new Zx(Q),T=new mI,y=new BI(Q,Ee,Re,T,vt,Ze,st),W=new $x(_),Y=new Yx(_),J=new rv(Q),Ye=new Hx(Q,J),j=new Jx(Q,J,st,Ye),Ie=new tS(Q,j,J,st),fe=new eS(Q,vt,y),he=new Wx(T),Z=new pI(_,W,Y,Ee,vt,Ye,he),ge=new QI(_,T),be=new _I,se=new II(Ee),de=new Gx(_,W,Y,Re,Ie,d,l),Le=new bI(_,Ie,vt),ft=new kI(Q,st,vt,Re),We=new Vx(Q,Ee,st),qe=new jx(Q,Ee,st),st.programs=Z.programs,_.capabilities=vt,_.extensions=Ee,_.properties=T,_.renderLists=be,_.shadowMap=Le,_.state=Re,_.info=st}pe();const B=new FI(_,Q);this.xr=B,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const M=Ee.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Ee.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(M){M!==void 0&&($=M,this.setSize(N,G,!1))},this.getSize=function(M){return M.set(N,G)},this.setSize=function(M,U,H=!0){if(B.isPresenting){console.warn("THREE.WebGLRenderer: Can't
3805change size while VR device is presenting.");return}N=M,G=U,t.width=Math.floor(M*$),t.height=Math.floor(U*$),H===!0&&(t.style.width=M+"px",t.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(N*$,G*$).floor()},this.setDrawingBufferSize=function(M,U,H){N=M,G=U,$=H,t.width=Math.floor(M*H),t.height=Math.floor(U*H),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(E)},this.getViewport=function(M){return M.copy(q)},this.setViewport=function(M,U,H,V){M.isVector4?q.set(M.x,M.y,M.z,M.w):q.set(M,U,H,V),Re.viewport(E.copy(q).multiplyScalar($).round())},this.getScissor=function(M){return M.copy(ee)},this.setScissor=function(M,U,H,V){M.isVector4?ee.set(M.x,M.y,M.z,M.w):ee.set(M,U,H,V),Re.scissor(L.copy(ee).multiplyScalar($).round())},this.getScissorTest=function(){return ue},this.setScissorTest=function(M){Re.setScissorTest(ue=M)},this.setOpaqueSort=function(M){O=M},this.setTransparentSort=function(M){X=M},this.getClearColor=function(M){return M.copy(de.getClearColor())},this.setClearColor=function(){de.setClearColor.apply(de,arguments)},this.getClearAlpha=function(){return de.getClearAlpha()},this.setClearAlpha=function(){de.setClearAlpha.apply(de,arguments)},this.clear=function(M=!0,U=!0,H=!0){let V=0;if(M){let k=!1;if(w!==null){const ae=w.texture.format;k=ae===cg||ae===lg||ae===ag}if(k){const ae=w.texture.type,Ae=ae===It||ae===ys||ae===sg||ae===Fo||ae===rg||ae===og,ye=de.getClearColor(),Te=de.getClearAlpha(),Ue=ye.r,Pe=ye.g,Ne=ye.b;Ae?(f[0]=Ue,f[1]=Pe,f[2]=Ne,f[3]=Te,Q.clearBufferuiv(Q.COLOR,0,f)):(m[0]=Ue,m[1]=Pe,m[2]=Ne,m[3]=Te,Q.clearBufferiv(Q.COLOR,0,m))}else V|=Q.COLOR_BUFFER_BIT}U&&(V|=Q.DEPTH_BUFFER_BIT),H&&(V|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.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(){t.removeEventListener("webglcontextlost",ie,!1),t.removeEventListener("webglcontextrestored",ne,!1),t.removeEventListener("webglcontextcreationerror",me,!1),be.dispose(),se.dispose(),T.dispose(),W.dispose(),Y.dispose(),Ie.dispose(),Ye.dispose(),ft.dispose(),Z.dispose(),B.dispose(),B.removeEventListener("sessionstart",Qn),B.removeEventListener("sessionend",kn),Wi.stop()};function ie(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function ne(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const M=st.autoReset,U=Le.enabled,H=Le.autoUpdate,V=Le.needsUpdate,k=Le.type;pe(),st.autoReset=M,Le.enabled=U,Le.autoUpdate=H,Le.needsUpdate=V,Le.type=k}function me(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function _e(M){const U=M.target;U.removeEventListener("dispose",_e),at(U)}function at(M){At(M),T.remove(M)}function At(M){const U=T.get(M).programs;U!==void 0&&(U.forEach(function(H){Z.releaseProgram(H)}),M.isShaderMaterial&&Z.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,H,V,k,ae){U===null&&(U=Oe);const Ae=k.isMesh&&k.matrixWorld.determinant()<0,ye=f_(M,U,H,V,k);Re.setMaterial(V,Ae);let Te=H.index,Ue=1;if(V.wireframe===!0){if(Te=j.getWireframeAttribute(H),Te===void 0)return;Ue=2}const Pe=H.drawRange,Ne=H.attributes.position;let Mt=Pe.start*Ue,ln=(Pe.start+Pe.count)*Ue;ae!==null&&(Mt=Math.max(Mt,ae.start*Ue),ln=Math.min(ln,(ae.start+ae.count)*Ue)),Te!==null?(Mt=Math.max(Mt,0),ln=Math.min(ln,Te.count)):Ne!=null&&(Mt=Math.max(Mt,0),ln=Math.min(ln,Ne.count));const Lt=ln-Mt;if(Lt<0||Lt===1/0)return;Ye.setup(k,V,ye,H,Te);let jn,xt=We;if(Te!==null&&(jn=J.get(Te),xt=qe,xt.setIndex(jn)),k.isMesh)V.wireframe===!0?(Re.setLineWidth(V.wireframeLinewidth*Ve()),xt.setMode(Q.LINES)):xt.setMode(Q.TRIANGLES);else if(k.isLine){let Qe=V.linewidth;Qe===void 0&&(Qe=1),Re.setLineWidth(Qe*Ve()),k.isLineSegments?xt.setMode(Q.LINES):k.isLineLoop?xt.setMode(Q.LINE_LOOP):xt.setMode(Q.LINE_STRIP)}else k.isPoints?xt.setMode(Q.POINTS):k.isSprite&&xt.setMode(Q.TRIANGLES);if(k.isBatchedMesh)xt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else if(k.isInstancedMesh)xt.renderInstances(Mt,Lt,k.count);else if(H.isInstancedBufferGeometry){const Qe=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,Gl=Math.min(H.instanceCount,Qe);xt.renderInstances(Mt,Lt,Gl)}else xt.render(Mt,Lt)};function yt(M,U,H){M.transparent===!0&&M.side===Yt&&M.forceSinglePass===!1?(M.side=Ht,M.needsUpdate=!0,$o(M,U,H),M.side=Nn,M.needsUpdate=!0,$o(M,U,H),M.side=Yt):$o(M,U,H)}this.compile=function(M,U,H=null){H===null&&(H=M),A=se.get(H),A.init(
vendor: 96,104 bytes, line 3805
3805),x.push(A),H.traverseVisible(function(k){k.isLight&&k.layers.test(U.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),M!==H&&M.traverseVisible(function(k){k.isLight&&k.layers.test(U.layers)&&(A.pushLight(k),k.castShadow&&A.pushShadow(k))}),A.setupLights(_._useLegacyLights);const V=new Set;return M.traverse(function(k){const ae=k.material;if(ae)if(Array.isArray(ae))for(let Ae=0;Ae<ae.length;Ae++){const ye=ae[Ae];yt(ye,H,k),V.add(ye)}else yt(ae,H,k),V.add(ae)}),x.pop(),A=null,V},this.compileAsync=function(M,U,H=null){const V=this.compile(M,U,H);return new Promise(k=>{function ae(){if(V.forEach(function(Ae){T.get(Ae).currentProgram.isReady()&&V.delete(Ae)}),V.size===0){k(M);return}setTimeout(ae,10)}Ee.get("KHR_parallel_shader_compile")!==null?ae():setTimeout(ae,10)})};let Vt=null;function ct(M){Vt&&Vt(M)}function Qn(){Wi.stop()}function kn(){Wi.start()}const Wi=new Ig;Wi.setAnimationLoop(ct),typeof self<"u"&&Wi.setContext(self),this.setAnimationLoop=function(M){Vt=M,B.setAnimationLoop(M),M===null?Wi.stop():Wi.start()},B.addEventListener("sessionstart",Qn),B.addEventListener("sessionend",kn),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),B.enabled===!0&&B.isPresenting===!0&&(B.cameraAutoUpdate===!0&&B.updateCamera(U),U=B.getCamera()),M.isScene===!0&&M.onBeforeRender(_,M,U,w),A=se.get(M,x.length),A.init(),x.push(A),le.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),we.setFromProjectionMatrix(le),K=this.localClippingEnabled,z=he.init(this.clippingPlanes,K),g=be.get(M,p.length),g.init(),p.push(g),ud(M,U,0,_.sortObjects),g.finish(),_.sortObjects===!0&&g.sort(O,X),this.info.render.frame++,z===!0&&he.beginShadows();const H=A.state.shadowsArray;if(Le.render(H,M,U),z===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset(),(B.enabled===!1||B.isPresenting===!1||B.hasDepthSensing()===!1)&&de.render(g,M),A.setupLights(_._useLegacyLights),U.isArrayCamera){const V=U.cameras;for(let k=0,ae=V.length;k<ae;k++){const Ae=V[k];dd(g,M,Ae,Ae.viewport)}}else dd(g,M,U);w!==null&&(y.updateMultisampleRenderTarget(w),y.updateRenderTargetMipmap(w)),M.isScene===!0&&M.onAfterRender(_,M,U),Ye.resetDefaultState(),b=-1,v=null,x.pop(),x.length>0?A=x[x.length-1]:A=null,p.pop(),p.length>0?g=p[p.length-1]:g=null};function ud(M,U,H,V){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)H=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)A.pushLight(M),M.castShadow&&A.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||we.intersectsSprite(M)){V&&Be.setFromMatrixPosition(M.matrixWorld).applyMatrix4(le);const Ae=Ie.update(M),ye=M.material;ye.visible&&g.push(M,Ae,ye,H,Be.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||we.intersectsObject(M))){const Ae=Ie.update(M),ye=M.material;if(V&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),Be.copy(M.boundingSphere.center)):(Ae.boundingSphere===null&&Ae.computeBoundingSphere(),Be.copy(Ae.boundingSphere.center)),Be.applyMatrix4(M.matrixWorld).applyMatrix4(le)),Array.isArray(ye)){const Te=Ae.groups;for(let Ue=0,Pe=Te.length;Ue<Pe;Ue++){const Ne=Te[Ue],Mt=ye[Ne.materialIndex];Mt&&Mt.visible&&g.push(M,Ae,Mt,H,Be.z,Ne)}}else ye.visible&&g.push(M,Ae,ye,H,Be.z,null)}}const ae=M.children;for(let Ae=0,ye=ae.length;Ae<ye;Ae++)ud(ae[Ae],U,H,V)}function dd(M,U,H,V){const k=M.opaque,ae=M.transmissive,Ae=M.transparent;A.setupLightsView(H),z===!0&&he.setGlobalState(_.clippingPlanes,H),ae.length>0&&d_(k,ae,U,H),V&&Re.viewport(E.copy(V)),k.length>0&&Wo(k,U,H),ae.length>0&&Wo(ae,U,H),Ae.length>0&&Wo(Ae,U,H),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function d_(M,U,H,V){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget===null){A.state.transmissionRenderTarget=new In(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float")?Gt:It,minFilter:on,samples:4,stencilBuffer:s});const Ue=T.get(A.state.transmissionRenderTarget);Ue.__isTransmissionRenderTarget=!0}const ae=A.state.transmissionRenderTarget;_.getDrawingBufferSize(oe),ae.setSize(oe.x,oe.y);const Ae=_.getRenderTarget();_.setRenderTarget(ae),_.getClearColor(R),P=_.getClearAlpha(),P<1&&_.setClearColor(16777215,.5),_.clear();const ye=_.toneMapping;_.toneMapping=_i,Wo(M,H,V),y.updateMultisampleRenderTarget(ae),y.updateRenderTargetMipmap(ae);let Te=!1;for(let Ue=0,Pe=U.length;Ue<Pe;Ue++){const Ne=U[Ue],Mt=Ne.object,ln=Ne.geometry,Lt=Ne.material,jn=Ne.group;if(Lt.side===Yt&&Mt.layers.test(V.layers)){const xt=Lt.side;Lt.side=Ht,Lt.needsUpdate=!0,fd(Mt,H,V,ln,Lt,jn),Lt.side=xt,Lt.needsUpdate=!0,Te=!0}}Te===!0&&(y.updateMultisampleRenderTarget(ae),y.updateRenderTargetMipmap(ae)),_.setRenderTarget(Ae),_.setClearColor(R,P),_.toneMapping=ye}function Wo(M,U,H){const V=U.isScene===!0?U.overrideMaterial:null;for(let k=0,ae=M.length;k<ae;k++){const Ae=M[k],ye=Ae.object,Te=Ae.geometry,Ue=V===null?Ae.material:V,Pe=Ae.group;ye.layers.test(H.layers)&&fd(ye,U,H,Te,Ue,Pe)}}function fd(M,U,H,V,k,ae){M.onBeforeRender(_,U,H,V,k,ae),M.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),k.onBeforeRender(_,U,H,V,M,ae),k.transparent===!0&&k.side===Yt&&k.forceSinglePass===!1?(k.side=Ht,k.needsUpdate=!0,_.renderBufferDirect(H,U,V,k,M,ae),k.side=Nn,k.needsUpdate=!0,_.renderBufferDirect(H,U,V,k,M,ae),k.side=Yt):_.renderBufferDirect(H,U,V,k,M,ae),M.onAfterRender(_,U,H,V,k,ae)}function $o(M,U,H){U.isScene!==!0&&(U=Oe);const V=T.get(M),k=A.state.lights,ae=A.state.shadowsArray,Ae=k.state.version,ye=Z.getParameters(M,k.state,ae,U,H),Te=Z.getProgramCacheKey(ye);let Ue=V.programs;V.environment=M.isMeshStandardMaterial?U.environment:null,V.fog=U.fog,V.envMap=(M.isMeshStandardMaterial?Y:W).get(M.envMap||V.environment),V.envMapRotation=V.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,Ue===void 0&&(M.addEventListener("dispose",_e),Ue=new Map,V.programs=Ue);let Pe=Ue.get(Te);if(Pe!==void 0){if(V.currentProgram===Pe&&V.lightsStateVersion===Ae)return pd(M,ye),Pe}else ye.uniforms=Z.getUniforms(M),M.onBuild(H,ye,_),M.onBeforeCompile(ye,_),Pe=Z.acquireProgram(ye,Te),Ue.set(Te,Pe),V.uniforms=ye.uniforms;const Ne=V.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ne.clippingPlanes=he.uniform),pd(M,ye),V.needsLights=p_(M),V.lightsStateVersion=Ae,V.needsLights&&(Ne.ambientLightColor.value=k.state.ambient,Ne.lightProbe.value=k.state.probe,Ne.directionalLights.value=k.state.directional,Ne.directionalLightShadows.value=k.state.directionalShadow,Ne.spotLights.value=k.state.spot,Ne.spotLightShadows.value=k.state.spotShadow,Ne.rectAreaLights.value=k.state.rectArea,Ne.ltc_1.value=k.state.rectAreaLTC1,Ne.ltc_2.value=k.state.rectAreaLTC2,Ne.pointLights.value=k.state.point,Ne.pointLightShadows.value=k.state.pointShadow,Ne.hemisphereLights.value=k.state.hemi,Ne.directionalShadowMap.value=k.state.directionalShadowMap,Ne.directionalShadowMatrix.value=k.state.directionalShadowMatrix,Ne.spotShadowMap.value=k.state.spotShadowMap,Ne.spotLightMatrix.value=k.state.spotLightMatrix,Ne.spotLightMap.value=k.state.spotLightMap,Ne.pointShadowMap.value=k.state.pointShadowMap,Ne.pointShadowMatrix.value=k.state.pointShadowMatrix),V.currentProgram=Pe,V.uniformsList=null,Pe}function Ad(M){if(M.uniformsList===null){const U=M.currentProgram.getUniforms();M.uniformsList=ja.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function pd(M,U){const H=T.get(M);H.outputColorSpace=U.outputColorSpace,H.batching=U.batching,H.instancing=U.instancing,H.instancingColor=U.instancingColor,H.instancingMorph=U.instancingMorph,H.skinning=U.skinning,H.morphTargets=U.morphTargets,H.morphNormals=U.morphNormals,H.morphColors=U.morphColors,H.morphTargetsCount=U.morphTargetsCount,H.numClippingPlanes=U.numClippingPlanes,H.numIntersection=U.numClipIntersection,H.vertexAlphas=U.vertexAlphas,H.vertexTangents=U.vertexTangents,H.toneMapping=U.toneMapping}function f_(M,U,H,V,k){U.isScene!==!0&&(U=Oe),y.resetTextureUnits();const ae=U.fog,Ae=V.isMeshStandardMaterial?U.environment:null,ye=w===null?_.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:it,Te=(V.isMeshStandardMaterial?Y:W).get(V.envMap||Ae),Ue=V.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Pe=!!H.attributes.tangent&&(!!V.normalMap||V.anisotropy>0),Ne=!!H.morphAttributes.position,Mt=!!H.morphAttributes.normal,ln=!!H.morphAttributes.color;let Lt=_i;V.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Lt=_.toneMapping);const jn=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,xt=jn!==void 0?jn.length:0,Qe=T.get(V),Gl=A.state.lights;if(z===!0&&(K===!0||M!==v)){const mn=M===v&&V.id===b;he.setState(V,M,mn)}let pt=!1;V.version===Qe.__version?(Qe.needsLights&&Qe.lightsStateVersion!==Gl.state.version||Qe.outputColorSpace!==ye||k.isBatchedMesh&&Qe.batching===!1||!k.isBatchedMesh&&Qe.batching===!0||k.isInstancedMesh&&Qe.instancing===!1||!k.isInstancedMesh&&Qe.instancing===!0||k.isSkinnedMesh&&Qe.skinning===!1||!k.isSkinnedMesh&&Qe.skinning===!0||k.isInstancedMesh&&Qe.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Qe.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Qe.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Qe.instancingMorph===!1&&k.morphTexture!==null||Qe.envMap!==Te||V.fog===!0&&Qe.fog!==ae||Qe.numClippingPlanes!==void 0&&(Qe.numClippingPlanes!==he.numPlanes||Qe.numIntersection!==he.numIntersection)||Qe.vertexAlphas!==Ue||Qe.vertexTangents!==Pe||Qe.morphTargets!==Ne||Qe.morphNormals!==Mt||Qe.morphColors!==ln||Qe.toneMapping!==Lt||Qe.morphTargetsCount!==xt)&&(pt=!0):(pt=!0,Qe.__version=V.version);let $i=Qe.currentProgram;pt===!0&&($i=$o(V,U,k));let md=!1,kr=!1,Hl=!1;const zt=$i.getUniforms(),yi=Qe.uniforms;if(Re.useProgram($i.program)&&(md=!0,kr=!0,Hl=!0),V.id!==b&&(b=V.id,kr=!0),md||v!==M){zt.setValue(Q,"projectionMatrix",M.projectionMatrix),zt.setValue(Q,"viewMatrix",M.matrixWorldInverse);const mn=zt.map.cameraPosition;mn!==void 0&&mn.setValue(Q,Be.setFromMatrixPosition(M.matrixWorld)),vt.logarithmicDepthBuffer&&zt.setValue(Q,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&zt.setValue(Q,"isOrthographic",M.isOrthographicCamera===!0),v!==M&&(v=M,kr=!0,Hl=!0)}if(k.isSkinnedMesh){zt.setOptional(Q,k,"bindMatrix"),zt.setOptional(Q,k,"bindMatrixInverse");const mn=k.skeleton;mn&&(mn.boneTexture===null&&mn.computeBoneTexture(),zt.setValue(Q,"boneTexture",mn.boneTexture,y))}k.isBatchedMesh&&(zt.setOptional(Q,k,"batchingTexture"),zt.setValue(Q,"batchingTexture",k._matricesTexture,y));const Vl=H.morphAttributes;if((Vl.position!==void 0||Vl.normal!==void 0||Vl.color!==void 0)&&fe.update(k,H,$i),(kr||Qe.receiveShadow!==k.receiveShadow)&&(Qe.receiveShadow=k.receiveShadow,zt.setValue(Q,"receiveShadow",k.receiveShadow)),V.isMeshGouraudMaterial&&V.envMap!==null&&(yi.envMap.value=Te,yi.flipEnvMap.value=Te.isCubeTexture&&Te.isRenderTargetTexture===!1?-1:1),V.isMeshStandardMaterial&&V.envMap===null&&U.environment!==null&&(yi.envMapIntensity.value=U.environmentIntensity),kr&&(zt.setValue(Q,"toneMappingExposure",_.toneMappingExposure),Qe.needsLights&&A_(yi,Hl),ae&&V.fog===!0&&ge.refreshFogUniforms(yi,ae),ge.refreshMaterialUniforms(yi,V,$,G,A.state.transmissionRenderTarget),ja.upload(Q,Ad(Qe),yi,y)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(ja.upload(Q,Ad(Qe),yi,y),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&zt.setValue(Q,"center",k.center),zt.setValue(Q,"modelViewMatrix",k.modelViewMatrix),zt.setValue(Q,"normalMatrix",k.normalMatrix),zt.setValue(Q,"modelMatrix",k.matrixWorld),V.isShaderMaterial||V.isRawShaderMaterial){const mn=V.uniformsGroups;for(let zl=0,m_=mn.length;zl<m_;zl++){const gd=mn[zl];ft.update(gd,$i),ft.bind(gd,$i)}}return $i}function A_(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function p_(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(M,U,H){T.get(M.texture).__webglTexture=U,T.get(M.depthTexture).__webglTexture=H;const V=T.get(M);V.__hasExternalTextures=!0,V.__autoAllocateDepthBuffer=H===void 0,V.__autoAllocateDepthBuffer||Ee.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(M,U){const H=T.get(M);H.__webglFramebuffer=U,H.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(M,U=0,H=0){w=M,C=U,I=H;let V=!0,k=null,ae=!1,Ae=!1;if(M){const Te=T.get(M);Te.__useDefaultFramebuffer!==void 0?(Re.bindFramebuffer(Q.FRAMEBUFFER,null),V=!1):Te.__webglFramebuffer===void 0?y.setupRenderTarget(M):Te.__hasExternalTextures&&y.rebindTextures(M,T.get(M.texture).__webglTexture,T.get(M.depthTexture).__webglTexture);const Ue=M.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(Ae=!0);const Pe=T.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Pe[U])?k=Pe[U][H]:k=Pe[U],ae=!0):M.samples>0&&y.useMultisampledRTT(M)===!1?k=T.get(M).__webglMultisampledFramebuffer:Array.isArray(Pe)?k=Pe[H]:k=Pe,E.copy(M.viewport),L.copy(M.scissor),F=M.scissorTest}else E.copy(q).multiplyScalar($).floor(),L.copy(ee).multiplyScalar($).floor(),F=ue;if(Re.bindFramebuffer(Q.FRAMEBUFFER,k)&&V&&Re.drawBuffers(M,k),Re.viewport(E),Re.scissor(L),Re.setScissorTest(F),ae){const Te=T.get(M.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+U,Te.__webglTexture,H)}else if(Ae){const Te=T.get(M.texture),Ue=U||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Te.__webglTexture,H||0,Ue)}b=-1},this.readRenderTargetPixels=function(M,U,H,V,k,ae,Ae){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ye=T.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ae!==void 0&&(ye=ye[Ae]),ye){Re.bindFramebuffer(Q.FRAMEBUFFER,ye);try{const Te=M.texture,Ue=Te.format,Pe=Te.type;if(Ue!==_t&&Ze.convert(Ue)!==Q.getParameter(Q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ne=Pe===Gt&&(Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float"));if(Pe!==It&&Ze.convert(Pe)!==Q.getParameter(Q.IMPLEMENTATION_COLOR_READ_TYPE)&&Pe!==Bt&&!Ne){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-V&&H>=0&&H<=M.height-k&&Q.readPixels(U,H,V,k,Ze.convert(Ue),Ze.convert(Pe),ae)}finally{const Te=w!==null?T.get(w).__webglFramebuffer:null;Re.bindFramebuffer(Q.FRAMEBUFFER,Te)}}},this.copyFramebufferToTexture=function(M,U,H=0){const V=Math.pow(2,-H),k=Math.floor(U.image.width*V),ae=Math.floor(U.image.height*V);y.setTexture2D(U,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,H,0,0,M.x,M.y,k,ae),Re.unbindTexture()},this.copyTextureToTexture=function(M,U,H,V=0){const k=U.image.width,ae=U.image.height,Ae=Ze.convert(H.format),ye=Ze.convert(H.type);y.setTexture2D(H,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,H.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,H.unpackAlignment),U.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,V,M.x,M.y,k,ae,Ae,ye,U.image.data):U.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,V,M.x,M.y,U.mipmaps[0].width,U.mipmaps[0].height,Ae,U.mipmaps[0].data):Q.texSubImage2D(Q.TEXTURE_2D,V,M.x,M.y,Ae,ye,U.image),V===0&&H.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Re.unbindTexture()},this.copyTextureToTexture3D=function(M,U,H,V,k=0){const ae=Math.round(M.max.x-M.min.x),Ae=Math.round(M.max.y-M.min.y),ye=M.max.z-M.min.z+1,Te=Ze.convert(V.format),Ue=Ze.convert(V.type);let Pe;if(V.isData3DTexture)y.setTexture3D(V,0),Pe=Q.TEXTURE_3D;else if(V.isDataArrayTexture||V.isCompressedArrayTexture)y.setTexture2DArray(V,0),Pe=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,V.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,V.unpackAlignment);const Ne=Q.getParameter(Q.UNPACK_ROW_LENGTH),Mt=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),ln=Q.getParameter(Q.UNPACK_SKIP_PIXELS),Lt=Q.getParameter(Q.UNPACK_SKIP_ROWS),jn=Q.getParameter(Q.UNPACK_SKIP_IMAGES),xt=H.isCompressedTexture?H.mipmaps[k]:H.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xt.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,xt.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,M.min.x),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,M.min.y),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,M.min.z),H.isDataTexture||H.isData3DTexture?Q.texSubImage3D(Pe,k,U.x,U.y,U.z,ae,Ae,ye,Te,Ue,xt.data):V.isCompressedArrayTexture?Q.compressedTexSubImage3D(Pe,k,U.x,U.y,U.z,ae,Ae,ye,Te,xt.data):Q.texSubImage3D(Pe,k,U.x,U.y,U.z,ae,Ae,ye,Te,Ue,xt),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Ne),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,Mt),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,ln),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Lt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,jn),k===0&&V.generateMipmaps&&Q.generateMipmap(Pe),Re.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?y.setTextureCube(M,0):M.isData3DTexture?y.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?y.setTexture2DArray(M,0):y.setTexture2D(M,0),Re.unbindTexture()},this.resetState=function(){C=0,I=0,w=null,Re.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ll?"display-p3":"srgb",t.unpackColorSpace=Je.workingColorSpace===Oo?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Hi extends lt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Cn,this.environmentIntensity=1,this.environmentRotation=new Cn,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,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class GI{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=lu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Pn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return pg("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,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=Pn()),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=Pn()),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 D;class Ku{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Rn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tt(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=Rn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Rn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Rn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Rn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(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=tt(t,this.array),n=tt(n,this.array),i=tt(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=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(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 de-interleave 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 Et(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 Ku(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const 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}}}const Pf=new D,Uf=new rt,Nf=new rt,HI=new D,Ff=new Me,pa=new D,vc=new Mn,Of=new Me,yc=new Qo;class VI extends ot{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=xd,this.bindMatrix=new Me,this.bindMatrixInverse=new Me,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new sn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pa),this.boundingBox.expandByPoint(pa)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Mn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pa),this.boundingSphere.expandByPoint(pa)}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,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),vc.copy(this.boundingSphere),vc.applyMatrix4(i),e.ray.intersectsSphere(vc)!==!1&&(Of.copy(i).invert(),yc.copy(e.ray).applyMatrix4(Of),!(this.boundingBox!==null&&yc.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,yc)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}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 rt,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===xd?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Z_?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Uf.fromBufferAttribute(i.attributes.skinIndex,e),Nf.fromBufferAttribute(i.attributes.skinWeight,e),Pf.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Nf.getComponent(s);if(o!==0){const a=Uf.getComponent(s);Ff.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(HI.copy(Pf).applyMatrix4(Ff),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Dg extends lt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ko extends nt{constructor(e=null,t=1,n=1,i,s,o,a,l,c=Tt,h=Tt,u,d){super(null,o,a,l,c,h,i,s,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Qf=new Me,zI=new Me;class Ju{constructor(e=[],t=[]){this.uuid=Pn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,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 Me)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Me;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,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:zI;Qf.multiplyMatrices(a,t[s]),Qf.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Ju(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ko(t,e,e,_t,Bt);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,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 o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Dg),this.bones.push(o),this.boneInverses.push(new Me().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,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 o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class uu extends Et{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 $s=new Me,kf=new Me,ma=[],Gf=new sn,WI=new Me,Wr=new ot,$r=new Mn;class $I extends ot{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new uu(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,WI)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new sn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,$s),Gf.copy(e.boundingBox).applyMatrix4($s),this.boundingBox.union(Gf)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Mn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,$s),$r.copy(e.boundingSphere).applyMatrix4($s),this.boundingSphere.union($r)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Wr.geometry=this.geometry,Wr.material=this.material,Wr.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),$r.copy(this.boundingSphere),$r.applyMatrix4(n),e.ray.intersectsSphere($r)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,$s),kf.multiplyMatrices(n,$s),Wr.matrixWorld=kf,Wr.raycast(e,ma);for(let o=0,a=ma.length;o<a;o++){const l=ma[o];l.instanceId=s,l.object=this,t.push(l)}ma.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new uu(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new ko(new Float32Array(i*this.count),i,this.count,ps,Bt));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<n.length;c++)o+=n[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(n,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class Lg extends Un{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ce(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Hf=new D,Vf=new D,zf=new Me,xc=new Qo,ga=new Mn;class ju extends lt{constructor(e=new pn,t=new Lg){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=Array.isArray(e.material)?e.material.slice():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++)Hf.fromBufferAttribute(t,i-1),Vf.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Hf.distanceTo(Vf);e.setAttribute("lineDistance",new An(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,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ga.copy(n.boundingSphere),ga.applyMatrix4(i),ga.radius+=s,e.ray.intersectsSphere(ga)===!1)return;zf.copy(i).invert(),xc.copy(e.ray).applyMatrix4(zf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new D,h=new D,u=new D,d=new D,f=this.isLineSegments?2:1,m=n.index,A=n.attributes.position;if(m!==null){const p=Math.max(0,o.start),x=Math.min(m.count,o.start+o.count);for(let _=p,S=x-1;_<S;_+=f){const C=m.getX(_),I=m.getX(_+1);if(c.fromBufferAttribute(A,C),h.fromBufferAttribute(A,I),xc.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(d);b<e.near||b>e.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,o.start),x=Math.min(A.count,o.start+o.count);for(let _=p,S=x-1;_<S;_+=f){if(c.fromBufferAttribute(A,_),h.fromBufferAttribute(A,_+1),xc.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(d);I<e.near||I>e.far||t.push({distance:I,point:u.clone().applyMatrix4(this.matrixWorld),index:_,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const Wf=new D,$f=new D;class qI extends ju{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)Wf.fromBufferAttribute(t,i),$f.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Wf.distanceTo($f);e.setAttribute("lineDistance",new An(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class XI extends ju{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Pg extends Un{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ce(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 qf=new Me,du=new Qo,_a=new Mn,Ea=new D;class YI extends lt{constructor(e=new pn,t=new Pg){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=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),_a.copy(n.boundingSphere),_a.applyMatrix4(i),_a.radius+=s,e.ray.intersectsSphere(_a)===!1)return;qf.copy(i).invert(),du.copy(e.ray).applyMatrix4(qf);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let m=d,g=f;m<g;m++){const A=c.getX(m);Ea.fromBufferAttribute(u,A),Xf(Ea,A,l,i,e,t,this)}}else{const d=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let m=d,g=f;m<g;m++)Ea.fromBufferAttribute(u,m),Xf(Ea,m,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Xf(r,e,t,n,i,s,o){const a=du.distanceSqToPoint(r);if(a<t){const l=new D;du.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(a),point:l,index:e,face:null,object:o})}}class KI extends nt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Xe,this.magFilter=s!==void 0?s:Xe,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}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 _s extends nt{constructor(e,t,n,i,s,o,a,l,c,h,u,d){super(null,o,a,l,c,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class JI extends _s{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ct}}class jI extends _s{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Es),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Ug extends nt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Zu extends pn{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const h=[],u=new D,d=new D,f=[],m=[],g=[],A=[];for(let p=0;p<=n;p++){const x=[],_=p/n;let S=0;p===0&&o===0?S=.5/t:p===n&&l===Math.PI&&(S=-.5/t);for(let C=0;C<=t;C++){const I=C/t;u.x=-e*Math.cos(i+I*s)*Math.sin(o+_*a),u.y=e*Math.cos(o+_*a),u.z=e*Math.sin(i+I*s)*Math.sin(o+_*a),m.push(u.x,u.y,u.z),d.copy(u).normalize(),g.push(d.x,d.y,d.z),A.push(I+S,1-_),x.push(c++)}h.push(x)}for(let p=0;p<n;p++)for(let x=0;x<t;x++){const _=h[p][x+1],S=h[p][x],C=h[p+1][x],I=h[p+1][x+1];(p!==0||o>0)&&f.push(_,S,I),(p!==n-1||l<Math.PI)&&f.push(S,C,I)}this.setIndex(f),this.setAttribute("position",new An(m,3)),this.setAttribute("normal",new An(g,3)),this.setAttribute("uv",new An(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Bo extends Un{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ce(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 Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dg,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.envMapRotation=new Cn,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.envMapRotation.copy(e.envMapRotation),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}}class vi extends Bo{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,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 Nt(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 Ce(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 Ce(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ce(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=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 sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=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.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,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}}function va(r,e,t){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function ZI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function eC(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 Yf(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i}function Ng(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 o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}class Go{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 o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);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}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+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 o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class tC extends Go{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:dr,endingEnd:dr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case fr:s=e,a=2*t-n;break;case pl:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case fr:o=e,l=2*n-t;break;case pl:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),g=m*m,A=g*m,p=-d*A+2*d*g-d*m,x=(1+d)*A+(-1.5-2*d)*g+(-.5+d)*m+1,_=(-1-f)*A+(1.5+f)*g+.5*m,S=f*A-f*g;for(let C=0;C!==a;++C)s[C]=p*o[h+C]+x*o[c+C]+_*o[l+C]+S*o[u+C];return s}}class Fg extends Go{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==a;++d)s[d]=o[c+d]*u+o[l+d]*h;return s}}class nC extends Go{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Kn{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=va(t,this.TimeBufferType),this.values=va(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:va(e.times,Array),values:va(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new nC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Fg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new tC(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Mr:t=this.InterpolantFactoryMethodDiscrete;break;case xs:t=this.InterpolantFactoryMethodLinear;break;case Xl: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 Mr;case this.InterpolantFactoryMethodLinear:return xs;case this.InterpolantFactoryMethodSmooth:return Xl}}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,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}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 o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&ZI(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Xl,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],h=e[a+1];if(c!==h&&(a!==1||c!==e[0]))if(i)l=!0;else{const u=a*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const g=t[u+m];if(g!==t[d+m]||g!==t[f+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const u=a*n,d=o*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Kn.prototype.TimeBufferType=Float32Array;Kn.prototype.ValueBufferType=Float32Array;Kn.prototype.DefaultInterpolation=xs;class Fr extends Kn{}Fr.prototype.ValueTypeName="bool";Fr.prototype.ValueBufferType=Array;Fr.prototype.DefaultInterpolation=Mr;Fr.prototype.InterpolantFactoryMethodLinear=void 0;Fr.prototype.InterpolantFactoryMethodSmooth=void 0;class Og extends Kn{}Og.prototype.ValueTypeName="color";class Tr extends Kn{}Tr.prototype.ValueTypeName="number";class iC extends Go{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let h=c+a;c!==h;c+=4)fn.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ss extends Kn{InterpolantFactoryMethodLinear(e){return new iC(this.times,this.values,this.getValueSize(),e)}}Ss.prototype.ValueTypeName="quaternion";Ss.prototype.DefaultInterpolation=xs;Ss.prototype.InterpolantFactoryMethodSmooth=void 0;class Or extends Kn{}Or.prototype.ValueTypeName="string";Or.prototype.ValueBufferType=Array;Or.prototype.DefaultInterpolation=Mr;Or.prototype.InterpolantFactoryMethodLinear=void 0;Or.prototype.InterpolantFactoryMethodSmooth=void 0;class Br extends Kn{}Br.prototype.ValueTypeName="vector";class fu{constructor(e="",t=-1,n=[],i=Hu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Pn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(rC(n[o]).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,o=n.length;s!==o;++s)t.push(Kn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const h=eC(l);l=Yf(l,1,h),c=Yf(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Tr(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}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 a=0,l=e.length;a<l;a++){const c=e[a],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,g){if(f.length!==0){const A=[],p=[];Ng(f,A,p,m),A.length!==0&&g.push(new u(d,A,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let g=0;g<d[m].morphTargets.length;g++)f[d[m].morphTargets[g]]=-1;for(const g in f){const A=[],p=[];for(let x=0;x!==d[m].morphTargets.length;++x){const _=d[m];A.push(_.time),p.push(_.morphTarget===g?1:0)}i.push(new Tr(".morphTargetInfluence["+g+"]",A,p))}l=f.length*o}else{const f=".bones["+t[u].name+"]";n(Br,f+".position",d,"pos",i),n(Ss,f+".quaternion",d,"rot",i),n(Br,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}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 sC(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Tr;case"vector":case"vector2":case"vector3":case"vector4":return Br;case"color":return Og;case"quaternion":return Ss;case"bool":case"boolean":return Fr;case"string":return Or}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function rC(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=sC(r.type);if(r.times===void 0){const t=[],n=[];Ng(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 Qi={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 Qg{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null}}}const oC=new Qg;class Jn{constructor(e){this.manager=e!==void 0?e:oC,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}}Jn.DEFAULT_MATERIAL_NAME="__DEFAULT";const si={};class aC extends Error{constructor(e,t){super(e),this.response=t}}class Ei extends Jn{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=Qi.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(si[e]!==void 0){si[e].push({onLoad:t,onProgress:n,onError:i});return}si[e]=[],si[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).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 h=si[e],u=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),f=d?parseInt(d):0,m=f!==0;let g=0;const A=new ReadableStream({start(p){x();function x(){u.read().then(({done:_,value:S})=>{if(_)p.close();else{g+=S.byteLength;const C=new ProgressEvent("progress",{lengthComputable:m,loaded:g,total:f});for(let I=0,w=h.length;I<w;I++){const b=h[I];b.onProgress&&b.onProgress(C)}p.enqueue(S),x()}})}}});return new Response(A)}else throw new aC(`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(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{Qi.add(e,c);const h=si[e];delete si[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=si[e];if(h===void 0)throw this.manager.itemError(e),c;delete si[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.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 lC extends Jn{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,o=Qi.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=To("img");function l(){h(),Qi.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class cC extends Jn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new ko,a=new Ei(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Ct,o.wrapT=c.wrapT!==void 0?c.wrapT:Ct,o.magFilter=c.magFilter!==void 0?c.magFilter:Xe,o.minFilter=c.minFilter!==void 0?c.minFilter:Xe,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=on),c.mipmapCount===1&&(o.minFilter=Xe),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},n,i),o}}class kg extends Jn{constructor(e){super(e)}load(e,t,n,i){const s=new nt,o=new lC(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Ul extends lt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ce(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}}const Sc=new Me,Kf=new D,Jf=new D;class ed{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 Me,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qu,this._frameExtents=new Se(1,1),this._viewportCount=1,this._viewports=[new rt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Kf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Kf),Jf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Jf),t.updateMatrixWorld(),Sc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Sc)}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 hC extends ed{constructor(){super(new Ft(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=wr*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 uC extends Ul{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new hC}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 jf=new Me,qr=new D,Ic=new D;class dC extends ed{constructor(){super(new Ft(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Se(4,2),this._viewportCount=6,this._viewports=[new rt(2,1,1,1),new rt(0,1,1,1),new rt(3,1,1,1),new rt(1,1,1,1),new rt(3,0,1,1),new rt(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(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()),qr.setFromMatrixPosition(e.matrixWorld),n.position.copy(qr),Ic.copy(n.position),Ic.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ic),n.updateMatrixWorld(),i.makeTranslation(-qr.x,-qr.y,-qr.z),jf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jf)}}class Gg extends Ul{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new dC}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 fC extends ed{constructor(){super(new Ur(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Hg extends Ul{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lt.DEFAULT_UP),this.updateMatrix(),this.target=new lt,this.shadow=new fC}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class AC{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new D)}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,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[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 pC extends Ul{constructor(e=new AC,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 Mo{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 mC extends Jn{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,o=Qi.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Qi.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Qi.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Qi.add(e,l),s.manager.itemStart(e)}}class gC{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,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 o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}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,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>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]){a.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,o=i;s!==o;++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 o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){fn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;fn.multiplyQuaternionsFlat(e,o,e,t,e,n),fn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const td="\\[\\]\\.:\\/",_C=new RegExp("["+td+"]","g"),nd="[^"+td+"]",EC="[^"+td.replace("\\.","")+"]",vC=/((?:WC+[\/:])*)/.source.replace("WC",nd),yC=/(WCOD+)?/.source.replace("WCOD",EC),xC=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nd),SC=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nd),IC=new RegExp("^"+vC+yC+xC+SC+"$"),CC=["material","materials","bones","map"];class MC{constructor(e,t,n){const i=n||$e.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 $e{constructor(e,t,n){this.path=t,this.parsedPath=n||$e.parseTrackName(t),this.node=$e.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new $e.Composite(e,t,n):new $e(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_C,"")}static parseTrackName(e){const t=IC.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);CC.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 o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.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=$e.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");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 h=0;h<e.length;h++)if(e[h].name===c){c=h;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 o=e[i];if(o===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 a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=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=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}$e.Composite=MC;$e.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};$e.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};$e.prototype.GetterByBindingType=[$e.prototype._getValue_direct,$e.prototype._getValue_array,$e.prototype._getValue_arrayElement,$e.prototype._getValue_toArray];$e.prototype.SetterByBindingTypeAndVersioning=[[$e.prototype._setValue_direct,$e.prototype._setValue_direct_setNeedsUpdate,$e.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[$e.prototype._setValue_array,$e.prototype._setValue_array_setNeedsUpdate,$e.prototype._setValue_array_setMatrixWorldNeedsUpdate],[$e.prototype._setValue_arrayElement,$e.prototype._setValue_arrayElement_setNeedsUpdate,$e.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[$e.prototype._setValue_fromArray,$e.prototype._setValue_fromArray_setNeedsUpdate,$e.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class wC{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:dr,endingEnd:dr};for(let c=0;c!==o;++c){const h=s[c].createInterpolant(null);a[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ku,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,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,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,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[1]=t/o,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 o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case oE:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(a);break;case Hu:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(i,a)}}}_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 o=n===Gu;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===hg){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,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);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,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=fr,i.endingEnd=fr):(e?i.endingStart=this.zeroSlopeAtStart?fr:dr:i.endingStart=pl,t?i.endingEnd=this.zeroSlopeAtEnd?fr:dr:i.endingEnd=pl)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}const bC=new Float32Array(1);class TC extends On{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,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,o[u]=m;else{if(m=o[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const g=t&&t._propertyBindings[u].binding.parsedPath;m=new gC($e.create(n,f,g),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),o[u]=m}a[u].resultBuffer=m.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 o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.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,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const u=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],l.length===0&&delete o[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 o=i[t];o===void 0&&(o={},i[t]=o),o[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,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[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 Fg(new Float32Array(2),new Float32Array(2),1,bC),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 o=typeof e=="string"?fu.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Hu),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const h=new wC(this,o,t,n);return this._bindAction(h,c),this._addInactiveAction(h,a,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?fu.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.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),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);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 o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class id{constructor(e){this.value=e}clone(){return new id(this.value.clone===void 0?this.value:this.value.clone())}}const Zf=new Me;class BC{constructor(e,t,n=0,i=1/0){this.ray=new Qo(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Wu,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:
3805Unsupported camera type: "+t.type)}setFromXRController(e){return Zf.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Zf),this}intersectObject(e,t=!0,n=[]){return Au(e,this,n,t),n.sort(eA),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Au(e[i],this,n,t);return n.sort(eA),n}}function eA(r,e){return r.distance-e.distance}function Au(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,o=i.length;s<o;s++)Au(i[s],e,t,!0)}}class Za{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(Nt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Nu}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Nu);/** 3806 * @license 3807 * Copyright 2019 Google LLC 3808 * SPDX-License-Identifier: BSD-3-Clause 3809 */const el=window,sd=el.ShadowRoot&&(el.ShadyCSS===void 0||el.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vg=Symbol(),tA=new WeakMap;class RC{constructor(e,t,n){if(this._$cssResult$=!0,n!==Vg)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(sd&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=tA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&tA.set(t,e))}return e}toString(){return this.cssText}}const DC=r=>new RC(typeof r=="string"?r:r+"",void 0,Vg),LC=(r,e)=>{sd?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const n=document.createElement("style"),i=el.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},nA=sd?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return DC(t)})(r):r;/** 3810 * @license 3811 * Copyright 2017 Google LLC 3812 * SPDX-License-Identifier: BSD-3-Clause 3813 */var Cc;const yl=window,iA=yl.trustedTypes,PC=iA?iA.emptyScript:"",sA=yl.reactiveElementPolyfillSupport,pu={toAttribute(r,e){switch(e){case Boolean:r=r?PC:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},zg=(r,e)=>e!==r&&(e==e||r==r),Mc={attribute:!0,type:String,converter:pu,reflect:!1,hasChanged:zg},mu="finalized";class Xr extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,n)=>{const i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=Mc){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Mc}static finalize(){if(this.hasOwnProperty(mu))return!1;this[mu]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(nA(i))}else e!==void 0&&t.push(nA(e));return t}static _$Ep(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}
vendor: 5,719 bytes, lines 3813-3819
3813removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return LC(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Mc){var i;const s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){const o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:pu).toAttribute(t,n.type);this._$El=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,s=i._$Ev.get(e);if(s!==void 0&&this._$El!==s){const o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:pu;this._$El=s,this[s]=a.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||zg)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,s)=>this[s]=i),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdate)===null||s===void 0?void 0:s.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Xr[mu]=!0,Xr.elementProperties=new Map,Xr.elementStyles=[],Xr.shadowRootOptions={mode:"open"},sA?.({ReactiveElement:Xr}),((Cc=yl.reactiveElementVersions)!==null&&Cc!==void 0?Cc:yl.reactiveElementVersions=[]).push("1.6.3");/** 3814 * @license 3815 * Copyright 2017 Google LLC 3816 * SPDX-License-Identifier: BSD-3-Clause 3817 */var wc;const xl=window,Rr=xl.trustedTypes,rA=Rr?Rr.createPolicy("lit-html",{createHTML:r=>r}):void 0,gu="$lit$",Pi=`lit$${(Math.random()+"").slice(9)}$`,Wg="?"+Pi,UC=`<${Wg}>`,Is=document,Ro=()=>Is.createComment(""),Do=r=>r===null||typeof r!="object"&&typeof r!="function",$g=Array.isArray,NC=r=>$g(r)||typeof r?.[Symbol.iterator]=="function",bc=`[ 3818\f\r]`,Yr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oA=/-->/g,aA=/>/g,Zi=RegExp(`>|${bc}(?:([^\\s"'>=/]+)(${bc}*=${bc}*(?:[^ 3819\f\r"'\`<>=]|("|')|))|$)`,"g"),lA=/'/g,cA=/"/g,qg=/^(?:script|style|textarea|title)$/i,FC=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Nl=FC(1),Dr=Symbol.for("lit-noChange"),Ot=Symbol.for("lit-nothing"),hA=new WeakMap,ms=Is.createTreeWalker(Is,129,null,!1);function Xg(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return rA!==void 0?rA.createHTML(e):e}const OC=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=Yr;for(let a=0;a<t;a++){const l=r[a];let c,h,u=-1,d=0;for(;d<l.length&&(o.lastIndex=d,h=o.exec(l),h!==null);)d=o.lastIndex,o===Yr?h[1]==="!--"?o=oA:h[1]!==void 0?o=aA:h[2]!==void 0?(qg.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Zi):h[3]!==void 0&&(o=Zi):o===Zi?h[0]===">"?(o=i??Yr,u=-1):h[1]===void 0?u=-2:(u=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?Zi:h[3]==='"'?cA:lA):o===cA||o===lA?o=Zi:o===oA||o===aA?o=Yr:(o=Zi,i=void 0);const f=o===Zi&&r[a+1].startsWith("/>")?" ":"";s+=o===Yr?l+UC:u>=0?(n.push(c),l.slice(0,u)+gu+l.slice(u)+Pi+f):l+Pi+(u===-2?(n.push(void 0),a):f)}return[Xg(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Lo{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[c,h]=OC(e,t);if(this.el=Lo.createElement(c,n),ms.currentNode=this.el.content,t===2){const u=this.el.content,d=u.firstChild;d.remove(),u.append(...d.childNodes)}for(;(i=ms.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes()){const u=[];for(const d of i.getAttributeNames())if(d.endsWith(gu)||d.startsWith(Pi)){const f=h[o++];if(u.push(d),f!==void 0){const m=i.getAttribute(f.toLowerCase()+gu).split(Pi),g=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?kC:g[1]==="?"?HC:g[1]==="@"?VC:Fl})}else l.push({type:6,index:s})}for(const d of u)i.removeAttribute(d)}if(qg.test(i.tagName)){const u=i.textContent.split(Pi),d=u.length-1;if(d>0){i.textContent=Rr?Rr.emptyScript:"";for(let f=0;f<d;f++)i.append(u[f],Ro()),ms.nextNode(),l.push({type:2,index:++s}
vendor: 5,875 bytes, lines 3819-3823
3819);i.append(u[d],Ro())}}}else if(i.nodeType===8)if(i.data===Wg)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Pi,u+1))!==-1;)l.push({type:7,index:s}),u+=Pi.length-1}s++}}static createElement(e,t){const n=Is.createElement("template");return n.innerHTML=e,n}}function Lr(r,e,t=r,n){var i,s,o,a;if(e===Dr)return e;let l=n!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[n]:t._$Cl;const c=Do(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),c===void 0?l=void 0:(l=new c(r),l._$AT(r,t,n)),n!==void 0?((o=(a=t)._$Co)!==null&&o!==void 0?o:a._$Co=[])[n]=l:t._$Cl=l),l!==void 0&&(e=Lr(r,l._$AS(r,e.values),l,n)),e}class QC{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:n},parts:i}=this._$AD,s=((t=e?.creationScope)!==null&&t!==void 0?t:Is).importNode(n,!0);ms.currentNode=s;let o=ms.nextNode(),a=0,l=0,c=i[0];for(;c!==void 0;){if(a===c.index){let h;c.type===2?h=new Ho(o,o.nextSibling,this,e):c.type===1?h=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(h=new zC(o,this,e)),this._$AV.push(h),c=i[++l]}a!==c?.index&&(o=ms.nextNode(),a++)}return ms.currentNode=Is,s}v(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Ho{constructor(e,t,n,i){var s;this.type=2,this._$AH=Ot,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cp=(s=i?.isConnected)===null||s===void 0||s}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Lr(this,e,t),Do(e)?e===Ot||e==null||e===""?(this._$AH!==Ot&&this._$AR(),this._$AH=Ot):e!==this._$AH&&e!==Dr&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):NC(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Ot&&Do(this._$AH)?this._$AA.nextSibling.data=e:this.$(Is.createTextNode(e)),this._$AH=e}g(e){var t;const{values:n,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Lo.createElement(Xg(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===s)this._$AH.v(n);else{const o=new QC(s,this),a=o.u(this.options);o.v(n),this.$(a),this._$AH=o}}_$AC(e){let t=hA.get(e.strings);return t===void 0&&hA.set(e.strings,t=new Lo(e)),t}T(e){$g(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new Ho(this.k(Ro()),this.k(Ro()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class Fl{constructor(e,t,n,i,s){this.type=1,this._$AH=Ot,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ot}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Lr(this,e,t,0),o=!Do(e)||e!==this._$AH&&e!==Dr,o&&(this._$AH=e);else{const a=e;let l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Lr(this,a[n+l],t,l),c===Dr&&(c=this._$AH[l]),o||(o=!Do(c)||c!==this._$AH[l]),c===Ot?e=Ot:e!==Ot&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===Ot?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class kC extends Fl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ot?void 0:e}}const GC=Rr?Rr.emptyScript:"";class HC extends Fl{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ot?this.element.setAttribute(this.name,GC):this.element.removeAttribute(this.name)}}class VC extends Fl{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){var n;if((e=(n=Lr(this,e,t,0))!==null&&n!==void 0?n:Ot)===Dr)return;const i=this._$AH,s=e===Ot&&i!==Ot||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Ot&&(i===Ot||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class zC{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Lr(this,e)}}const uA=xl.litHtmlPolyfillSupport;uA?.(Lo,Ho),((wc=xl.litHtmlVersions)!==null&&wc!==void 0?wc:xl.litHtmlVersions=[]).push("2.8.0");const Yg=(r,e,t)=>{var n,i;const s=(n=t?.renderBefore)!==null&&n!==void 0?n:e;let o=s._$litPart$;if(o===void 0){const a=(i=t?.renderBefore)!==null&&i!==void 0?i:null;s._$litPart$=o=new Ho(e.insertBefore(Ro(),a),a,void 0,t??{})}return o._$AI(r),o};/** 3820 * @license 3821 * Copyright 2019 Google LLC 3822 * SPDX-License-Identifier: BSD-3-Clause 3823 */const tl=window,rd=tl.ShadowRoot&&(tl.ShadyCSS===void 0||tl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Kg=Symbol(),dA=new WeakMap;class WC{constructor(e,t,n){if(this._$cssResult$=!0,n!==Kg)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(rd&&e===void 0){const n=t!==void 0&&t.length===1;
vendor: 3,193 bytes, lines 3823-3827
3823n&&(e=dA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&dA.set(t,e))}return e}toString(){return this.cssText}}const $C=r=>new WC(typeof r=="string"?r:r+"",void 0,Kg),qC=(r,e)=>{rd?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const n=document.createElement("style"),i=tl.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},fA=rd?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return $C(t)})(r):r;/** 3824 * @license 3825 * Copyright 2017 Google LLC 3826 * SPDX-License-Identifier: BSD-3-Clause 3827 */var Tc;const Sl=window,AA=Sl.trustedTypes,XC=AA?AA.emptyScript:"",pA=Sl.reactiveElementPolyfillSupport,_u={toAttribute(r,e){switch(e){case Boolean:r=r?XC:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Jg=(r,e)=>e!==r&&(e==e||r==r),Bc={attribute:!0,type:String,converter:_u,reflect:!1,hasChanged:Jg},Eu="finalized";class As extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,n)=>{const i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=Bc){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Bc}static finalize(){if(this.hasOwnProperty(Eu))return!1;this[Eu]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(fA(i))}else e!==void 0&&t.push(fA(e));return t}static _$Ep(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}
vendor: 4,319 bytes, lines 3827-3833
3827removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return qC(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Bc){var i;const s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){const o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:_u).toAttribute(t,n.type);this._$El=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,s=i._$Ev.get(e);if(s!==void 0&&this._$El!==s){const o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:_u;this._$El=s,this[s]=a.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Jg)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,s)=>this[s]=i),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdate)===null||s===void 0?void 0:s.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}As[Eu]=!0,As.elementProperties=new Map,As.elementStyles=[],As.shadowRootOptions={mode:"open"},pA?.({ReactiveElement:As}),((Tc=Sl.reactiveElementVersions)!==null&&Tc!==void 0?Tc:Sl.reactiveElementVersions=[]).push("1.6.3");/** 3828 * @license 3829 * Copyright 2017 Google LLC 3830 * SPDX-License-Identifier: BSD-3-Clause 3831 */var Rc,Dc;class nl extends As{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Yg(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Dr}}nl.finalized=!0,nl._$litElement$=!0,(Rc=globalThis.litElementHydrateSupport)===null||Rc===void 0||Rc.call(globalThis,{LitElement:nl});const mA=globalThis.litElementPolyfillSupport;mA?.({LitElement:nl});((Dc=globalThis.litElementVersions)!==null&&Dc!==void 0?Dc:globalThis.litElementVersions=[]).push("3.3.3");/* @license 3832 * Copyright 2019 Google LLC. All Rights Reserved. 3833 * Licensed under the Apache License, Version 2.0 (the 'License');
3834 * you may not use this file except in compliance with the License. 3835 * You may obtain a copy of the License at 3836 * 3837 * http://www.apache.org/licenses/LICENSE-2.0 3838 * 3839 * Unless required by applicable law or agreed to in writing, software 3840 * distributed under the License is distributed on an 'AS IS' BASIS, 3841 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3842 * See the License for the specific language governing permissions and 3843 * limitations under the License. 3844 */const jg=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null,Zg=jg&&self.XRSession.prototype.requestHitTestSource!=null,Lc=self.ResizeObserver!=null,Pc=self.IntersectionObserver!=null,e0=Zg;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const YC=/android/i.test(navigator.userAgent),KC=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,JC=/firefox/i.test(navigator.userAgent),jC=/OculusBrowser/.test(navigator.userAgent),ZC=YC&&!JC&&!jC,eM=!!(window.webkit&&window.webkit.messageHandlers),gA=(()=>{if(KC){if(eM)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();/* @license 3845 * Copyright 2019 Google LLC. All Rights Reserved. 3846 * Licensed under the Apache License, Version 2.0 (the 'License'); 3847 * you may not use this file except in compliance with the License. 3848 * You may obtain a copy of the License at 3849 * 3850 * http://www.apache.org/licenses/LICENSE-2.0 3851 * 3852 * Unless required by applicable law or agreed to in writing, software 3853 * distributed under the License is distributed on an 'AS IS' BASIS, 3854 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3855 * See the License for the specific language governing permissions and 3856 * limitations under the License. 3857 */const t0=r=>r&&r!=="null"?tM(r):null,_A=()=>{if(e0)return;const r=[];throw jg||r.push("WebXR Device API"),Zg||r.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${r.join(", ")}`)},tM=r=>new URL(r,window.location.toString()).toString(),nM=(r,e)=>{let t=null;const n=(...i)=>{t==null&&(r(...i),t=self.setTimeout(()=>t=null,e))};return n.flush=()=>{t!=null&&(self.clearTimeout(t),t=null)},n},EA=(r,e)=>{let t=null;return(...n)=>{t!=null&&self.clearTimeout(t),t=self.setTimeout(()=>{t=null,r(...n)},e)}},zn=(r,e,t)=>Math.max(e,Math.min(t,r)),iM=1,vu=(()=>{const r=(()=>{var e;if(!((e=document.documentElement.getAttribute("itemtype"))===null||e===void 0)&&e.includes("schema.org/SearchResultsPage")||window.self!==window.top)return!0;const t=document.head!=null?Array.from(document.head.querySelectorAll("meta")):[];for(const n of t)if(n.name==="viewport")return!0;return!1})();return r||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>r?window.devicePixelRatio:iM})(),vA=(()=>{const r="model-viewer-debug-mode",e=new RegExp(`[?&]${r}(&|$)`);return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),sM=(r=0)=>new Promise(e=>setTimeout(e,r)),rM=(r,e,t=null)=>new Promise(n=>{function i(s){(!t||t(s))&&(n(s),r.removeEventListener(e,i))}r.addEventListener(e,i)});/* @license 3858 * Copyright 2019 Google LLC. All Rights Reserved. 3859 * Licensed under the Apache License, Version 2.0 (the 'License');
3860 * you may not use this file except in compliance with the License. 3861 * You may obtain a copy of the License at 3862 * 3863 * http://www.apache.org/licenses/LICENSE-2.0 3864 * 3865 * Unless required by applicable law or agreed to in writing, software 3866 * distributed under the License is distributed on an 'AS IS' BASIS, 3867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3868 * See the License for the specific language governing permissions and 3869 * limitations under the License. 3870 */var es=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const oM=.5,aM=0,lM=1,cM=1,go=Symbol("currentEnvironmentMap"),_o=Symbol("currentBackground"),Il=Symbol("updateEnvironment"),ya=Symbol("cancelEnvironmentUpdate"),hM=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=aM,this.shadowSoftness=lM,this.exposure=cM,this.toneMapping="auto",this.skyboxHeight="0",this[e]=null,this[t]=null,this[n]=null}updated(o){super.updated(o),o.has("shadowIntensity")&&(this[te].setShadowIntensity(this.shadowIntensity*oM),this[Kt]()),o.has("shadowSoftness")&&(this[te].setShadowSoftness(this.shadowSoftness),this[Kt]()),o.has("exposure")&&(this[te].exposure=this.exposure,this[Kt]()),o.has("toneMapping")&&(this[te].toneMapping=this.toneMapping==="commerce"||this.toneMapping==="neutral"?Fu:this.toneMapping==="agx"?tg:Rl,this[Kt]()),(o.has("environmentImage")||o.has("skyboxImage"))&&this[Pr]()&&this[Il](),o.has("skyboxHeight")&&(this[te].setGroundedSkybox(),this[Kt]())}hasBakedShadow(){return this[te].bakedShadows.size>0}async[(e=go,t=_o,n=ya,Il)](){const{skyboxImage:o,environmentImage:a}=this;this[ya]!=null&&(this[ya](),this[ya]=null);const{textureUtils:l}=this[je];if(l==null)return;const c=this[Cs].beginActivity("environment-update");try{const{environmentMap:h,skybox:u}=await l.generateEnvironmentMapAndSkybox(t0(o),a,d=>c(zn(d,0,1)));this[go]!==h&&(this[go]=h,this.dispatchEvent(new CustomEvent("environment-change"))),u!=null?this[_o]=u.name===h.name?h:u:this[_o]=null,this[te].setEnvironmentAndSkybox(this[go],this[_o])}catch(h){if(h instanceof Error)throw this[te].setEnvironmentAndSkybox(null,null),h}finally{c(1)}}}return es([ve({type:String,attribute:"environment-image"})],i.prototype,"environmentImage",void 0),es([ve({type:String,attribute:"skybox-image"})],i.prototype,"skyboxImage",void 0),es([ve({type:Number,attribute:"shadow-intensity"})],i.prototype,"shadowIntensity",void 0),es([ve({type:Number,attribute:"shadow-softness"})],i.prototype,"shadowSoftness",void 0),es([ve({type:Number})],i.prototype,"exposure",void 0),es([ve({type:String,attribute:"tone-mapping"})],i.prototype,"toneMapping",void 0),es([ve({type:String,attribute:"skybox-height"})],i.prototype,"skyboxHeight",void 0),i};/* @license 3871 * Copyright 2019 Google LLC. All Rights Reserved. 3872 * Licensed under the Apache License, Version 2.0 (the 'License'); 3873 * you may not use this file except in compliance with the License. 3874 * You may obtain a copy of the License at 3875 * 3876 * http://www.apache.org/licenses/LICENSE-2.0 3877 * 3878 * Unless required by applicable law or agreed to in writing, software 3879 * distributed under the License is distributed on an 'AS IS' BASIS, 3880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3881 * See the License for the specific language governing permissions and 3882 * limitations under the License. 3883 */var uM=Nl` 3884<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000"> 3885 <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement 3886 support for dynamic re-coloring of UI components --> 3887 <defs> 3888 <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%"> 3889 <feGaussianBlur in="SourceAlpha" stdDeviation="1"/> 3890 <feOffset dx="0" dy="0" result="offsetblur"/> 3891 <feFlood flood-color="#000000"/> 3892 <feComposite in2="offsetblur" operator="in"/> 3893 <feMerge> 3894 <feMergeNode/> 3895 <feMergeNode in="SourceGraphic"/> 3896 </feMerge> 3897 </filter> 3898 </defs>
3899 <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/> 3900 <path d="M0 0h24v24H0z" fill="none"/> 3901</svg>`;/* @license 3902 * Copyright 2019 Google LLC. All Rights Reserved. 3903 * Licensed under the Apache License, Version 2.0 (the 'License'); 3904 * you may not use this file except in compliance with the License. 3905 * You may obtain a copy of the License at 3906 * 3907 * http://www.apache.org/licenses/LICENSE-2.0 3908 * 3909 * Unless required by applicable law or agreed to in writing, software 3910 * distributed under the License is distributed on an 'AS IS' BASIS, 3911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3912 * See the License for the specific language governing permissions and 3913 * limitations under the License. 3914 */var dM=Nl` 3915<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36"> 3916 <defs> 3917 <path id="A" d="M.001.232h24.997V36H.001z" /> 3918 </defs> 3919 <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd"> 3920 <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" /> 3921 <g transform="translate(11 3)"> 3922 <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" /> 3923 <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" /> 3924 <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" /> 3925 <g transform="translate(0 .769)"> 3926 <mask id="B" fill="#fff"> 3927 <use xlink:href="#A" /> 3928 </mask> 3929 <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.71
39295-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" /> 3930 </g> 3931 </g> 3932 </g> 3933</svg>`;/* @license 3934 * Copyright 2019 Google LLC. All Rights Reserved. 3935 * Licensed under the Apache License, Version 2.0 (the 'License'); 3936 * you may not use this file except in compliance with the License. 3937 * You may obtain a copy of the License at 3938 * 3939 * http://www.apache.org/licenses/LICENSE-2.0 3940 * 3941 * Unless required by applicable law or agreed to in writing, software 3942 * distributed under the License is distributed on an 'AS IS' BASIS, 3943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3944 * See the License for the specific language governing permissions and 3945 * limitations under the License. 3946 */var fM=Nl` 3947<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon" 3948 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 3949 viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> 3950<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/> 3951<g id="Art_layer"> 3952 <path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/> 3953 <path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/> 3954 <path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/> 3955 <path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/> 3956 <g> 3957 <path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3 3958 l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62 3959 l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/> 3960 </g> 3961</g> 3962</svg>`;/* @license 3963 * Copyright 2019 Google LLC. All Rights Reserved. 3964 * Licensed under the Apache License, Version 2.0 (the 'License'); 3965 * you may not use this file except in compliance with the License. 3966 * You may obtain a copy of the License at 3967 * 3968 * http://www.apache.org/licenses/LICENSE-2.0 3969 * 3970 * Unless required by applicable law or agreed to in writing, software 3971 * distributed under the License is distributed on an 'AS IS' BASIS, 3972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3973 * See the License for the specific language governing permissions and 3974 * limitations under the License. 3975 */const AM=Nl` 3976<style> 3977:host { 3978 display: block; 3979 position: relative; 3980 contain: strict; 3981 width: 300px; 3982 height: 150px; 3983} 3984 3985.container { 3986 position: relative; 3987 overflow: hidden; 3988} 3989 3990.userInput { 3991 width: 100%; 3992 height: 100%; 3993 display: none; 3994 position: relative; 3995 outline-offset: -1px; 3996 outline-width: 1px; 3997} 3998 3999canvas { 4000 position: absolute; 4001 display: none; 4002 pointer-events: none; 4003 /* NOTE(cdata): Chrome 76 and below apparently have a bug 4004 * that causes our canvas not to display pixels unless it is 4005 * on its own render layer 4006 * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893 4007 */ 4008 transform: translateZ(0); 4009} 4010 4011.show { 4012 display: block; 4013} 4014 4015/* Adapted from HTML5 Boilerplate 4016 * 4017 * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */ 4018.screen-reader-only { 4019 border: 0; 4020 left: 0; 4021 top: 0; 4022 clip: rect(0, 0, 0, 0); 4023 height: 1px; 4024 margin: -1px; 4025 overflow: hidden; 4026 padding: 0; 4027 position: absolute; 4028 white-space: nowrap; 4029 width: 1px; 4030 pointer-events: none; 4031} 4032 4033.slot { 4034 position: absolute; 4035 pointer-events: none; 4036 top: 0; 4037 left: 0; 4038 width: 100%; 4039 height: 100%; 4040} 4041 4042.slot > * { 4043 pointer-events: initial; 4044} 4045 4046.annotation-wrapper ::slotted(*) { 4047 opacity: var(--max-hotspot-opacity, 1); 4048 transition: opacity 0.3s; 4049} 4050 4051.pointer-tumbling .annotation-wrapper ::slotted(*) { 4052 pointer-events: none; 4053} 4054 4055.annotation-wrapper ::slotted(*) { 4056 pointer-events: initial; 4057} 4058 4059.annotation-wrapper.hide ::slotted(*) { 4060 opacity: var(--min-hotspot-opacity, 0.25); 4061} 4062 4063.slot.poster { 4064 display: none; 4065 background-color: inherit; 4066} 4067 4068.slot.poster.show { 4069 display: inherit; 4070} 4071 4072.slot.poster > * { 4073 pointer-events: initial; 4074} 4075 4076.slot.poster:not(.show) > * { 4077 pointer-events: none; 4078} 4079 4080#default-poster { 4081 width: 100%; 4082 height: 100%; 4083 /* The default poster is a <button> so we need to set display 4084 * to prevent it from being affected by text-align: */ 4085 display: block; 4086 position: absolute; 4087 border: none; 4088 padding: 0; 4089 background-size: contain; 4090 background-repeat: no-repeat; 4091 background-position: center; 4092 background-color: #fff0; 4093} 4094 4095#default-progress-bar { 4096 display: block; 4097 position: relative; 4098 width: 100%; 4099 height: 100%; 4100 pointer-events: none; 4101 overflow: hidden; 4102} 4103 4104#default-progress-bar > .bar { 4105 position: absolute; 4106 top: 0; 4107 left: 0; 4108 width: 100%; 4109 height: var(--progress-bar-height, 5px); 4110 background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4)); 4111 transition: transform 0.09s; 4112 transform-origin: top left; 4113 transform: scaleX(0); 4114 overflow: hidden; 4115} 4116 4117#default-progress-bar > .bar.hide { 4118 transition: opacity 0.3s 1s; 4119 opacity: 0; 4120} 4121 4122.centered { 4123 align-items: center; 4124 justify-content: center; 4125} 4126 4127.cover { 4128 position: absolute; 4129 top: 0; 4130 left: 0; 4131 width: 100%; 4132 height: 100%; 4133 pointer-events: none; 4134} 4135 4136.slot.interaction-prompt { 4137 display: var(--interaction-prompt-display, flex); 4138 overflow: hidden; 4139 opacity: 0; 4140 will-change: opacity; 4141 transition: opacity 0.3s; 4142} 4143 4144.slot.interaction-prompt.visible { 4145 opacity: 1; 4146} 4147 4148.animated-container { 4149 will-change: transform, opacity; 4150 opacity: 0; 4151 transition: opacity 0.3s; 4152} 4153 4154.slot.interaction-prompt > * { 4155 pointer-events: none; 4156} 4157 4158.slot.ar-button { 4159 -moz-user-select: none; 4160 -webkit-tap-highlight-color: transparent; 4161 user-select: none; 4162 4163 display: var(--ar-button-display, block); 4164} 4165 4166.slot.ar-button:not(.enabled) { 4167 display: none; 4168} 4169 4170.fab { 4171 display: flex; 4172 align-items: center; 4173 justify-content: center; 4174 box-sizing: border-box; 4175 width: 40px; 4176 height: 40px; 4177 cursor: pointer; 4178 background-color: #fff; 4179 box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15); 4180 border-radius: 100px; 4181} 4182 4183.fab > * { 4184 opacity: 0.87; 4185} 4186 4187#default-ar-button { 4188 position: absolute; 4189 bottom: 16px; 4190 right: 16px; 4191 transform: scale(var(--ar-button-scale, 1)); 4192 transform-origin: bottom right; 4193} 4194 4195.slot.pan-target { 4196 display: block; 4197 position: absolute; 4198 width: 0; 4199 height: 0; 4200 left: 50%; 4201 top: 50%; 4202 transform: translate3d(-50%, -50%, 0); 4203 background-color: transparent; 4204 opacity: 0; 4205 transition: opacity 0.3s; 4206} 4207 4208#default-pan-target { 4209 width: 6px; 4210 height: 6px; 4211 border-radius: 6px; 4212 border: 1px solid white; 4213 box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8); 4214} 4215 4216.slot.default { 4217 pointer-events: none; 4218} 4219 4220.slot.progress-bar { 4221 pointer-events: none; 4222} 4223 4224.slot.exit-webxr-ar-button { 4225 pointer-events: none; 4226} 4227 4228.slot.exit-webxr-ar-button:not(.enabled) { 4229 display: none; 4230} 4231 4232#default-exit-webxr-ar-button { 4233 display: flex; 4234 align-items: center; 4235 justify-content: center; 4236 position: absolute; 4237 top: env(safe-area-inset-top, 16px); 4238 right: 16px; 4239 width: 40px; 4240 height: 40px; 4241 box-sizing: border-box; 4242} 4243 4244#default-exit-webxr-ar-button > svg { 4245 fill: #fff; 4246} 4247</style> 4248<div class="container"> 4249 <div class="userInput" tabindex="0" role="img" 4250 aria-label="3D model"> 4251 <div class="slot canvas"> 4252 <slot name="canvas"> 4253 <canvas></canvas> 4254 </slot> 4255 </div> 4256 4257 </div> 4258 4259 <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM 4260 will have their <slot> elements removed by ShadyCSS --> 4261 <div class="slot poster"> 4262 <slot name="poster"> 4263 <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button> 4264 </slot> 4265 </div> 4266 4267 <div class="slot ar-button"> 4268 <slot name="ar-button"> 4269 <a id="default-ar-button" part="default-ar-button" class="fab" 4270 tabindex="2" 4271 role="button" 4272 href="javascript:void(0);" 4273 aria-label="View in your space"> 4274 ${fM} 4275 </a> 4276 </slot> 4277 </div> 4278 4279 <div class="slot pan-target"> 4280 <slot name="pan-target"> 4281 <div id="default-pan-target"> 4282 </div> 4283 </slot> 4284 </div> 4285 4286 <div class="slot interaction-prompt cover centered"> 4287 <div id="prompt" class="animated-container"> 4288 <slot name="interaction-prompt" aria-hidden="true"> 4289 ${dM} 4290 </slot> 4291 </div> 4292 </div> 4293 4294 <div id="finger0" class="animated-container cover"> 4295 <slot name="finger0" aria-hidden="true"> 4296 </slot> 4297 </div> 4298 <div id="finger1" class="animated-container cover"> 4299 <slot name="finger1" aria-hidden="true"> 4300 </slot> 4301 </div> 4302 4303 <div class="slot default"> 4304 <slot></slot> 4305 4306 <div class="slot progress-bar"> 4307 <slot name="progress-bar"> 4308 <div id="default-progress-bar" aria-hidden="true"> 4309 <div class="bar" part="default-progress-bar"></div> 4310 </div> 4311 </slot> 4312 </div> 4313 4314 <div class="slot exit-webxr-ar-button"> 4315 <slot name="exit-webxr-ar-button"> 4316 <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button" 4317 tabindex="3" 4318 aria-label="Exit AR" 4319 aria-hidden="true"> 4320 ${uM} 4321 </a> 4322 </slot> 4323 </div> 4324 </div> 4325</div> 4326<div class="screen-reader-only" role="region" aria-label="Live announcements"> 4327 <span id="status" role="status"></span> 4328</div>`,pM=r=>{Yg(AM,r)},Uc=new WeakMap;class mM extends Jn{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const s=new Ei(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,gt).catch(n)}decodeDracoFile(e,t,n,i,s=it,o=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};
vendor: 11,989 bytes, lines 4328-4329
4328return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Uc.has(e)){const l=Uc.get(e);if(l.key===n)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,h)=>{i._callbacks[s]={resolve:c,reject:h},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Uc.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new pn;e.index&&t.setIndex(new Et(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],s=i.name,o=i.array,a=i.itemSize,l=new Et(o,a);s==="color"&&(this._assignVertexColorSpace(l,i.vertexColorSpace),l.normalized=!(o instanceof Float32Array)),t.setAttribute(s,l)}return t}_assignVertexColorSpace(e,t){if(t!==gt)return;const n=new Ce;for(let i=0,s=e.count;i<s;i++)n.fromBufferAttribute(e,i).convertSRGBToLinear(),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new Ei(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=gM.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` 4329`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function gM(){let r,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":r=a.decoderConfig,e=new Promise(function(h){r.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(r)});break;case"decode":const l=a.buffer,c=a.taskConfig;e.then(h=>{const u=h.draco,d=new u.Decoder;try{const f=t(u,d,new Int8Array(l),c),m=f.attributes.map(g=>g.array.buffer);f.index&&m.push(f.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:f},m)}catch(f){console.error(f),self.postMessage({type:"error",id:a.id,error:f.message})}finally{u.destroy(d)}});break}};function t(o,a,l,c){const h=c.attributeIDs,u=c.attributeTypes;let d,f;const m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)d=new o.Mesh,f=a.DecodeArrayToMesh(l,l.byteLength,d);else if(m===o.POINT_CLOUD)d=new o.PointCloud,f=a.DecodeArrayToPointCloud(l,l.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const g={index:null,attributes:[]};for(const A in h){const p=self[u[A]];let x,_;if(c.useUniqueIDs)_=h[A],x=a.GetAttributeByUniqueId(d,_);else{if(_=a.GetAttributeId(d,o[h[A]]),_===-1)continue;x=a.GetAttribute(d,_)}const S=i(o,a,d,A,p,x);A==="color"&&(S.vertexColorSpace=c.vertexColorSpace),g.attributes.push(S)}return m===o.TRIANGULAR_MESH&&(g.index=n(o,a,d)),o.destroy(d),g}function n(o,a,l){const h=l.num_faces()*3,u=h*4,d=o._malloc(u);a.GetTrianglesUInt32Array(l,u,d);const f=new Uint32Array(o.HEAPF32.buffer,d,h).slice();return o._free(d),{array:f,itemSize:1}}function i(o,a,l,c,h,u){const d=u.num_components(),m=l.num_points()*d,g=m*h.BYTES_PER_ELEMENT,A=s(o,h),p=o._malloc(g);a.GetAttributeDataArrayForAllPoints(l,u,A,g,p);const x=new h(o.HEAPF32.buffer,p,m).slice();return o._free(p),{name:c,array:x,itemSize:d}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}function yA(r,e){if(e===aE)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===au||e===ug){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===au)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}class _M extends Jn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new SM(t)}),this.register(function(t){return new DM(t)}),this.register(function(t){return new LM(t)}),this.register(function(t){return new PM(t)}),this.register(function(t){return new CM(t)}),this.register(function(t){return new MM(t)}),this.register(function(t){return new wM(t)}),this.register(function(t){return new bM(t)}),this.register(function(t){return new xM(t)}),this.register(function(t){return new TM(t)}),this.register(function(t){return new IM(t)}),this.register(function(t){return new RM(t)}),this.register(function(t){return new BM(t)}),this.register(function(t){return new vM(t)}),this.register(function(t){return new UM(t)}),this.register(function(t){return new NM(t)})}load(e,t,n,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=Mo.extractUrlBase(e);o=Mo.resolveURL(c,this.path)}else o=Mo.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Ei(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let s;const o={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===n0){try{o[ze.KHR_BINARY_GLTF]=new FM(e)}catch(u){i&&i(u);return}s=JSON.parse(o[ze.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new KM(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],d=s.extensionsRequired||[];switch(u){case ze.KHR_MATERIALS_UNLIT:o[u]=new yM;break;case ze.KHR_DRACO_MESH_COMPRESSION:o[u]=new OM(s,this.dracoLoader);break;case ze.KHR_TEXTURE_TRANSFORM:o[u]=new QM;break;case ze.KHR_MESH_QUANTIZATION:o[u]=new kM;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function EM(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class vM{constructor(e){this.parser=e,this.name=ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const h=new Ce(16777215);l.color!==void 0&&h.setRGB(l.color[0],l.color[1],l.color[2],it);const u=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new Hg(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Gg(h),c.distance=u;break;case"spot":c=new uC(h),c.distance=u,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,Di(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),t.cac
vendor: 9,644 bytes, line 4329
4329he.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(t.cache,a,l)})}}class yM{constructor(){this.name=ze.KHR_MATERIALS_UNLIT}getMaterialType(){return xn}extendParams(e,t,n){const i=[];e.color=new Ce(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],it),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,gt))}return Promise.all(i)}}class xM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class SM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Se(a,a)}return Promise.all(s)}}class IM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class CM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Ce(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],it)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,gt)),o.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class MM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class wM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new Ce().setRGB(a[0],a[1],a[2],it),Promise.all(s)}}class bM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class TM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new Ce().setRGB(a[0],a[1],a[2],it),o.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,gt)),Promise.all(s)}}class BM{constructor(e){this.parser=e,this.name=ze.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class RM{constructor(e){this.parser=e,this.name=ze.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:vi}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class DM{constructor(e){this.parser=e,this.name=ze.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class LM{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class PM{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
4329FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class UM{constructor(e){this.name=ze.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(f),h,u,d,i.mode,i.filter),f})})}else return null}}class NM{constructor(e){this.name=ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const c of i.primitives)if(c.mode!==En.TRIANGLES&&c.mode!==En.TRIANGLE_STRIP&&c.mode!==En.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(h=>(l[c]=h,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const h=c.pop(),u=h.isGroup?h.children:[h],d=c[0].count,f=[];for(const m of u){const g=new Me,A=new D,p=new fn,x=new D(1,1,1),_=new $I(m.geometry,m.material,d);for(let S=0;S<d;S++)l.TRANSLATION&&A.fromBufferAttribute(l.TRANSLATION,S),l.ROTATION&&p.fromBufferAttribute(l.ROTATION,S),l.SCALE&&x.fromBufferAttribute(l.SCALE,S),_.setMatrixAt(S,g.compose(A,p,x));for(const S in l)if(S==="_COLOR_0"){const C=l[S];_.instanceColor=new uu(C.array,C.itemSize,C.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&m.geometry.setAttribute(S,l[S]);lt.prototype.copy.call(_,m),this.parser.assignFinalMaterial(_),f.push(_)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}}const n0="glTF",Kr=12,xA={JSON:1313821514,BIN:5130562};class FM{constructor(e){this.name=ze.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Kr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==n0)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Kr,s=new DataView(e,Kr);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);if(o+=4,l===xA.JSON){const c=new Uint8Array(e,Kr+o,a);this.content=n.decode(c)}else if(l===xA.BIN){const c=Kr+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class OM{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ze.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const h in o){const u=yu[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=yu[h]||h.toLowerCase();if(o[h]!==void 0){const d=n.accessors[e.attributes[h]],f=xr[d.componentType];c[u]=f.name,l[u]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(f){for(const m in f.attributes){const g=f.attributes[m],A=l[m];A!==void 0&&(g.normalized=A)}u(f)},a,c,it,d)})})}}class QM{constructor(){this.name=ze.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class kM{constructor(){this.name=ze.KHR_MESH_QUANTIZATION}}class i0 extends Go{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)t[o]=n[s+o];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,h=i-t,u=(n-t)/h,d=u*u,f=d*u,m=e*c,g=m-c,A=-2*f+3*d,p=f-d,x=1-A,_=p-d+u;for(let S=0;S!==a;S++){const C=o[g+S+a],I=o[g+S+l]*h,w=o[m+S+a],b=o[m+S]*h;s[S]=x*C+_*I+A*w+p*b}return s}}const GM=new fn;class HM extends i0{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return GM.fromArray(s).normalize().toArray(s),s}}const En={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},xr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},SA={9728:Tt,9729:Xe,9984:No,9985:gs,9986:Fi,9987:on},IA={33071:Ct,33648:vs,10497:Fn},Nc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yu={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},VM={CUBICSPLINE:void 0,LINEAR:xs,STEP:Mr},Fc={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function zM(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new Bo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Nn})),r.DefaultMaterial}function ts(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Di(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function WM(r,e,t){let n=!1,i=!1,s=!1;for(let c=0,h=e.length;c<h;c++){const u=e[c];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const o=[],a=[],l=[];for(let c=0,h=e.length;c<h;c++){const u=e[c];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):r.attributes.position;o.push(d)}if(i){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):r.attributes.normal;a.push(d)}if(s){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):r.attributes.color;l.push(d)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const h=c[0],u=c[1],d=c[2];return n&&(r.morphAttributes.position=h),i&&(r.morphAttributes.normal=u),s&&(r.morphAttributes.color=d
vendor: 9,225 bytes, line 4329
4329),r.morphTargetsRelative=!0,r})}function $M(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function qM(r){let e;const t=r.extensions&&r.extensions[ze.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Oc(t.attributes):e=r.indices+":"+Oc(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+Oc(r.targets[n]);return e}function Oc(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function xu(r){switch(r){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function XM(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const YM=new Me;class KM{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new EM,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,s=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&s<98?this.textureLoader=new kg(this.options.manager):this.textureLoader=new mC(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ei(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return ts(s,a,i),Di(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const o=t[i].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,h]of o.children.entries())s(h,a.children[c])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ze.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){n.load(Mo.resolveURL(t.uri,i.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const o=Nc[i.type],a=xr[i.componentType],l=i.normalized===!0,c=new a(i.count*o);return Promise.resolve(new Et(c,o,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=Nc[i.type],c=xr[i.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,m=i.normalized===!0;let g,A;if(f&&f!==u){const p=Math.floor(d/f),x="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count;let _=t.cache.get(x);_||(g=new c(a,p*f,i.count*f/h),_=new GI(g,f/h),t.cache.add(x,_)),A=new Ku(_,l,d%f/h,m)}else a===null?g=new c(i.count*l):g=new c(a,d,i.count*l),A=new Et(g,l,m);if(i.sparse!==void 0){const p=Nc.SCALAR,x=xr[i.sparse.indices.componentType],_=i.sparse.indices.byteOffset||0,S=i.sparse.values.byteOffset||0,C=new x(o[1],_,i.sparse.count*p),I=new c(o[2],S,i.sparse.count*l);a!==null&&(A=new Et(A.array.slice(),A.itemSize,A.normalized));for(let w=0,b=C.length;w<b;w++){const v=C[w];if(A.setX(v,I[w*l]),l>=2&&A.setY(v,I[w*l+1]),l>=3&&A.setZ(v,I[w*l+2]),l>=4&&A.setW(v,I[w*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const d=(s.samplers||{})[o.sampler]||{};return h.magFilter=SA[d.magFilter]||Xe,h.minFilter=SA[d.minFilter]||on,h.wrapS=IA[d.wrapS]||Fn,h.wrapT=IA[d.wrapT]||Fn,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(u){return new Promise(function(d,f){let m=d;t.isImageBitmapLoader===!0&&(m=function(g){const A=new nt(g);A.needsUpdate=!0,d(A)}),t.load(Mo.resolveURL(u,s.path),m,void 0,f)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||XM(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(o){if
vendor: 3,001 bytes, line 4329
4329(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[ze.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[ze.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[ze.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Pg,Un.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Lg,Un.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return Bo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[ze.KHR_MATERIALS_UNLIT]){const u=i[ze.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Ce(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],it),a.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,gt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Yt);const h=s.alphaMode||Fc.OPAQUE;if(h===Fc.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Fc.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==xn&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Se(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==xn&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==xn){const u=s.emissiveFactor;a.emissive=new Ce().setRGB(u[0],u[1],u[2],it)}
vendor: 8,452 bytes, line 4329
4329return s.emissiveTexture!==void 0&&o!==xn&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,gt)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Di(u,s),t.associations.set(u,{materials:e}),s.extensions&&ts(i,u,s),u})}createUniqueName(e){const t=$e.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return CA(l,a,t)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],h=qM(c),u=i[h];if(u)o.push(u.promise);else{let d;c.extensions&&c.extensions[ze.KHR_DRACO_MESH_COMPRESSION]?d=s(c):d=CA(new pn,c,t),i[h]={primitive:c,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const h=o[l].material===void 0?zM(this.cache):this.getDependency("material",o[l].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let f=0,m=h.length;f<m;f++){const g=h[f],A=o[f];let p;const x=c[f];if(A.mode===En.TRIANGLES||A.mode===En.TRIANGLE_STRIP||A.mode===En.TRIANGLE_FAN||A.mode===void 0)p=s.isSkinnedMesh===!0?new VI(g,x):new ot(g,x),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),A.mode===En.TRIANGLE_STRIP?p.geometry=yA(p.geometry,ug):A.mode===En.TRIANGLE_FAN&&(p.geometry=yA(p.geometry,au));else if(A.mode===En.LINES)p=new qI(g,x);else if(A.mode===En.LINE_STRIP)p=new ju(g,x);else if(A.mode===En.LINE_LOOP)p=new XI(g,x);else if(A.mode===En.POINTS)p=new YI(g,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(p.geometry.morphAttributes).length>0&&$M(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Di(p,s),A.extensions&&ts(i,p,A),t.assignFinalMaterial(p),u.push(p)}for(let f=0,m=u.length;f<m;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return s.extensions&&ts(i,u[0],s),u[0];const d=new Oi;s.extensions&&ts(i,d,s),t.associations.set(d,{meshes:e});for(let f=0,m=u.length;f<m;f++)d.add(u[f]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Ft(vl.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Ur(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Di(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),o=i,a=[],l=[];for(let c=0,h=o.length;c<h;c++){const u=o[c];if(u){a.push(u);const d=new Me;s!==null&&d.fromArray(s.array,c*16),l.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Ju(a,l)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],l=[],c=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){const f=i.channels[u],m=i.samplers[f.sampler],g=f.target,A=g.node,p=i.parameters!==void 0?i.parameters[m.input]:m.input,x=i.parameters!==void 0?i.parameters[m.output]:m.output;g.node!==void 0&&(o.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",p)),l.push(this.getDependency("accessor",x)),c.push(m),h.push(g))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(u){const d=u[0],f=u[1],m=u[2],g=u[3],A=u[4],p=[];for(let x=0,_=d.length;x<_;x++){const S=d[x],C=f[x],I=m[x],w=g[x],b=A[x];if(S===void 0)continue;S.updateMatrix&&S.updateMatrix();const v=n._createAnimationTracks(S,C,I,w,b);if(v)for(let E=0;E<v.length;E++)p.push(v[E])}return new fu(s,void 0,p)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const o=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),o})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),o=[],a=i.children||[];for(let c=0,h=a.length;c<h;c++)o.push(n.getDependency("node",a[c]));const l=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),l]).then(function(c){const h=c[0],u=c[1],d=c[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,YM)});for(let f=0,m=u.length;f<m;f++)h.add(u[f]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?i.createUniqueName(s.name):"",a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let h;if(s.isBone===!0?h=new Dg:c.length>1?h=new Oi:c.length===1?h=c[0]:h=new lt,h!==c[0])for(let u=0,d=c.length;u<d;u++)h.add(c[u]);if(s.name&&(h.userData.name=s.name,h.name=o),Di(h,s),s.extensions&&ts(n,h,s),s.matrix!==void 0){const u=new Me;u.fromArray(s.matrix),h.applyMatrix4(u)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);return i.associations.has(h)||i.associations.set(h,{}),i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new Oi;n.name&&(s.name=i.createUniqueName(n.name)),Di(s,n),n.extensions&&ts(t,s,n);const o=n.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(i.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let h=0,u=l.length;h<u;h++)s.add(l[h]);const c=h=>{const u=new Map;for(const[d,f]of i.associations)(d instanceof Un||d instanceof nt)&&u.set(d,f);return h.traverse(d=>{const f=i.associations.get(d);f!=null&&u.set(d,f)}),u};return i.associations=c(s),s})}_createAnimationTracks(e,t,n,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];bi[s.path]===bi.weights?e.traverse(function(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}):l.push(a);let c;switch(bi[s.path]){case bi.weights:c=Tr;break;case bi.rotation:c=Ss;break;case bi.position:case bi.scale:c=Br;break;default:switch(n.itemSize){case 1:c=Tr;break;case 2:case 3:default:c=Br;break}break}const h=i.interpolation!==void 0?VM[i.interpolation]:xs,u=this._getArrayFromAccessor(n);for(let d=0,f=l.length;d<f;d++){const m=new c(l[d]+"."+bi[s.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=xu(t.constructor),i=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Ss?HM:i0;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function JM(r,e,t){const n=e.attributes,i=new sn;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new D(l[0],l[1],l[2]),new D(c[0],c[1],c[2])),a.normalized){const h=xu(xr[a.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new D,l=new D;for(let c=0,h=s.length;c<h;c++){const u=s[c];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],f=d.min,m=d.max;if(f!==void 0&&m!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(m[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(m[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(m[2]))),d.normalized){const g=xu(xr[d.componentType]);l.multiplyScalar(g)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}
vendor: 4,905 bytes, line 4329
4329i.expandByVector(a)}r.boundingBox=i;const o=new Mn;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=o}function CA(r,e,t){const n=e.attributes,i=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){r.setAttribute(a,l)})}for(const o in n){const a=yu[o]||o.toLowerCase();a in r.attributes||i.push(s(n[o],a))}if(e.indices!==void 0&&!r.index){const o=t.getDependency("accessor",e.indices).then(function(a){r.setIndex(a)});i.push(o)}return Je.workingColorSpace!==it&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Je.workingColorSpace}" not supported.`),Di(r,e),JM(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?WM(r,e.targets,t):r})}class jM{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:i,msg:s,transfer:o}=this.queue.shift();this.workersResolve[e]=i,this.workers[e].postMessage(s,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const ZM=0,MA=2,ew=1,wA=2,tw=0,nw=1,iw=10,sw=0,s0=9,r0=15,o0=16,a0=22,l0=37,c0=43,h0=76,u0=83,d0=97,f0=100,A0=103,p0=109,m0=165,g0=166;class rw{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Jr{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const en=[171,75,84,88,32,50,48,187,13,10,26,10];function bA(r){return typeof TextDecoder<"u"?new TextDecoder().decode(r):Buffer.from(r).toString("utf8")}function ow(r){const e=new Uint8Array(r.buffer,r.byteOffset,en.length);if(e[0]!==en[0]||e[1]!==en[1]||e[2]!==en[2]||e[3]!==en[3]||e[4]!==en[4]||e[5]!==en[5]||e[6]!==en[6]||e[7]!==en[7]||e[8]!==en[8]||e[9]!==en[9]||e[10]!==en[10]||e[11]!==en[11])throw new Error("Missing KTX 2.0 identifier.");const t=new rw,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Jr(r,en.length,n,!0);t.vkFormat=i._nextUint32(),t.typeSize=i._nextUint32(),t.pixelWidth=i._nextUint32(),t.pixelHeight=i._nextUint32(),t.pixelDepth=i._nextUint32(),t.layerCount=i._nextUint32(),t.faceCount=i._nextUint32();const s=i._nextUint32();t.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),a=i._nextUint32(),l=i._nextUint32(),c=i._nextUint32(),h=i._nextUint64(),u=i._nextUint64(),d=new Jr(r,en.length+n,3*s*8,!0);for(let $=0;$<s;$++)t.levels.push({levelData:new Uint8Array(r.buffer,r.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Jr(r,o,a,!0),m={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},g=(m.descriptorBlockSize/4-6)/4;for(let $=0;$<g;
vendor: 2,076 bytes, line 4329
4329$++){const O={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&O.channelType?(O.sampleLower=f._nextInt32(),O.sampleUpper=f._nextInt32()):(O.sampleLower=f._nextUint32(),O.sampleUpper=f._nextUint32()),m.samples[$]=O}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(m);const A=new Jr(r,l,c,!0);for(;A._offset<c;){const $=A._nextUint32(),O=A._scan($),X=bA(O),q=A._scan($-O.byteLength);t.keyValue[X]=X.match(/^ktx/i)?bA(q):q,A._offset%4&&A._skip(4-A._offset%4)}if(u<=0)return t;const p=new Jr(r,h,u,!0),x=p._nextUint16(),_=p._nextUint16(),S=p._nextUint32(),C=p._nextUint32(),I=p._nextUint32(),w=p._nextUint32(),b=[];for(let $=0;$<s;$++)b.push({imageFlags:p._nextUint32(),rgbSliceByteOffset:p._nextUint32(),rgbSliceByteLength:p._nextUint32(),alphaSliceByteOffset:p._nextUint32(),alphaSliceByteLength:p._nextUint32()});const v=h+p._offset,E=v+S,L=E+C,F=L+I,R=new Uint8Array(r.buffer,r.byteOffset+v,S),P=new Uint8Array(r.buffer,r.byteOffset+E,C),N=new Uint8Array(r.buffer,r.byteOffset+L,I),G=new Uint8Array(r.buffer,r.byteOffset+F,w);return t.globalData={endpointCount:x,selectorCount:_,imageDescs:b,endpointsData:R,selectorsData:P,tablesData:N,extendedData:G},t}let Qc,Ai,Su;const kc={env:{emscripten_notify_memory_growth:function(r){Su=new Uint8Array(Ai.exports.memory.buffer)}}};class aw{init(){return Qc||(Qc=typeof fetch<"u"?fetch("data:application/wasm;base64,"+TA).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,kc)).then(this._init):WebAssembly.instantiate(Buffer.from(TA,"base64"),kc).then(this._init),Qc)}_init(e){Ai=e.instance,kc.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Ai)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=Ai.exports.malloc(n);Su.set(e,i),t=t||Number(Ai.exports.ZSTD_findDecompressedSize(i,n));const s=Ai.exports.malloc(t),o=Ai.exports.ZSTD_decompress(s,t,i,n),a=Su.slice(s,s+o);return Ai.exports.free(i),Ai.exports.free(s),a}}const TA="
vendor: 19,971 bytes, line 4329
4329AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWo
vendor: 19,007 bytes, line 4329
4329hCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",
vendor: 3,349 bytes, lines 4329-4330
4329Gc=new WeakMap;let Hc=0,Vc;class Wn extends Jn{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new jM,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const e=new Ei(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new Ei(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([s,o])=>{const a=Wn.BasisWorker.toString(),l=["/* constants */","let _EngineFormat = "+JSON.stringify(Wn.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Wn.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Wn.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(` 4330`);this.workerSourceURL=URL.createObjectURL(new Blob([l])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const c=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return c.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),c})}),Hc>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Hc++}return this.transcoderPending}load(e,t,n,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new Ei(this.manager);s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials),s.load(e,o=>
4330{if(Gc.has(o))return Gc.get(o).promise.then(t).catch(i);this._createTexture(o).then(a=>t?t(a):null).catch(i)},n,i)}_createTextureFrom(e,t){const{faces:n,width:i,height:s,format:o,type:a,error:l,dfdFlags:c}=e;if(a==="error")return Promise.reject(l);let h;if(t.faceCount===6)h=new jI(n,o,It);else{const u=n[0].mipmaps;h=t.layerCount>1?new JI(u,i,s,t.layerCount,o,It):new _s(u,i,s,o,It)}return h.minFilter=n[0].mipmaps.length===1?Xe:on,h.magFilter=Xe,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=_0(t),h.premultiplyAlpha=!!(c&ew),h}async _createTexture(e,t={}){const n=ow(new Uint8Array(e));if(n.vkFormat!==sw)return cw(n);const i=t,s=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(o=>this._createTextureFrom(o.data,n));return Gc.set(e,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Hc--,this}}Wn.BasisFormat={ETC1S:0,UASTC_4x4:1};Wn.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16};Wn.EngineFormat={RGBAFormat:_t,RGBA_ASTC_4x4_Format:ou,RGBA_BPTC_Format:Ja,RGBA_ETC2_EAC_Format:ru,RGBA_PVRTC_4BPPV1_Format:iu,RGBA_S3TC_DXT5_Format:Ka,RGB_ETC1_Format:Qu,RGB_ETC2_Format:su,RGB_PVRTC_4BPPV1_Format:nu,RGB_S3TC_DXT1_Format:Ya};Wn.BasisWorker=function(){let r,e,t;const n=_EngineFormat,i=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(m){const g=m.data;switch(g.type){case"init":r=g.config,o(g.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:A,buffers:p,width:x,height:_,hasAlpha:S,format:C,dfdFlags:I}=a(g.buffer);self.postMessage({type:"transcode",id:g.id,faces:A,width:x,height:_,hasAlpha:S,format:C,dfdFlags:I},p)}catch(A){console.error(A),self.postMessage({type:"error",id:g.id,error:A.message})}});break}});function o(m){e=new Promise(g=>{t={wasmBinary:m,onRuntimeInitialized:g},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function a(m){const g=new t.KTX2File(new Uint8Array(m));function A(){g.close(),g.delete()}if(!g.isValid())throw A(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const p=g.isUASTC()?s.UASTC_4x4:s.ETC1S,x=g.getWidth(),_=g.getHeight(),S=g.getLayers()||1,C=g.getLevels(),I=g.getFaces(),w=g.getHasAlpha(),b=g.getDFDFlags(),{transcoderFormat:v,engineFormat:E}=u(p,x,_,w);if(!x||!_||!C)throw A(),new Error("THREE.KTX2Loader: Invalid texture");if(!g.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const L=[],F=[];for(let R=0;R<I;R++){const P=[];for(let N=0;N<C;N++){const G=[];let $,O;for(let q=0;q<S;q++){const ee=g.getImageLevelInfo(N,q,R);R===0&&N===0&&q===0&&(ee.origWidth%4!==0||ee.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),C>1?($=ee.origWidth,O=ee.origHeight):($=ee.width,O=ee.height);const ue=new Uint8Array(g.getImageTranscodedSizeInBytes(N,q,0,v));if(!g.transcodeImage(ue,N,q,R,v,0,-1,-1))throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");G.push(ue)}const X=f(G);P.push({data:X,width:$,height:O}),F.push(X.buffer)}L.push({mipmaps:P,width:x,height:_,format:E})}return A(),{faces:L,buffers:F,width:x,height:_,hasAlpha:w,format:E,dfdFlags:b}}const l=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],c=l.sort(function(m,g){return m.priorityETC1S-g.priorityETC1S}),h=l.sort(function(m,g){return m.priorityUASTC-g.priorityUASTC});function u(m,g,A,p){let x,_;const S=m===s.ETC1S?c:h;for(let C=0;C<S.length;C++){const I=S[C];if(r[I.if]&&I.basisFormat.includes(m)&&!(p&&I.transcoderFormat.length<2)&&!(I.needsPowerOfTwo&&!(d(g)&&d(A))))return x=I.transcoderFormat[p?1:0],_=I.engineFormat[p?1:0],{transcoderFormat:x,engineFormat:_}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),x=i.RGBA32,_=n.RGBAFormat,{transcoderFormat:x,engineFormat:_}}function d(m){return m<=2?!0:(m&m-1)===0&&m!==0}function f(m){if(m.length===1)return m[0];let g=0;for(let x=0;x<m.length;x++){const _=m[x];g+=_.byteLength}const A=new Uint8Array(g);let p=0;for(let x=0;x<m.length;x++){const _=m[x];A.set(_,p),p+=_.byteLength}return A}};const lw=new Set([_t,ur,ps]),zc={[p0]:_t,[d0]:_t,[l0]:_t,[c0]:_t,[A0]:ur,[u0]:ur,[o0]:ur,[a0]:ur,[f0]:ps,[h0]:ps,[r0]:ps,[s0]:ps,[g0]:Al,[m0]:Al},Wc={[p0]:Bt,[d0]:Gt,[l0]:It,[c0]:It,[A0]:Bt,[u0]:Gt,[o0]:It,[a0]:It,[f0]:Bt,[h0]:Gt,[r0]:It,[s0]:It,[g0]:It,[m0]:It};async function cw(r){const{vkFormat:e}=r;if(zc[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;r.supercompressionScheme===MA&&(Vc||(Vc=new Promise(async s=>{const o=new aw;await o.init(),s(o)})),t=await Vc);const n=[];for(let s=0;s<r.levels.length;s++){const o=Math.max(1,r.pixelWidth>>s),a=Math.max(1,r.pixelHeight>>s),l=r.pixelDepth?Math.max(1,r.pixelDepth>
vendor: 4,191 bytes, lines 4330-4358
4330>s):0,c=r.levels[s];let h;if(r.supercompressionScheme===ZM)h=c.levelData;else if(r.supercompressionScheme===MA)h=t.decode(c.levelData,c.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let u;Wc[e]===Bt?u=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):Wc[e]===Gt?u=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):u=h,n.push({data:u,width:o,height:a,depth:l})}let i;if(lw.has(zc[e]))i=r.pixelDepth===0?new ko(n[0].data,r.pixelWidth,r.pixelHeight):new gg(n[0].data,r.pixelWidth,r.pixelHeight,r.pixelDepth);else{if(r.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new _s(n,r.pixelWidth,r.pixelHeight)}return i.mipmaps=n,i.type=Wc[e],i.format=zc[e],i.colorSpace=_0(r),i.needsUpdate=!0,Promise.resolve(i)}function _0(r){const e=r.dataFormatDescriptor[0];return e.colorPrimaries===nw?e.transferFunction===wA?gt:it:e.colorPrimaries===iw?e.transferFunction===wA?Ll:Oo:(e.colorPrimaries===tw||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),vn)}/* @license 4331 * Copyright 2019 Google LLC. All Rights Reserved. 4332 * Licensed under the Apache License, Version 2.0 (the 'License'); 4333 * you may not use this file except in compliance with the License. 4334 * You may obtain a copy of the License at 4335 * 4336 * http://www.apache.org/licenses/LICENSE-2.0 4337 * 4338 * Unless required by applicable law or agreed to in writing, software 4339 * distributed under the License is distributed on an 'AS IS' BASIS, 4340 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4341 * See the License for the specific language governing permissions and 4342 * limitations under the License. 4343 */var BA,RA;const Bn=Symbol("retainerCount"),ri=Symbol("recentlyUsed"),xa=Symbol("evict"),jr=Symbol("evictionThreshold"),$c=Symbol("cache");class hw{constructor(e,t=5){this[BA]=new Map,this[RA]=[],this[$c]=e,this[jr]=t}set evictionThreshold(e){this[jr]=e,this[xa]()}get evictionThreshold(){return this[jr]}get cache(){return this[$c]}retainerCount(e){return this[Bn].get(e)||0}reset(){this[Bn].clear(),this[ri]=[]}retain(e){this[Bn].has(e)||this[Bn].set(e,0),this[Bn].set(e,this[Bn].get(e)+1);const t=this[ri].indexOf(e);t!==-1&&this[ri].splice(t,1),this[ri].unshift(e),this[xa]()}release(e){this[Bn].has(e)&&this[Bn].set(e,Math.max(this[Bn].get(e)-1,0)),this[xa]()}[(BA=Bn,RA=ri,xa)](){if(!(this[ri].length<this[jr]))for(let e=this[ri].length-1;e>=this[jr];--e){const t=this[ri][e];this[Bn].get(t)===0&&(this[$c].delete(t),this[ri].splice(e,1))}}}/* @license 4344 * Copyright 2021 Google LLC. All Rights Reserved. 4345 * Licensed under the Apache License, Version 2.0 (the 'License'); 4346 * you may not use this file except in compliance with the License. 4347 * You may obtain a copy of the License at 4348 * 4349 * http://www.apache.org/licenses/LICENSE-2.0 4350 * 4351 * Unless required by applicable law or agreed to in writing, software 4352 * distributed under the License is distributed on an 'AS IS' BASIS, 4353 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4354 * See the License for the specific language governing permissions and 4355 * limitations under the License. 4356 */const uw=r=>{const e=[],t=new Set;for(const n of r){let i=n,s=0;for(;t.has(i);)i=n+"."+ ++s;t.add(i),e.push(i)}return e},dw=r=>{const e=new Map;for(const t of r.mappings)for(const n of t.variants)e.set(n,{material:null,gltfMaterialIndex:t.material});return e};class fw{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,n=t.json;if(n.extensions===void 0||n.extensions[this.name]===void 0)return null;const s=n.extensions[this.name].variants||[],o=uw(s.map(a=>a.name));for(const a of e.scenes)a.traverse(l=>{const c=l;if(!c.material)return;const h=t.associations.get(c);if(h==null||h.meshes==null||h.primitives==null)return;const m=n.meshes[h.meshes].primitives[h.primitives].extensions;!m||!m[this.name]||(c.userData.variantMaterials=dw(m[this.name]))});return e.userData.variants=o,Promise.resolve()}}/* @license 4357 * Copyright 2019 Google LLC. All Rights Reserved. 4358 * Licensed under the Apache License, Version 2.0 (the 'License');
4359 * you may not use this file except in compliance with the License. 4360 * You may obtain a copy of the License at 4361 * 4362 * http://www.apache.org/licenses/LICENSE-2.0 4363 * 4364 * Unless required by applicable law or agreed to in writing, software 4365 * distributed under the License is distributed on an 'AS IS' BASIS, 4366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4367 * See the License for the specific language governing permissions and 4368 * limitations under the License. 4369 */var E0,DA;nt.DEFAULT_ANISOTROPY=4;const Aw=(r,e,t=()=>{})=>{const n=i=>{const s=i.loaded/i.total;t(Math.max(0,Math.min(1,isFinite(s)?s:1)))};return new Promise((i,s)=>{e.load(r,i,n,s)})},pw=r=>new Promise((e,t)=>{const n=document.createElement("script");document.body.appendChild(n),n.onload=e,n.onerror=t,n.async=!0,n.src=r}),oi=new Map,qc=new Map;let LA;const PA=new mM;let UA;const Xc=new Wn;let Yc,Kc;const as=Symbol("loader"),Li=Symbol("evictionPolicy"),NA=Symbol("GLTFInstance");class Ut extends On{constructor(e){super(),this[DA]=new _M().register(t=>new fw(t)),this[NA]=e,this[as].setDRACOLoader(PA),this[as].setKTX2Loader(Xc)}static setDRACODecoderLocation(e){LA=e,PA.setDecoderPath(e)}static getDRACODecoderLocation(){return LA}static setKTX2TranscoderLocation(e){UA=e,Xc.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return UA}static setMeshoptDecoderLocation(e){Yc!==e&&(Yc=e,Kc=pw(e).then(()=>MeshoptDecoder.ready).then(()=>MeshoptDecoder))}static getMeshoptDecoderLocation(){return Yc}static initializeKTX2Loader(e){Xc.detectSupport(e)}static get cache(){return oi}static clearCache(){oi.forEach((e,t)=>{this.delete(t)}),this[Li].reset()}static has(e){return oi.has(e)}static async delete(e){if(!this.has(e))return;const t=oi.get(e);qc.delete(e),oi.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!qc.get(e)}get[(E0=Li,DA=as,Li)](){return this.constructor[Li]}async preload(e,t,n=()=>{}){if(this[as].setWithCredentials(Ut.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!oi.has(e)){Kc!=null&&this[as].setMeshoptDecoder(await Kc);const i=Aw(e,this[as],a=>{n(a*.8)}),s=this[NA],o=i.then(a=>s.prepare(a)).then(a=>(n(.9),new s(a))).catch(a=>(console.error(a),new s));oi.set(e,o)}await oi.get(e),qc.set(e,!0),n&&n(1)}async load(e,t,n=()=>{}){await this.preload(e,t,n);const s=await(await oi.get(e)).clone();return this[Li].retain(e),s.dispose=()=>{this[Li].release(e)},s}}Ut[E0]=new hw(Ut);class mw extends lt{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Se(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const qs=new D,FA=new Me,OA=new Me,QA=new D,kA=new D;class gw{constructor(e={}){const t=this;let n,i,s,o;const a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:n,height:i}},this.render=function(f,m){f.matrixWorldAutoUpdate===!0&&f.updateMatrixWorld(),m.parent===null&&m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),FA.copy(m.matrixWorldInverse),OA.multiplyMatrices(m.projectionMatrix,FA),c(f,f,m),d(f)},this.setSize=function(f,m){n=f,i=m,s=n/2,o=i/2,l.style.width=f+"px",l.style.height=m+"px"};function c(f,m,g){if(f.isCSS2DObject){qs.setFromMatrixPosition(f.matrixWorld),qs.applyMatrix4(OA);const A=f.visible===!0&&qs.z>=-1&&qs.z<=1&&f.layers.test(g.layers)===!0;if(f.element.style.display=A===!0?"":"none",A===!0){f.onBeforeRender(t,m,g);const x=f.element;x.style.transform="translate("+-100*f.center.x+"%,"+-100*f.center.y+"%)translate("+(qs.x*s+s)+"px,"+(-qs.y*o+o)+"px)",x.parentNode!==l&&l.appendChild(x),f.onAfterRender(t,m,g)}const p={distanceToCameraSquared:h(g,f)};a.objects.set(f,p)}for(let A=0,p=f.children.length;A<p;A++)c(f.children[A],m,g)}function h(f,m){return QA.setFromMatrixPosition(f.matrixWorld),kA.setFromMatrixPosition(m.matrixWorld),QA.distanceToSquared(kA)}function u(f){const m=[];return f.traverse(function(g){g.isCSS2DObject&&m.push(g)}),m}function d(f){const m=u(f).sort(function(A,p){if(A.renderOrder!==p.renderOrder)return p.renderOrder-A.renderOrder;const x=a.objects.get(A).distanceToCameraSquared,_=a.objects.get(p).distanceToCameraSquared;return x-_}),g=m.length;for(let A=0,p=m.length;A<p;A++)m[A].element.style.zIndex=g-A}}}function Sa(r,e,t){let n=t;const i=new D;return r.updateWorldMatrix(!0,!0),r.traverseVisible(s=>{const{geometry:o}=s;if(o!==void 0){const{position:a}=o.attributes;if(a!==void 0)for(let l=0,c=a.count;l<c;l++)s.isMesh?s.getVertexPosition(l,i):i.fromBufferAttribute(a,l),s.isSkinnedMesh||i.applyMatrix4(s.matrixWorld),n=e(n,i)}}),n}let Zr,Jc,Xs,Ia;function il(r,e=1/0,t=null){Jc||(Jc=new Yn(2,2,1,1)),Xs||(Xs=new an({uniforms:{blitTexture:new id(r)},vertexShader:` 4370 varying vec2 vUv; 4371 void main(){ 4372 vUv = uv; 4373 gl_Position = vec4(position.xy * 1.0,0.,.999999); 4374 }`,fragmentShader:` 4375 uniform sampler2D blitTexture; 4376 varying vec2 vUv; 4377 4378 void main(){ 4379 gl_FragColor = vec4(vUv.xy, 0, 1); 4380 4381 #ifdef IS_SRGB 4382 gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); 4383 #else 4384 gl_FragColor = texture2D( blitTexture, vUv); 4385 #endif 4386 }`})),Xs.uniforms.blitTexture.value=r,Xs.defines.IS_SRGB=r.colorSpace
vendor: 6,169 bytes, line 4386
4386==gt,Xs.needsUpdate=!0,Ia||(Ia=new ot(Jc,Xs),Ia.frustumCulled=!1);const n=new Ft,i=new Hi;i.add(Ia),t===null&&(t=Zr=new Yu({antialias:!1}));const s=Math.min(r.image.width,e),o=Math.min(r.image.height,e);t.setSize(s,o),t.clear(),t.render(i,n);const a=document.createElement("canvas"),l=a.getContext("2d");a.width=s,a.height=o,l.drawImage(t.domElement,0,0,s,o);const c=new Ug(a);return c.minFilter=r.minFilter,c.magFilter=r.magFilter,c.wrapS=r.wrapS,c.wrapT=r.wrapT,c.name=r.name,Zr&&(Zr.forceContextLoss(),Zr.dispose(),Zr=null),c}const GA={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class od{constructor(){this.pluginCallbacks=[],this.register(function(e){return new ww(e)}),this.register(function(e){return new bw(e)}),this.register(function(e){return new Rw(e)}),this.register(function(e){return new Dw(e)}),this.register(function(e){return new Lw(e)}),this.register(function(e){return new Pw(e)}),this.register(function(e){return new Tw(e)}),this.register(function(e){return new Bw(e)}),this.register(function(e){return new Uw(e)}),this.register(function(e){return new Nw(e)}),this.register(function(e){return new Fw(e)}),this.register(function(e){return new Ow(e)}),this.register(function(e){return new Qw(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){const s=new Mw,o=[];for(let a=0,l=this.pluginCallbacks.length;a<l;a++)o.push(this.pluginCallbacks[a](s));s.setPlugins(o),s.write(e,t,i).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,i,s,t)})}}const He={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},jc="KHR_mesh_quantization",dn={};dn[Tt]=He.NEAREST;dn[No]=He.NEAREST_MIPMAP_NEAREST;dn[Fi]=He.NEAREST_MIPMAP_LINEAR;dn[Xe]=He.LINEAR;dn[gs]=He.LINEAR_MIPMAP_NEAREST;dn[on]=He.LINEAR_MIPMAP_LINEAR;dn[Ct]=He.CLAMP_TO_EDGE;dn[Fn]=He.REPEAT;dn[vs]=He.MIRRORED_REPEAT;const HA={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},_w=new Ce,VA=12,Ew=1179937895,vw=2,zA=8,yw=1313821514,xw=5130562;function Eo(r,e){return r.length===e.length&&r.every(function(t,n){return t===e[n]})}function Sw(r){return new TextEncoder().encode(r).buffer}function Iw(r){return Eo(r.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Cw(r,e,t){const n={min:new Array(r.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(r.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let s=0;s<r.itemSize;s++){let o;r.itemSize>4?o=r.array[i*r.itemSize+s]:(s===0?o=r.getX(i):s===1?o=r.getY(i):s===2?o=r.getZ(i):s===3&&(o=r.getW(i)),r.normalized===!0&&(o=vl.normalize(o,r.array))),n.min[s]=Math.min(n.min[s],o),n.max[s]=Math.max(n.max[s],o)}return n}function v0(r){return Math.ceil(r/4)*4}function Zc(r,e=0){const t=v0(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i<t;i++)n[i]=e;return n.buffer}return r}function WA(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function $A(r,e){if(r.toBlob!==void 0)return new Promise(n=>r.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}class Mw{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;n=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),h=Object.keys(a),u=Object.keys(l);if(h.length>0&&(o.extensionsUsed=h),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),n.binary===!0){const d=new FileReader;d.readAsArrayBuffer(c),d.onloadend=function(){const f=Zc(d.result),m=new DataView(new ArrayBuffer(zA));m.setUint32(0,f.byteLength,!0),m.setUint32(4,xw,!0);const g=Zc(Sw(JSON.stringify(o)),32),A=new DataView(new ArrayBuffer(zA));A.setUint32(0,g.byteLength,!0),A.setUint32(4,yw,!0);const p=new ArrayBuffer(VA),x=new DataView(p);x.setUint32(0,Ew,!0),x.setUint32(4,vw,!0);const _=VA+A.byteLength+g.byteLength+m.byteLength+f.byteLength;x.setUint32(8,_,!0);const S=new Blob([p,A,g,m,f],{type:"application/octet-stream"}),C=new FileReader;C.readAsArrayBuffer(S),C.onloadend=function(){t(C.result)}}}else if(o.buffers&&o.buffers.length>0){const d=new FileReader;d.readAsDataURL(c),d.onloadend=function(){const f=d.result;o.buffers[0].uri=f,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}
vendor: 9,986 bytes, line 4386
4386catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new D;for(let i=0,s=e.count;i<s;i++)if(Math.abs(n.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),i=new D;for(let s=0,o=n.count;s<o;s++)i.fromBufferAttribute(n,s),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),n.setXYZ(s,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(i.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function n(f){return f.colorSpace===gt?function(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}:function(g){return g}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof _s&&(e=il(e)),t instanceof _s&&(t=il(t));const i=e?e.image:null,s=t?t.image:null,o=Math.max(i?i.width:0,s?s.width:0),a=Math.max(i?i.height:0,s?s.height:0),l=WA();l.width=o,l.height=a;const c=l.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,o,a);const h=c.getImageData(0,0,o,a);if(i){c.drawImage(i,0,0,o,a);const f=n(e),m=c.getImageData(0,0,o,a).data;for(let g=2;g<m.length;g+=4)h.data[g]=f(m[g]/256)*256}if(s){c.drawImage(s,0,0,o,a);const f=n(t),m=c.getImageData(0,0,o,a).data;for(let g=1;g<m.length;g+=4)h.data[g]=f(m[g]/256)*256}c.putImageData(h,0,0);const d=(e||t).clone();return d.source=new zu(l),d.colorSpace=vn,d.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),d}processBuffer(e){const t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,i,s){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;switch(t){case He.BYTE:case He.UNSIGNED_BYTE:a=1;break;case He.SHORT:case He.UNSIGNED_SHORT:a=2;break;default:a=4}let l=e.itemSize*a;s===He.ARRAY_BUFFER&&(l=Math.ceil(l/4)*4);const c=v0(i*l),h=new DataView(new ArrayBuffer(c));let u=0;for(let m=n;m<n+i;m++){for(let g=0;g<e.itemSize;g++){let A;e.itemSize>4?A=e.array[m*e.itemSize+g]:(g===0?A=e.getX(m):g===1?A=e.getY(m):g===2?A=e.getZ(m):g===3&&(A=e.getW(m)),e.normalized===!0&&(A=vl.normalize(A,e.array))),t===He.FLOAT?h.setFloat32(u,A,!0):t===He.INT?h.setInt32(u,A,!0):t===He.UNSIGNED_INT?h.setUint32(u,A,!0):t===He.SHORT?h.setInt16(u,A,!0):t===He.UNSIGNED_SHORT?h.setUint16(u,A,!0):t===He.BYTE?h.setInt8(u,A):t===He.UNSIGNED_BYTE&&h.setUint8(u,A),u+=a}u%l!==0&&(u+=l-u%l)}const d={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(d.target=s),s===He.ARRAY_BUFFER&&(d.byteStride=l),this.byteOffset+=c,o.bufferViews.push(d),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=Zc(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=He.FLOAT;else if(e.array.constructor===Int32Array)a=He.INT;else if(e.array.constructor===Uint32Array)a=He.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=He.SHORT;else if(e.array.constructor===Uint16Array)a=He.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=He.BYTE;else if(e.array.constructor===Uint8Array)a=He.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const l=Cw(e,n,i);let c;t!==void 0&&(c=e===t.index?He.ELEMENT_ARRAY_BUFFER:He.ARRAY_BUFFER);const h=this.processBufferView(e,a,n,i,c),u={bufferView:h.id,byteOffset:h.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,n,i="image/png"){if(e!==null){const s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});const h=o.images.get(e),u=i+":flipY/"+n.toString();if(h[u]!==void 0)return h[u];a.images||(a.images=[]);const d={mimeType:i},f=WA();f.width=Math.min(e.width,l.maxTextureSize),f.height=Math.min(e.height,l.maxTextureSize);const m=f.getContext("2d");if(n===!0&&(m.translate(0,f.height),m.scale(1,-1)),e.data!==void 0){t!==_t&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const A=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;p<A.length;p+=4)A[p+0]=e.data[p+0],A[p+1]=e.data[p+1],A[p+2]=e.data[p+2],A[p+3]=e.data[p+3];m.putImageData(new ImageData(A,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)m.drawImage(e,0,0,f.width,f.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");l.binary===!0?c.push($A(f,i).then(A=>s.processBufferViewImage(A)).then(A=>{d.bufferView=A})):f.toDataURL!==void 0?d.uri=f.toDataURL(i):c.push($A(f,i).then(A=>new FileReader().readAsDataURL(A)).then(A=>{d.uri=A}));const g=a.images.push(d)-1;return h[u]=g,g}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:dn[e.magFilter],minFilter:dn[e.minFilter],wrapS:dn[e.wrapS],wrapT:dn[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const n=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof _s&&(e=il(e,n.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,a)});const l=s.textures.push(a)-1;return i.textures.set(e,l),l}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(Eo(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const c={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Yt&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=n.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let S=0,C=e.material.length;S<C;S++)i.push(e.material[S].uuid);else i.push(e.material.uuid);const s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);const o=e.geometry;let a;e.isLineSegments?a=He.LINES:e.isLineLoop?a=He.LINE_LOOP:e.isLine?a=He.LINE_STRIP:e.isPoints?a=He.POINTS:a=e.material.wireframe?He.LINES:He.TRIANGLES;const l={},c={},h=[],u=[],d={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=o.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let m=null;
vendor: 15,195 bytes, line 4386
4386for(let S in o.attributes){if(S.slice(0,5)==="morph")continue;const C=o.attributes[S];if(S=d[S]||S.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(S)||(S="_"+S),t.attributes.has(this.getUID(C))){c[S]=t.attributes.get(this.getUID(C));continue}m=null;const w=C.array;S==="JOINTS_0"&&!(w instanceof Uint16Array)&&!(w instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),m=new Et(new Uint16Array(w),C.itemSize,C.normalized));const b=this.processAccessor(m||C,o);b!==null&&(S.startsWith("_")||this.detectMeshQuantization(S,C),c[S]=b,t.attributes.set(this.getUID(C),b))}if(f!==void 0&&o.setAttribute("normal",f),Object.keys(c).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const S=[],C=[],I={};if(e.morphTargetDictionary!==void 0)for(const w in e.morphTargetDictionary)I[e.morphTargetDictionary[w]]=w;for(let w=0;w<e.morphTargetInfluences.length;++w){const b={};let v=!1;for(const E in o.morphAttributes){if(E!=="position"&&E!=="normal"){v||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),v=!0);continue}const L=o.morphAttributes[E][w],F=E.toUpperCase(),R=o.attributes[E];if(t.attributes.has(this.getUID(L,!0))){b[F]=t.attributes.get(this.getUID(L,!0));continue}const P=L.clone();if(!o.morphTargetsRelative)for(let N=0,G=L.count;N<G;N++)for(let $=0;$<L.itemSize;$++)$===0&&P.setX(N,L.getX(N)-R.getX(N)),$===1&&P.setY(N,L.getY(N)-R.getY(N)),$===2&&P.setZ(N,L.getZ(N)-R.getZ(N)),$===3&&P.setW(N,L.getW(N)-R.getW(N));b[F]=this.processAccessor(P,o),t.attributes.set(this.getUID(R,!0),b[F])}u.push(b),S.push(e.morphTargetInfluences[w]),e.morphTargetDictionary!==void 0&&C.push(I[w])}l.weights=S,C.length>0&&(l.extras={},l.extras.targetNames=C)}const g=Array.isArray(e.material);if(g&&o.groups.length===0)return null;let A=!1;if(g&&o.index===null){const S=[];for(let C=0,I=o.attributes.position.count;C<I;C++)S[C]=C;o.setIndex(S),A=!0}const p=g?e.material:[e.material],x=g?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let S=0,C=x.length;S<C;S++){const I={mode:a,attributes:c};if(this.serializeUserData(o,I),u.length>0&&(I.targets=u),o.index!==null){let b=this.getUID(o.index);(x[S].start!==void 0||x[S].count!==void 0)&&(b+=":"+x[S].start+":"+x[S].count),t.attributes.has(b)?I.indices=t.attributes.get(b):(I.indices=this.processAccessor(o.index,o,x[S].start,x[S].count),t.attributes.set(b,I.indices)),I.indices===null&&delete I.indices}const w=this.processMaterial(p[x[S].materialIndex]);w!==null&&(I.material=w),h.push(I)}A===!0&&o.setIndex(null),l.primitives=h,n.meshes||(n.meshes=[]),this._invokeAll(function(S){S.writeMesh&&S.writeMesh(e,l)});const _=n.meshes.push(l)-1;return t.meshes.set(s,_),_}detectMeshQuantization(e,t){if(this.extensionsUsed[jc])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];GA[i]&&GA[i].includes(n)&&(this.extensionsUsed[jc]=!0,this.extensionsRequired[jc]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:vl.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=od.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l<s.length;++l){const c=s[l],h=$e.parseTrackName(c.name);let u=$e.findNode(t,h.nodeName);const d=HA[h.propertyName];if(h.objectName==="bones"&&(u.isSkinnedMesh===!0?u=u.skeleton.getBoneByName(h.objectIndex):u=void 0),!u||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;const f=1;let m=c.values.length/c.times.length;d===HA.morphTargetInfluences&&(m/=u.morphTargetInfluences.length);let g;c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",m/=3):c.getInterpolation()===Mr?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new Et(c.times,f)),output:this.processAccessor(new Et(c.values,m)),interpolation:g}),o.push({sampler:a.length-1,target:{node:i.get(u),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:a,channels:o}),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],s=e.skeleton;if(s===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],l=new Float32Array(s.bones.length*16),c=new Me;for(let u=0;u<s.bones.length;++u)a.push(n.get(s.bones[u])),c.copy(s.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,u*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Et(l,16)),joints:a,skeleton:n.get(o)}),i.skin=t.skins.length-1}processNode(e){const t=this.json,n=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);const s={};if(n.trs){const a=e.quaternion.toArray(),l=e.position.toArray(),c=e.scale.toArray();Eo(a,[0,0,0,1])||(s.rotation=a),Eo(l,[0,0,0])||(s.translation=l),Eo(c,[1,1,1])||(s.scale=c)}else e.matrixAutoUpdate&&e.updateMatrix(),Iw(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(s.mesh=a)}else e.isCamera&&(s.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let l=0,c=e.children.length;l<c;l++){const h=e.children[l];if(h.visible||n.onlyVisible===!1){const u=this.processNode(h);u!==null&&a.push(u)}}a.length>0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o<a;o++){const l=e.children[o];if(l.visible||n.onlyVisible===!1){const c=this.processNode(l);c!==null&&s.push(c)}}s.length>0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new Hi;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(i){i.beforeParse&&i.beforeParse(e)});const n=[];for(let i=0;i<e.length;i++)e[i]instanceof Hi?this.processScene(e[i]):n.push(e[i]);n.length>0&&this.processObjects(n);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll(function(i){i.afterParse&&i.afterParse(e)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}class ww{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,i=n.json,s=n.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class bw{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class Tw{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:n.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:n.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:n.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};n.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Bw{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:n.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:n.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Rw{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Dw{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:n.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Lw{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Pw{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(_w)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:n.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:n.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Uw{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.sheenRoughnessMap){const o={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Nw{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.anisotropyMap){const o={index:n.processTexture(e.anisotropyMap)};n.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Fw{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Ow{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.bumpMap){const o={index:n.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Qw{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const n=this.writer,i=e,s=new Float32Array(i.count*3),o=new Float32Array(i.count*4),a=new Float32Array(i.count*3),l=new Me,c=new D,h=new fn,u=new D;for(let f=0;f<i.count;f++)i.getMatrixAt(f,l),l.decompose(c,h,u),c.toArray(s,f*3),h.toArray(o,f*4),u.toArray(a,f*3);const d={TRANSLATION:n.processAccessor(new Et(s,3)),ROTATION:n.processAccessor(new Et(o,4)),SCALE:n.processAccessor(new Et(a,3))};i.instanceColor&&(d._COLOR_0=n.processAccessor(i.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:d},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}od.Utils={insertKeyframe:function(r,e){const n=r.getValueSize(),i=new r.TimeBufferType(r.t
vendor: 18,825 bytes, lines 4386-4466
4386imes.length+1),s=new r.ValueBufferType(r.values.length+n),o=r.createInterpolant(new r.ValueBufferType(n));let a;if(r.times.length===0){i[0]=e;for(let l=0;l<n;l++)s[l]=0;a=0}else if(e<r.times[0]){if(Math.abs(r.times[0]-e)<.001)return 0;i[0]=e,i.set(r.times,1),s.set(o.evaluate(e),0),s.set(r.values,n),a=0}else if(e>r.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;i[i.length-1]=e,i.set(r.times,0),s.set(r.values,0),s.set(o.evaluate(e),r.values.length),a=i.length-1}else for(let l=0;l<r.times.length;l++){if(Math.abs(r.times[l]-e)<.001)return l;if(r.times[l]<e&&r.times[l+1]>e){i.set(r.times.slice(0,l+1),0),i[l+1]=e,i.set(r.times.slice(l+1),l+2),s.set(r.values.slice(0,(l+1)*n),0),s.set(o.evaluate(e),(l+1)*n),s.set(r.values.slice((l+1)*n),(l+2)*n),a=l+1;break}}return r.times=i,r.values=s,a},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let s=0;s<i.length;++s){let o=i[s];const a=$e.parseTrackName(o.name),l=$e.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(xs)}const c=l.morphTargetInfluences.length,h=l.morphTargetDictionary[a.propertyIndex];if(h===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let u;if(n[l.uuid]===void 0){u=o.clone();const f=new u.ValueBufferType(c*u.times.length);for(let m=0;m<u.times.length;m++)f[m*c+h]=u.values[m];u.name=(a.nodeName||"")+".morphTargetInfluences",u.values=f,n[l.uuid]=u,t.push(u);continue}const d=o.createInterpolant(new o.ValueBufferType(1));u=n[l.uuid];for(let f=0;f<u.times.length;f++)u.values[f*c+h]=d.evaluate(u.times[f]);for(let f=0;f<o.times.length;f++){const m=this.insertKeyframe(u,o.times[f]);u.values[m*c+h]=o.values[f]}}return r.tracks=t,r}};/* @license 4387 * Copyright 2021 Google LLC. All Rights Reserved. 4388 * Licensed under the Apache License, Version 2.0 (the 'License'); 4389 * you may not use this file except in compliance with the License. 4390 * You may obtain a copy of the License at 4391 * 4392 * http://www.apache.org/licenses/LICENSE-2.0 4393 * 4394 * Unless required by applicable law or agreed to in writing, software 4395 * distributed under the License is distributed on an 'AS IS' BASIS, 4396 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4397 * See the License for the specific language governing permissions and 4398 * limitations under the License. 4399 */const qA=r=>r.material!==void 0&&r.userData&&r.userData.variantMaterials&&!!Array.from(r.userData.variantMaterials.values()).filter(e=>sl(e.material)),sl=r=>r&&r.isMaterial&&!Array.isArray(r);class kw{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const n of e)n.traverse(i=>{if(!qA(i))return;const s=i.userData.variantMaterials,o=i.userData.variantData;for(const[a,l]of o){const c=s.get(l.index);c&&sl(c.material)&&t.add(a)}});t.forEach(n=>this.variantNames.push(n))}writeMesh(e,t){if(!qA(e))return;const n=e.userData,i=n.variantMaterials,s=n.variantData,o=new Map,a=new Map,l=Array.from(s.values()).sort((u,d)=>u.index-d.index);for(const[u,d]of l.entries())a.set(d.index,u);for(const u of s.values()){const d=i.get(u.index);if(!d||!sl(d.material))continue;const f=this.writer.processMaterial(d.material);o.has(f)||o.set(f,{material:f,variants:[]}),o.get(f).variants.push(a.get(u.index))}const c=Array.from(o.values()).map(u=>u.variants.sort((d,f)=>d-f)&&u).sort((u,d)=>u.material-d.material);if(c.length===0)return;const h=sl(n.originalMaterial)?this.writer.processMaterial(n.originalMaterial):-1;for(const u of t.primitives)h>=0&&(u.material=h),u.extensions=u.extensions||{},u.extensions[this.name]={mappings:c}}afterParse(){if(this.variantNames.length===0)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map(n=>({name:n}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class Gw{constructor(e,t,n,i,s){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=s,this.frameCallback=this.onXRFrame.bind(this);const o=t.xr.getSession();if(i&&"XRWebGLBinding"in window){const a=new $u(16);e.environment=a.texture;const l=t.getContext();switch(o.preferredReflectionFormat){case"srgba8":l.getExtension("EXT_sRGB");break;case"rgba16f":l.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(o,l),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}o.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const s=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/s,i.primaryLightIntensity.y/s,i.primaryLightIntensity.z/s),this.xrLight.directionalLight.intensity=s,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Hw extends Oi{constructor(e,t=!0){super(),this.lightProbe=new pC,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new Hg,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;e.xr.addEventListener("sessionstart",()=>{const s=e.xr.getSession();"requestLightProbe"in s&&s.requestLightProbe({reflectionFormat:s.preferredReflectionFormat}).then(o=>{n=new Gw(this,e,o,t,()=>{i=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}/* @license 4400 * Copyright 2020 Google LLC. All Rights Reserved. 4401 * Licensed under the Apache License, Version 2.0 (the 'License'); 4402 * you may not use this file except in compliance with the License. 4403 * You may obtain a copy of the License at 4404 * 4405 * http://www.apache.org/licenses/LICENSE-2.0 4406 * 4407 * Unless required by applicable law or agreed to in writing, software 4408 * distributed under the License is distributed on an 'AS IS' BASIS, 4409 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4410 * See the License for the specific language governing permissions and 4411 * limitations under the License. 4412 */const y0=1e4,Vw=.001,x0=50;class un{constructor(e=x0){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(Vw,e)}update(e,t,n,i){const s=2e-4*this.naturalFrequency;if(e==null||i===0||e===t&&this.velocity===0)return t;if(n<0)return e;const o=e-t,a=this.velocity+this.naturalFrequency*o,l=o+n*a,c=Math.exp(-this.naturalFrequency*n),h=(a-this.naturalFrequency*l)*c,u=-this.naturalFrequency*(h+a*c);return Math.abs(h)<s*Math.abs(i)&&u*o>=0?(this.velocity=0,t):(this.velocity=h,t+l*c)}}/* @license 4413 * Copyright 2020 Google LLC. All Rights Reserved. 4414 * Licensed under the Apache License, Version 2.0 (the 'License'); 4415 * you may not use this file except in compliance with the License. 4416 * You may obtain a copy of the License at 4417 * 4418 * http://www.apache.org/licenses/LICENSE-2.0 4419 * 4420 * Unless required by applicable law or agreed to in writing, software 4421 * distributed under the License is distributed on an 'AS IS' BASIS, 4422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4423 * See the License for the specific language governing permissions and 4424 * limitations under the License. 4425 */const pr=.2,XA=.03,zw=.75,S0=12,Ww=Math.PI/(2*S0),YA=new Se,Ca=(r,e,t)=>{let n=e>0?t>0?0:-Math.PI/2:t>0?Math.PI/2:Math.PI;for(let i=0;i<=S0;++i)r.push(e+(pr-XA)*Math.cos(n),t+(pr-XA)*Math.sin(n),0,e+pr*Math.cos(n),t+pr*Math.sin(n),0),n+=Ww};class KA extends ot{constructor(e,t){const n=new pn,i=[],s=[],{size:o,boundingBox:a}=e,l=o.x/2,c=(t==="back"?o.y:o.z)/2;Ca(s,l,c),Ca(s,-l,c),Ca(s,-l,-c),Ca(s,l,-c);const h=s.length/3;for(let f=0;f<h-2;f+=2)i.push(f,f+1,f+3,f,f+3,f+2);const u=h-2;i.push(u,u+1,1,u,1,0),n.setAttribute("position",new An(s,3)),n.setIndex(i),super(n),this.side=t;const d=this.material;switch(d.side=Yt,d.transparent=!0,d.opacity=0,this.goalOpacity=0,this.opacityDamper=new un,this.hitPlane=new ot(new Yn(2*(l+pr),2*(c+pr))),this.hitPlane.visible=!1,this.hitPlane.material.side=Yt,this.add(this.hitPlane),a.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=a.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=a.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,n){YA.set(t,-n),this.hitPlane.visible=!0;const i=e.positionAndNormalFromPoint(YA,this.hitPlane);return this.hitPlane.visible=!1,i==null?null:i.position}getExpandedHit(e,t,n){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const i=this.getHit(e,t,n);return this.hitPlane.scale.set(1,1,1),i}set offsetHeight(e){e-=.001,this.side==="back"?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return this.side==="back"?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?zw:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:n}=this.hitPlane;t.dispose(),n.dispose(),this.geometry.dispose(),this.material.dispose(),(e=this.parent)===null||e===void 0||e.remove(this)}}/* @license 4426 * Copyright 2019 Google LLC. All Rights Reserved. 4427 * Licensed under the Apache License, Version 2.0 (the 'License'); 4428 * you may not use this file except in compliance with the License. 4429 * You may obtain a copy of the License at 4430 * 4431 * http://www.apache.org/licenses/LICENSE-2.0 4432 * 4433 * Unless required by applicable law or agreed to in writing, software 4434 * distributed under the License is distributed on an 'AS IS' BASIS, 4435 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4436 * See the License for the specific language governing permissions and 4437 * limitations under the License. 4438 */const Jt=(r,e)=>({type:"number",number:r,unit:e}),gi=(()=>{const r={};return t=>{const n=t;if(n in r)return r[n];const i=[];let s=0;for(;t;){if(++s>1e3){t="";break}const o=I0(t),a=o.nodes[0];if(a==null||a.terms.length===0)break;i.push(a),t=o.remainingInput}return r[n]=i}})(),I0=(()=>{const r=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,t=/^[\),]/,n="(",i="#";return s=>{const o=[];for(;s.length&&(s=s.trim(),!t.test(s));)if(s[0]===n){const{nodes:a,remainingInput:l}=JA(s);s=l,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:a})}else if(r.test(s)){const a=$w(s),l=a.nodes[0];if(s=a.remainingInput,s[0]===n){const{nodes:c,remainingInput:h}=JA(s);o.push({type:"function",name:l,arguments:c}),s=h}else o.push(l)}else if(e.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:a,remainingInput:l}=s[0]===i?Xw(s):qw(s);if(a.length===0)break;o.push(a[0]),s=l}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),$w=(()=>{const r=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const t=e.match(r),n=t==null?e:e.substr(0,t.index),i=t==null?"":e.substr(t.index);return{nodes:[{type:"ident",value:n}],remainingInput:i}}})(),qw=(()=>{const r=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,t=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const i=n.match(r),s=i==null?"0":i[0];n=s==null?n:n.slice(s.length);const o=n.match(e);let a=o!=null&&o[0]!==""?o[0]:null;const l=o==null?n:n.slice(a.length);return a!=null&&!t.test(a)&&(a=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:a}],remainingInput:l}}})(),Xw=(()=>{const r=/^[a-f0-9]*/i;return e=>{e=e.slice(1).trim();const t=e.match(r);return{nodes:t==null?[]:[{type:"hex",value:t[0]}],remainingInput:t==null?e:e.slice(t[0].length)}}})(),JA=r=>{const e=[];for(r=r.slice(1).trim();r.length;){const t=I0(r);if(e.push(t.nodes[0]),r=t.remainingInput.trim(),r[0]===",")r=r.slice(1).trim();else if(r[0]===")"){r=r.slice(1);break}}return{nodes:e,remainingInput:r}},jA=Symbol("visitedTypes");class Yw{constructor(e){this[jA]=e}walk(e,t){const n=e.slice();for(;n.length;){const i=n.shift();switch(this[jA].indexOf(i.type)>-1&&t(i),i.type){case"expression":n.unshift(...i.terms);break;case"function":n.unshift(i.name,...i.arguments);break}}}}const Vi=Object.freeze({type:"number",number:0,unit:null});/* @license 4439 * Copyright 2019 Google LLC. All Rights Reserved. 4440 * Licensed under the Apache License, Version 2.0 (the 'License'); 4441 * you may not use this file except in compliance with the License. 4442 * You may obtain a copy of the License at 4443 * 4444 * http://www.apache.org/licenses/LICENSE-2.0 4445 * 4446 * Unless required by applicable law or agreed to in writing, software 4447 * distributed under the License is distributed on an 'AS IS' BASIS, 4448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4449 * See the License for the specific language governing permissions and 4450 * limitations under the License. 4451 */const Ol=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="rad";else if(r.unit==="rad"||r.unit==null)return r;return{type:"number",number:(n==="deg"&&t!=null?t:0)*Math.PI/180,unit:"rad"}},ZA=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="m";else if(r.unit==="m")return r;let i;switch(n){default:i=1;break;case"cm":i=1/100;break;case"mm":i=1/1e3;break}return{type:"number",number:i*t,unit:"m"}},$n=(()=>{const r=t=>t,e={rad:r,deg:Ol,m:r,mm:ZA,cm:ZA};return(t,n=Vi)=>{isFinite(t.number)||(t.number=n.number,t.unit=n.unit);const{unit:i}=t;if(i==null)return t;const s=e[i];return s==null?n:s(t)}})();/* @license 4452 * Copyright 2019 Google LLC. All Rights Reserved. 4453 * Licensed under the Apache License, Version 2.0 (the 'License'); 4454 * you may not use this file except in compliance with the License. 4455 * You may obtain a copy of the License at 4456 * 4457 * http://www.apache.org/licenses/LICENSE-2.0 4458 * 4459 * Unless required by applicable law or agreed to in writing, software 4460 * distributed under the License is distributed on an 'AS IS' BASIS, 4461 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4462 * See the License for the specific language governing permissions and 4463 * limitations under the License. 4464 */var C0,ep,tp;const Qr=Symbol("evaluate"),rl=Symbol("lastValue");class mt{constructor(){this[C0]=null}static evaluatableFor(e,t=Vi){if(e instanceof mt)return e;if(e.type==="number")return e.unit==="%"?new Kw(e,t):e;switch(e.name.value){case"calc":return new Zw(e,t);case"env":return new Jw(e)}return Vi}static evaluate(e){return e instanceof mt?e.evaluate():e}static isConstant(e){return e instanceof mt?e.isConstant:!0}static applyIntrinsics(e,t){const{basis:n,keywords:i}=t,{auto:s}=i;return n.map((o,a)=>{const l=s[a]==null?o:s[a];let c=e[a]?e[a]:l;if(c.type==="ident"){const h=c.value;h in i&&(c=i[h][a])}return(c==null||c.type==="ident")&&(c=l),c.unit==="%"?Jt(c.number/100*o.number,o.unit):(c=$n(c,o),c.unit!==o.unit?o:c)})}get isConstant(){return!1}evaluate(){return(!this.isConstant||this[rl]==null)&&(this[rl]=this[Qr]()),this[rl]}}C0=rl;const np=Symbol("percentage"),eh=Symbol("basis");class Kw extends mt{constructor(e,t){super(),this[np]=e,this[eh]=t}get isConstant(){return!0}[Qr](){return Jt(this[np].number/100*this[eh].number,this[eh].unit)}}const Ma=Symbol("identNode");class Jw extends mt{constructor(e){super(),this[ep]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;t!=null&&t.type==="ident"&&(this[Ma]=t)}get isConstant(){return!1}[(ep=Ma,Qr)](){if(this[Ma]!=null)switch(this[Ma].value){case"window-scroll-y":const e=window.pageYOffset,t=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight);return{type:"number",number:e/(t-window.innerHeight)||0,unit:null}}return Vi}}const jw=/[\*\/]/,Ys=Symbol("evaluator");class Zw extends mt{constructor(e,t=Vi){if(super(),this[tp]=null,e.arguments.length!==1)return;const n=e.arguments[0].terms.slice(),i=[];for(;n.length;){const s=n.shift();if(i.length>0){const o=i[i.length-1];if(o.type==="operator"&&jw.test(o.value)){const a=i.pop(),l=i.pop();if(l==null)return;i.push(new sp(a,mt.evaluatableFor(l,t),mt.evaluatableFor(s,t)));continue}}i.push(s.type==="operator"?s:mt.evaluatableFor(s,t))}for(;i.length>2;){const[s,o,a]=i.splice(0,3);if(o.type!=="operator")return;i.unshift(new sp(o,mt.evaluatableFor(s,t),mt.evaluatableFor(a,t)))}i.length===1&&(this[Ys]=i[0])}get isConstant(){return this[Ys]==null||mt.isConstant(this[Ys])}[(tp=Ys,Qr)](){return this[Ys]!=null?mt.evaluate(this[Ys]):Vi}}const ip=Symbol("operator"),th=Symbol("left"),nh=Symbol("right");class sp extends mt{constructor(e,t,n){super(),this[ip]=e,this[th]=t,this[nh]=n}get isConstant(){return mt.isConstant(this[th])&&mt.isConstant(this[nh])}[Qr](){const e=$n(mt.evaluate(this[th])),t=$n(mt.evaluate(this[nh])),{number:n,unit:i}=e,{number:s,unit:o}=t;if(o!=null&&i!=null&&o!=i)return Vi;const a=i||o;let l;switch(this[ip].value){case"+":l=n+s;break;case"-":l=n-s;break;case"/":l=n/s;break;case"*":l=n*s;break;default:return Vi}return{type:"number",number:l,unit:a}}}const ih=Symbol("evaluatables"),rp=Symbol("intrinsics");class M0 extends mt{constructor(e,t){super(),this[rp]=t;const n=e[0],i=n!=null?n.terms:[];this[ih]=t.basis.map((s,o)=>{const a=i[o];return a==null?{type:"ident",value:"auto"}:a.type==="ident"?a:mt.evaluatableFor(a,s)})}get isConstant(){for(const e of this[ih])if(!mt.isConstant(e))return!1;return!0}[Qr](){const e=this[ih].map(t=>mt.evaluate(t));return mt.applyIntrinsics(e,this[rp]).map(t=>t.number)}}/* @license 4465 * Copyright 2019 Google LLC. All Rights Reserved. 4466 * Licensed under the Apache License, Version 2.0 (the 'License');
4467 * you may not use this file except in compliance with the License. 4468 * You may obtain a copy of the License at 4469 * 4470 * http://www.apache.org/licenses/LICENSE-2.0 4471 * 4472 * Unless required by applicable law or agreed to in writing, software 4473 * distributed under the License is distributed on an 'AS IS' BASIS, 4474 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4475 * See the License for the specific language governing permissions and 4476 * limitations under the License. 4477 */var w0,b0,T0,B0;const Ks=Symbol("instances"),op=Symbol("activateListener"),ap=Symbol("deactivateListener"),sh=Symbol("notifyInstances"),lp=Symbol("notify"),cp=Symbol("callback");class Hn{constructor(e){this[cp]=e}static[sh](){for(const e of Hn[Ks])e[lp]()}static[(w0=Ks,op)](){window.addEventListener("scroll",this[sh],{passive:!0})}static[ap](){window.removeEventListener("scroll",this[sh])}observe(){Hn[Ks].size===0&&Hn[op](),Hn[Ks].add(this)}disconnect(){Hn[Ks].delete(this),Hn[Ks].size===0&&Hn[ap]()}[lp](){this[cp]()}}Hn[w0]=new Set;const hp=Symbol("computeStyleCallback"),R0=Symbol("astWalker"),vo=Symbol("dependencies"),D0=Symbol("onScroll");class eb{constructor(e){this[b0]={},this[T0]=new Yw(["function"]),this[B0]=()=>{this[hp]({relatedState:"window-scroll"})},this[hp]=e}observeEffectsFor(e){const t={},n=this[vo];this[R0].walk(e,i=>{const{name:s}=i,a=i.arguments[0].terms[0];if(!(s.value!=="env"||a==null||a.type!=="ident"))switch(a.value){case"window-scroll-y":if(t["window-scroll"]==null){const l="window-scroll"in n?n["window-scroll"]:new Hn(this[D0]);l.observe(),delete n["window-scroll"],t["window-scroll"]=l}break}});for(const i in n)n[i].disconnect();this[vo]=t}dispose(){for(const e in this[vo])this[vo][e].disconnect()}}b0=vo,T0=R0,B0=D0;/* @license 4478 * Copyright 2019 Google LLC. All Rights Reserved. 4479 * Licensed under the Apache License, Version 2.0 (the 'License'); 4480 * you may not use this file except in compliance with the License. 4481 * You may obtain a copy of the License at 4482 * 4483 * http://www.apache.org/licenses/LICENSE-2.0 4484 * 4485 * Unless required by applicable law or agreed to in writing, software 4486 * distributed under the License is distributed on an 'AS IS' BASIS, 4487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4488 * See the License for the specific language governing permissions and 4489 * limitations under the License. 4490 */const Ri=r=>{const e=r.observeEffects||!1,t=r.intrinsics instanceof Function?r.intrinsics:()=>r.intrinsics;return(n,i)=>{const s=n.updated,o=n.connectedCallback,a=n.disconnectedCallback,l=Symbol(`${i}StyleEffector`),c=Symbol(`${i}StyleEvaluator`),h=Symbol(`${i}UpdateEvaluator`),u=Symbol(`${i}EvaluateAndSync`);Object.defineProperties(n,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const d=gi(this[i]);this[c]=new M0(d,t(this)),this[l]==null&&e&&(this[l]=new eb(()=>this[u]())),this[l]!=null&&this[l].observeEffectsFor(d)}},[u]:{value:function(){if(this[c]==null)return;const d=this[c].evaluate();this[r.updateHandler](d)}},updated:{value:function(d){d.has(i)&&(this[h](),this[u]()),s.call(this,d)}},connectedCallback:{value:function(){o.call(this),this.requestUpdate(i,this[i])}},disconnectedCallback:{value:function(){a.call(this),this[l]!=null&&(this[l].dispose(),this[l]=null)}}})}};/* @license 4491 * Copyright 2019 Google LLC. All Rights Reserved. 4492 * Licensed under the Apache License, Version 2.0 (the 'License'); 4493 * you may not use this file except in compliance with the License. 4494 * You may obtain a copy of the License at 4495 * 4496 * http://www.apache.org/licenses/LICENSE-2.0 4497 * 4498 * Unless required by applicable law or agreed to in writing, software 4499 * distributed under the License is distributed on an 'AS IS' BASIS, 4500 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4501 * See the License for the specific language governing permissions and 4502 * limitations under the License. 4503 */const L0=r=>r<.5?2*r*r:-1+(4-2*r)*r,tb=(r,e,t=L0)=>n=>r+(e-r)*t(n),nb=(r,e)=>{const t=i=>s=>i+=s,n=e.map(t(0));return i=>{i=zn(i,0,1),i*=n[n.length-1];const s=n.findIndex(l=>l>=i),o=s<1?0:n[s-1],a=n[s];return r[s]((i-o)/(a-o))}},mr=r=>{const e=[],t=[];let n=r.initialValue;for(let i=0;i<r.keyframes.length;++i){const s=r.keyframes[i],{value:o,frames:a}=s,l=s.ease||L0,c=tb(n,o,l);e.push(c),t.push(a),n=o}return nb(e,t)};/* @license 4504 * Copyright 2019 Google LLC. All Rights Reserved. 4505 * Licensed under the Apache License, Version 2.0 (the 'License');
vendor: 30,296 bytes, lines 4506-4541
4506 * you may not use this file except in compliance with the License. 4507 * You may obtain a copy of the License at 4508 * 4509 * http://www.apache.org/licenses/LICENSE-2.0 4510 * 4511 * Unless required by applicable law or agreed to in writing, software 4512 * distributed under the License is distributed on an 'AS IS' BASIS, 4513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4514 * See the License for the specific language governing permissions and 4515 * limitations under the License. 4516 */var bt=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const ib=5e3,sb=mr({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),rb=mr({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),ob=30,ab=12,P0="0deg 75deg 105%",lb="auto auto auto",cb="auto",hb=2.2,ub=["front","right","back","left"],db=["upper-","","lower-"],fb=3e3,Ab=". Use mouse, touch or arrow keys to move.",wa={AUTO:"auto"},rh={BASIC:"basic",WIGGLE:"wiggle"},pb={NONE:"none"},up=()=>({basis:[Ol(Jt(ob,"deg"))],keywords:{auto:[null]}}),mb=()=>({basis:[Ol(Jt(ab,"deg"))],keywords:{auto:[null]}}),U0=(()=>{const r=gi(P0)[0].terms,e=$n(r[0]),t=$n(r[1]);return n=>{const i=n[te].idealCameraDistance();return{basis:[e,t,Jt(i,"m")],keywords:{auto:[null,null,Jt(105,"%")]}}}})(),gb=r=>{const e=hb*r[te].boundingSphere.radius;return{basis:[Jt(-1/0,"rad"),Jt(Math.PI/8,"rad"),Jt(e,"m")],keywords:{auto:[null,null,null]}}},_b=r=>{const e=U0(r),n=new M0([],e).evaluate()[2];return{basis:[Jt(1/0,"rad"),Jt(Math.PI-Math.PI/8,"rad"),Jt(n,"m")],keywords:{auto:[null,null,null]}}},Eb=r=>{const e=r[te].boundingBox.getCenter(new D);return{basis:[Jt(e.x,"m"),Jt(e.y,"m"),Jt(e.z,"m")],keywords:{auto:[null,null,null]}}},N0=Math.PI/2,vb=Math.PI/3,yb=N0/2,xb=2*Math.PI,et=Symbol("controls"),ol=Symbol("panElement"),oh=Symbol("promptElement"),ba=Symbol("promptAnimatedContainer"),ah=Symbol("fingerAnimatedContainers"),Ta=Symbol("deferInteractionPrompt"),dp=Symbol("updateAria"),ai=Symbol("a11y"),fp=Symbol("updateA11y"),Ap=Symbol("updateCameraForRadius"),Js=Symbol("cancelPrompts"),lh=Symbol("onChange"),eo=Symbol("onPointerChange"),ns=Symbol("waitingToPromptUser"),Ba=Symbol("userHasInteracted"),js=Symbol("promptElementVisibleTime"),to=Symbol("lastPromptOffset"),Ra=Symbol("cancellationSource"),ch=Symbol("lastSpherical"),no=Symbol("jumpCamera"),hh=Symbol("initialized"),io=Symbol("maintainThetaPhi"),pp=Symbol("syncCameraOrbit"),mp=Symbol("syncFieldOfView"),gp=Symbol("syncCameraTarget"),_p=Symbol("syncMinCameraOrbit"),Ep=Symbol("syncMaxCameraOrbit"),vp=Symbol("syncMinFieldOfView"),yp=Symbol("syncMaxFieldOfView"),Sb=r=>{var e,t,n,i,s,o,a,l,c,h,u,d,f,m,g,A,p,x;class _ extends r{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=P0,this.cameraTarget=lb,this.fieldOfView=cb,this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=fb,this.interactionPrompt=wa.AUTO,this.interactionPromptStyle=rh.WIGGLE,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=pb.NONE,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=x0,this.a11y=null,this[e]=this.shadowRoot.querySelector(".interaction-prompt"),this[t]=this.shadowRoot.querySelector("#prompt"),this[n]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[i]=this.shadowRoot.querySelector(".pan-target"),this[s]=0,this[o]=1/0,this[a]=!1,this[l]=!1,this[c]=St.AUTOMATIC,this[h]=new wb(this[te].camera,this[Dn],this[te]),this[u]=new Za,this[d]=!1,this[f]=!1,this[m]=!1,this[g]={},this[A]=()=>{const C=this[et].changeSource;this[Ra]=C,C===St.USER_INTERACTION&&(this[Ba]=!0,this[Ta]())},this[p]=()=>{this[dp](),this[Kt]();const C=this[et].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:C}}))},this[x]=C=>{this[ul].classList.toggle("pointer-tumbling",C.type==="pointer-change-start")}}get inputSensitivity(){return this[et].inputSensitivity}set inputSensitivity(C){this[et].inputSensitivity=C}getCameraOrbit(){const{theta:C,phi:I,radius:w}=this[ch];return{theta:C,phi:I,radius:w,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return Ni(this[je].isPresenting?this[je].arRenderer.target:this[te].getTarget())}getFieldOfView(){return this[et].getFieldOfView()}getMinimumFieldOfView(){return this[et].options.minimumFieldOfView}getMaximumFieldOfView(){return this[et].options.maximumFieldOfView}getIdealAspect(){return this[te].idealAspect}jumpCameraToGoal(){this[no]=!0,this.requestUpdate(no,!1)}resetInteractionPrompt(){this[to]=0,this[js]=1/0,this[Ba]=!1,this[ns]=this.interactionPrompt===wa.AUTO&&this.cameraControls}zoom(C){const I=new WheelEvent("wheel",{deltaY:-30*C});this[Dn].dispatchEvent(I)}connectedCallback(){super.connectedCallback(),this[et].addEventListener("user-interaction",this[Js]),this[et].addEventListener("pointer-change-start",this[eo]),this[et].addEventListener("pointer-change-end",this[eo])}disconnectedCallback(){super.disconnectedCallback(),this[et].removeEventListener("user-interaction",this[Js]),this[et].removeEventListener("pointer-change-start",this[eo]),this[et].removeEventListener("pointer-change-end",this[eo])}updated(C){super.updated(C);const I=this[et],w=this[te];if(C.has("cameraControls")&&(this.cameraControls?(I.enableInteraction(),this.interactionPrompt===wa.AUTO&&(this[ns]=!0)):(I.disableInteraction(),this[Ta]()),this[Dn].setAttribute("aria-label",this[_r])),C.has("disableZoom")&&(I.disableZoom=this.disableZoom),C.has("disablePan")&&(I.enablePan=!this.disablePan),C.has("disableTap")&&(I.enableTap=!this.disableTap),(C.has("interactionPrompt")||C.has("cameraControls")||C.has("src"))&&(this.interactionPrompt===wa.AUTO&&this.cameraControls&&!this[Ba]?this[ns]=!0:this[Ta]()),C.has("interactionPromptStyle")&&(this[ba].style.opacity=this.interactionPromptStyle==rh.BASIC?"1":"0"),C.has("touchAction")){const b=this.touchAction;I.applyOptions({touchAction:b}),I.updateTouchActionStyle()}C.has("orbitSensitivity")&&(I.orbitSensitivity=this.orbitSensitivity),C.has("zoomSensitivity")&&(I.zoomSensitivity=this.zoomSensitivity),C.has("panSensitivity")&&(I.panSensitivity=this.panSensitivity),C.has("interpolationDecay")&&(I.setDamperDecayTime(this.interpolationDecay),w.setTargetDamperDecayTime(this.interpolationDecay)),C.has("a11y")&&this[fp](),this[no]===!0&&Promise.resolve().then(()=>{I.jumpToGoal(),w.jumpToGoal(),this[lh](),this[no]=!1})}async updateFraming(){const C=this[te],I=C.adjustedFoV(C.framedFoVDeg);await C.updateFraming();const w=C.adjustedFoV(C.framedFoVDeg),b=this[et].getFieldOfView()/I;this[et].setFieldOfView(w*b),this[io]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(C,I,w){const b=this[Dn],v=this[ah];if(v[0].style.opacity==="1"){console.warn("interact() failed because an existing interaction is running.");return}const E=new Array;E.push({x:mr(I.x),y:mr(I.y)});const L=[{x:E[0].x(0),y:E[0].y(0)}];w!=null&&(E.push({x:mr(w.x),y:mr(w.y)}),L.push({x:E[1].x(0),y:E[1].y(0)}));let F=performance.now();const{width:R,height:P}=this[te],N=this.getBoundingClientRect(),G=X=>{for(const[q,ee]of L.entries()){const{style:ue}=v[q];ue.transform=`translateX(${R*ee.x}px) translateY(${P*ee.y}px)`,X==="pointerdown"?ue.opacity="1":X==="pointerup"&&(ue.opacity="0");const we={pointerId:q-5678,pointerType:"touch",target:b,clientX:R*ee.x+N.x,clientY:P*ee.y+N.y,altKey:!0};b.dispatchEvent(new PointerEvent(X,we))}},$=()=>{const X=this[Ra];if(X!==St.AUTOMATIC||!b.isConnected){for(const ee of this[ah])ee.style.opacity="0";G("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:X}})),document.removeEventListener("visibilitychange",O);return}const q=Math.min(1,(performance.now()-F)/C);for(const[ee,ue]of L.entries())ue.x=E[ee].x(q),ue.y=E[ee].y(q);G("pointermove"),q<1?requestAnimationFrame($):(G("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:St.AUTOMATIC}})),document.removeEventListener("visibilitychange",O))},O=()=>{let X=0;document.visibilityState==="hidden"?X=performance.now()-F:F=performance.now()-X};document.addEventListener("visibilitychange",O),G("pointerdown"),this[Ra]=St.AUTOMATIC,requestAnimationFrame($)}[(e=oh,t=ba,n=ah,i=ol,s=to,o=js,a=Ba,l=ns,c=Ra,h=et,u=ch,d=no,f=hh,m=io,g=ai,mp)](C){const I=this[et],w=this[te];w.framedFoVDeg=C[0]*180/Math.PI,I.changeSource=St.NONE,I.setFieldOfView(w.adjustedFoV(w.framedFoVDeg)),this[Js]()}[pp](C){const I=this[et];if(this[io]){const{theta:w,phi:b}=this.getCameraOrbit();C[0]=w,C[1]=b,this[io]=!1}I.changeSource=St.NONE,I.setOrbit(C[0],C[1],C[2]),this[Js]()}[_p](C){this[et].applyOptions({minimumAzimuthalAngle:C[0],minimumPolarAngle:C[1],minimumRadius:C[2]}),this.jumpCameraToGoal()}[Ep](C){this[et].applyOptions({maximumAzimuthalAngle:C[0],maximumPolarAngle:C[1],maximumRadius:C[2]}),this[Ap](C[2]),this.jumpCameraToGoal()}[vp](C){this[et].applyOptions({minimumFieldOfView:C[0]*180/Math.PI}),this.jumpCameraToGoal()}[yp](C){const I=this[te].adjustedFoV(C[0]*180/Math.PI);this[et].applyOptions({maximumFieldOfView:I}),this.jumpCameraToGoal()}[gp](C){const[I,w,b]=C;this[je].arRenderer.isPresenting||this[te].setTarget(I,w,b),this[et].changeSource=St.NONE,this[je].arRenderer.updateTarget(),this[Js]()}[Xn](C,I){if(super[Xn](C,I),this[je].isPresenting||!this[Ms]())return;const w=this[et],b=this[te],v=performance.now();if(this[ns]&&this.loaded&&v>this[So]+this.interactionPromptThreshold&&(this[ns]=!1,this[js]=v,this[oh].classList.add("visible")),isFinite(this[js])&&this.interactionPromptStyle===rh.WIGGLE){const F=(v-this[js])/ib%1,R=sb(F),P=rb(F);if(this[ba].style.opacity=`${P}`,R!==this[to]){const N=R*b.width*.05,G=(R-this[to])*Math.PI/16;this[ba].style.transform=`translateX(${N}px)`,w.changeSource=St.AUTOMATIC,w.adjustOrbit(G,0,0),this[to]=R}}const E=w.update(C,I),L=b.updateTarget(I);(E||L)&&this[lh]()}[Ta](){this[ns]=!1,this[oh].classList.remove("visible"),this[js]=1/0}[Ap](C){const I=Math.max(this[te].farRadius(),C),w=0,b=Math.abs(2*I);this[et].updateNearFar(w,b)}[dp](){const{theta:C,phi:I}=this[et].getCameraSpherical(this[ch]),w=(4+Math.floor((C%xb+yb)/N0))%4,b=Math.floor(I/vb),v=ub[w],L=`${db[b]}${v}`,F=L;F in this[ai]?this[bl](this[ai][F]):this[bl](`View from stage ${L}`)}get[_r](){let C=Ab;return"interaction-prompt"in this[ai]&&(C=`. ${this[ai]["interaction-prompt"]}`),super[_r].replace(/\.$/,"")+(this.cameraControls?C:"")}async[Uo](C){const I=this[et],w=this[te],b=w.adjustedFoV(w.framedFoVDeg);super[Uo](C);const v=w.adjustedFoV(w.framedFoVDeg)/b,E=I.getFieldOfView()*(isFinite(v)?v:1);I.updateAspect(this[te].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[et].setFieldOfView(E),this.jumpCameraToGoal()}[zi](){super[zi](),this[hh]?this[io]=!0:this[hh]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(A=Js,p=lh,x=eo,fp)](){if(typeof this.a11y=="string")if(this.a11y.startsWith("{"))try{this[ai]=JSON.parse(this.a11y)}catch(C){console.warn("Error parsing a11y JSON:",C)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[ai]={};else typeof this.a11y=="object"&&this.a11y!=null?this[ai]=Object.assign({},this.a11y):this[ai]={};this[Dn].setAttribute("aria-label",this[_r])}}return bt([ve({type:Boolean,attribute:"camera-controls"})],_.prototype,"cameraControls",void 0),bt([Ri({intrinsics:U0,observeEffects:!0,updateHandler:pp}),ve({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],_.prototype,"cameraOrbit",void 0),bt([Ri({intrinsics:Eb,observeEffects:!0,updateHandler:gp}),ve({type:String,attribute:"camera-target",hasChanged:()=>!0})],_.prototype,"cameraTarget",void 0),bt([Ri({intrinsics:up,observeEffects:!0,updateHandler:mp}),ve({type:String,attribute:"field-of-view",hasChanged:()=>!0})],_.prototype,"fieldOfView",void 0),bt([Ri({intrinsics:gb,updateHandler:_p}),ve({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],_.prototype,"minCameraOrbit",void 0),bt([Ri({intrinsics:_b,updateHandler:Ep}),ve({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],_.prototype,"maxCameraOrbit",void 0),bt([Ri({intrinsics:mb,updateHandler:vp}),ve({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],_.prototype,"minFieldOfView",void 0),bt([Ri({intrinsics:up,updateHandler:yp}),ve({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],_.prototype,"maxFieldOfView",void 0),bt([ve({type:Number,attribute:"interaction-prompt-threshold"})],_.prototype,"interactionPromptThreshold",void 0),bt([ve({type:String,attribute:"interaction-prompt"})],_.prototype,"interactionPrompt",void 0),bt([ve({type:String,attribute:"interaction-prompt-style"})],_.prototype,"interactionPromptStyle",void 0),bt([ve({type:Number,attribute:"orbit-sensitivity"})],_.prototype,"orbitSensitivity",void 0),bt([ve({type:Number,attribute:"zoom-sensitivity"})],_.prototype,"zoomSensitivity",void 0),bt([ve({type:Number,attribute:"pan-sensitivity"})],_.prototype,"panSensitivity",void 0),bt([ve({type:String,attribute:"touch-action"})],_.prototype,"touchAction",void 0),bt([ve({type:Boolean,attribute:"disable-zoom"})],_.prototype,"disableZoom",void 0),bt([ve({type:Boolean,attribute:"disable-pan"})],_.prototype,"disablePan",void 0),bt([ve({type:Boolean,attribute:"disable-tap"})],_.prototype,"disableTap",void 0),bt([ve({type:Number,attribute:"interpolation-decay"})],_.prototype,"interpolationDecay",void 0),bt([ve()],_.prototype,"a11y",void 0),_};/* @license 4517 * Licensed under the Apache License, Version 2.0 (the 'License'); 4518 * you may not use this file except in compliance with the License. 4519 * You may obtain a copy of the License at 4520 * 4521 * http://www.apache.org/licenses/LICENSE-2.0 4522 * 4523 * Unless required by applicable law or agreed to in writing, software 4524 * distributed under the License is distributed on an 'AS IS' BASIS, 4525 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4526 * See the License for the specific language governing permissions and 4527 * limitations under the License. 4528 */const Ib=.018,xp=2,Cb=300,Mb=new Se,Sp=new D,Ip=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Da=Math.PI/8,La=.04,Pa=10,St={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class wb extends On{constructor(e,t,n){super(),this.camera=e,this.element=t,this.scene=n,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=St.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new De,this.panPerPixel=0,this.spherical=new Za,this.goalSpherical=new Za,this.thetaDamper=new un,this.phiDamper=new un,this.radiusDamper=new un,this.logFov=Math.log(Ip.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new un,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=i=>{if(this.enablePan)i.preventDefault();else for(const s of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:s.id})))},this.touchModeZoom=(i,s)=>{if(!this._disableZoom){const o=this.twoTouchDistance(this.pointers[0],this.pointers[1]),a=La*this.zoomSensitivity*(this.lastSeparation-o)*50/this.scene.height;this.lastSeparation=o,this.userAdjustOrbit(0,0,a)}this.panPerPixel>0&&this.movePan(i,s)},this.disableScroll=i=>{i.preventDefault()},this.touchModeRotate=(i,s)=>{const{touchAction:o}=this._options;if(!this.touchDecided&&o!=="none"){this.touchDecided=!0;const a=Math.abs(i),l=Math.abs(s);if(this.changeSource===St.USER_INTERACTION&&(o==="pan-y"&&l>a||o==="pan-x"&&a>l)){this.touchMode=null;return}else this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(i,s)},this.onPointerDown=i=>{if(this.pointers.length>2)return;const{element:s}=this;this.pointers.length===0&&(s.addEventListener("pointermove",this.onPointerMove),s.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=i.clientX,this.startPointerPosition.clientY=i.clientY,this.startTime=performance.now());try{s.setPointerCapture(i.pointerId)}catch{}this.pointers.push({clientX:i.clientX,clientY:i.clientY,id:i.pointerId}),this.isUserPointing=!1,i.pointerType==="touch"?(this.changeSource=i.altKey?St.AUTOMATIC:St.USER_INTERACTION,this.onTouchChange(i)):(this.changeSource=St.USER_INTERACTION,this.onMouseDown(i)),this.changeSource===St.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=i=>{const s=this.pointers.find(c=>c.id===i.pointerId);if(s==null)return;if(i.pointerType==="mouse"&&i.buttons===0){this.onPointerUp(i);return}const o=this.pointers.length,a=(i.clientX-s.clientX)/o,l=(i.clientY-s.clientY)/o;a===0&&l===0||(s.clientX=i.clientX,s.clientY=i.clientY,i.pointerType==="touch"?(this.changeSource=i.altKey?St.AUTOMATIC:St.USER_INTERACTION,this.touchMode!==null&&this.touchMode(a,l)):(this.changeSource=St.USER_INTERACTION,this.panPerPixel>0?this.movePan(a,l):this.handleSinglePointerMove(a,l)))},this.onPointerUp=i=>{const{element:s}=this,o=this.pointers.findIndex(a=>a.id===i.pointerId);o!==-1&&this.pointers.splice(o,1),this.panPerPixel>0&&!i.altKey&&this.resetRadius(),this.pointers.length===0?(s.removeEventListener("pointermove",this.onPointerMove),s.removeEventListener("pointerup",this.onPointerUp),s.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(i)):this.touchMode!==null&&this.onTouchChange(i),this.scene.element[ol].style.opacity=0,s.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=i=>{this.changeSource=St.USER_INTERACTION;const s=i.deltaY*(i.deltaMode==1?18:1)*La*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,s),i.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=i=>{const{changeSource:s}=this;this.changeSource=St.USER_INTERACTION,(i.shiftKey&&this.enablePan?this.panKeyCodeHandler(i):this.orbitZoomKeyCodeHandler(i))?(i.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=s},this._options=Object.assign({},Ip),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(this._interactionEnabled===!1){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(this._interactionEnabled===!0){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,e===!0?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Za){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=t===0?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,n=this.goalSpherical.radius){const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:s,minimumPolarAngle:o,maximumPolarAngle:a,minimumRadius:l,maximumRadius:c}=this._options,{theta:h,phi:u,radius:d}=this.goalSpherical,f=zn(e,i,s);!isFinite(i)&&!isFinite(s)&&(this.spherical.theta=this.wrapAngle(this.spherical.theta-f)+f);const m=zn(t,o,a),g=zn(n,l,c);return f===h&&m===u&&g===d||!isFinite(f)||!isFinite(m)||!isFinite(g)?!1:(this.goalSpherical.theta=f,this.goalSpherical.phi=m,this.goalSpherical.radius=g,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:n}=this._options;e=zn(e,t,n),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,n){const{theta:i,phi:s,radius:o}=this.goalSpherical,{minimumRadius:a,maximumRadius:l,minimumFieldOfView:c,maximumFieldOfView:h}=this._options,u=this.spherical.theta-i,d=Math.PI-.001,f=i-zn(e,-d-u,d-u),m=s-t,g=n===0?0:((n>0?l:a)-o)/(Math.log(n>0?h:c)-this.goalLogFov),A=o+n*(isFinite(g)?g:(l-a)*2);if(this.setOrbit(f,m,A),n!==0){const p=this.goalLogFov+n;this.setFieldOfView(Math.exp(p))}}jumpToGoal(){this.update(0,y0)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:n,maximumRadius:i}=this._options,s=this.spherical.theta-this.goalSpherical.theta;return Math.abs(s)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=Math.sign(s)*2*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,n),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,i),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&t!=="none"?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Cn(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,n){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,n*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return(t-Math.floor(t))*2*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:n,clientY:i}=e,{clientX:s,clientY:o}=t,a=s-n,l=o-i;return Math.sqrt(a*a+l*l)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.isUserPointing===!1&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(n,i,0)}initializePan(){const{theta:e,phi:t}=this.spherical,n=e-this.scene.yaw;this.panPerPixel=Ib*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(n),-Math.cos(t)*Math.sin(n),0,0,Math.sin(t),0,Math.sin(n),-Math.cos(t)*Math.cos(n),0)}movePan(e,t){const{scene:n}=this,i=Sp.set(e,t,0).multiplyScalar(this.inputSensitivity),s=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;i.multiplyScalar(s);const o=n.getTarget();o.add(i.applyMatrix3(this.panProjection)),n.boundingSphere.clampPoint(o,o),n.setTarget(o.x,o.y,o.z)}recenter(e){if(performance.now()>this.startTime+Cb||Math.abs(e.clientX-this.startPointerPosition.clientX)>xp||Math.abs(e.clientY-this.startPointerPosition.clientY)>xp)return;const{scene:t}=this,n=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(n==null){const{cameraTarget:i}=t.element;t.element.cameraTarget="",t.element.cameraTarget=i,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(n.position),t.setTarget(n.position.x,n.position.y,n.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Mb.set(0,0));if(t==null)return;e.target.worldToLocal(t.position);const n=e.getTarget(),{theta:i,phi:s}=this.spherical,o=i-e.yaw,a=Sp.set(Math.sin(s)*Math.sin(o),Math.cos(s),Math.sin(s)*Math.cos(o)),l=a.dot(t.position.sub(n));n.add(a.multiplyScalar(l)),e.setTarget(n.x,n.y,n.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-l)}onTouchChange(e){if(this.pointers.length===1)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&this.touchMode===null?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&this.touchMode!=null&&(this.initializePan(),e.altKey||(this.scene.element[ol].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(e.button===2||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[ol].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,La*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-1*La*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Da,0);break;case"ArrowDown":this.userAdjustOrbit(0,Da,0);break;case"ArrowLeft":this.userAdjustOrbit(-Da,0,0);break;case"ArrowRight":this.userAdjustOrbit(Da,0,0);break;default:t=!1;break}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-1*Pa);break;case"ArrowDown":this.movePan(0,Pa);break;case"ArrowLeft":this.movePan(-1*Pa,0);break;case"ArrowRight":this.movePan(Pa,0);break;default:t=!1;break}return t}}/* @license 4529 * Copyright 2019 Google LLC. All Rights Reserved. 4530 * Licensed under the Apache License, Version 2.0 (the 'License'); 4531 * you may not use this file except in compliance with the License. 4532 * You may obtain a copy of the License at 4533 * 4534 * http://www.apache.org/licenses/LICENSE-2.0 4535 * 4536 * Unless required by applicable law or agreed to in writing, software 4537 * distributed under the License is distributed on an 'AS IS' BASIS, 4538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4539 * See the License for the specific language governing permissions and 4540 * limitations under the License. 4541 */const bb=30,Tb=.8,Cp=1.5,Bb=20,F0=1.3,Rb=1/F0,Db=.25,Lb=10,Ui={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},Iu={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},Ua=new D,Pb=new Me,Ub=new D,Nb=new Ft(45,1,.1,100);class Fb extends On{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new D,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new D,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new D,this.goalYaw=0,this.goalScale=1,this.xDamper=new un,this.yDamper=new un,this.zDamper=new un,this.yawDamper=new un,this.scaleDamper=new un,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{this.placementBox!=null&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new KA(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=t=>{const n=this.transientHitTestSource;if(n==null)return;const i=this.frame.getHitTestResultsForTransientInput(n),s=this.presentedScene,o=this.placementBox;if(i.length===1){this.inputSource=t.inputSource;const{axes:a}=this.inputSource.gamepad,l=o.getHit(this.presentedScene,a[0],a[1]);o.show=!0,l!=null?(this.isTranslating=!0,this.lastDragPosition.copy(l)):this.placeOnWall===!1&&(this.isRotating=!0,this.lastAngle=a[0]*Cp)}else if(i.length===2){o.show=!0,this.isTwoFingering=!0;const{separation:a}=this.fingerPolar(i);this.firstRatio=a/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){_A();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom
4541-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return _A(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let n=new Promise((c,h)=>{requestAnimationFrame(()=>c())});e.setHotspotsVisibility(!1),e.queueRender(),await n,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),t===!0&&(this.xrLight=new Hw(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||this.xrLight==null)return;const c=this.presentedScene;c.add(this.xrLight),c.environment=this.xrLight.environment}));const i=await this.resolveARSession();i.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const s=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");s.classList.add("enabled"),s.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=s;const o=await i.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const a=Bb*Math.PI/180,l=this.placeOnWall===!0?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(a),z:-Math.cos(a)});i.requestHitTestSource({space:o,offsetRay:l}).then(c=>{this.initialHitSource=c}),this.currentSession=i,this.placementBox=new KA(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Ui.SESSION_STARTED})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(t=>{this.resolveCleanup=t});try{await this.currentSession.end(),await e}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return this.presentedScene!=null}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(e!=null){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;e!=null&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,t!=null){const{element:o}=t;this.xrLight!=null&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const a=this.turntableRotation;a!=null&&(t.yaw=a);const l=this.oldShadowIntensity;l!=null&&t.setShadowIntensity(l),t.setEnvironmentAndSkybox(o[go],o[_o]);const c=this.oldTarget;t.setTarget(c.x,c.y,c.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),o.requestUpdate("cameraTarget"),o.requestUpdate("maxCameraOrbit"),o[Uo](o.getBoundingClientRect()),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:St.NONE}}))})}this.renderer.height=0;const n=this.exitWebXRButtonContainer;n!=null&&(n.classList.remove("enabled"),n.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const i=this.transientHitTestSource;i!=null&&(i.cancel(),this.transientHitTestSource=null);const s=this.initialHitSource;s!=null&&(s.cancel(),this.initialHitSource=null),this.placementBox!=null&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,this.resolveCleanup!=null&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:Ui.NOT_PRESENTING})}updateView(e){const t=this.presentedScene,n=this.threeRenderer.xr;n.updateCamera(Nb),t.xrCamera=n.getCamera();const{elements:i}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(i[1],i[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const o=e.recommendedViewportScale;e.requestViewportScale(Math.max(o,Db))}const s=n.getBaseLayer();if(s!=null){const o=s instanceof XRWebGLLayer?s.getViewport(e):n.getBinding().getViewSubImage(s,e).viewport;this.threeRenderer.setViewport(o.x,o.y,o.width,o.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:n}=e,i=e.getCamera(),{width:s,height:o}=this.overlay.getBoundingClientRect();e.setSize(s,o),i.projectionMatrixInverse.copy(i.projectionMatrix).invert();const{theta:a,radius:l}=n.getCameraOrbit(),c=i.getWorldDirection(Ua);e.yaw=Math.atan2(-c.x,-c.z)-a,this.goalYaw=e.yaw,t.copy(i.position).add(c.multiplyScalar(l)),this.updateTarget();const h=e.getTarget();t.add(h).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:u}=this.frame;u.addEventListener("selectstart",this.onSelectStart),u.addEventListener("selectend",this.onSelectEnd),u.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(d=>{this.transientHitTestSource=d})}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return t!=null&&(Ua.copy(t).sub(this.presentedScene.getCamera().position),Ua.length()>Lb)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),n=e.getPose(t);if(n==null)return null;const i=Pb.fromArray(n.transform.matrix);return this.placeOnWall===!0&&(this.goalYaw=Math.atan2(i.elements[4],i.elements[6])),i.elements[5]>.75!==this.placeOnWall?Ub.setFromMatrixPosition(i):null}moveToFloor(e){const t=this.initialHitSource;if(t==null)return;const n=e.getHitTestResults(t);if(n.length==0)return;const i=n[0],s=this.getHitPoint(i);s!=null&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(s):this.goalPosition.y=s.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Ui.OBJECT_PLACED}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1],o=Math.atan2(s,i);let a=this.lastAngle-o;return a>Math.PI?a-=2*Math.PI:a<-Math.PI&&(a+=2*Math.PI),this.lastAngle=o,{separation:Math.sqrt(i*i+s*s),deltaYaw:a}}processInput(e){const t=this.transientHitTestSource;if(t==null||!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const n=e.getHitTestResultsForTransientInput(t),i=this.presentedScene,s=i.scale.x;if(this.isTwoFingering){if(n.length<2)this.isTwoFingering=!1;else{const{separation:o,deltaYaw:a}=this.fingerPolar(n);if(this.placeOnWall===!1&&(this.goalYaw+=a),i.canScale){const l=o/this.firstRatio;this.goalScale=l<F0&&l>Rb?1:l}}return}else if(n.length===2){this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:o}=this.fingerPolar(n);this.firstRatio=o/s;return}if(this.isRotating){const o=this.inputSource.gamepad.axes[0]*Cp;this.goalYaw+=o-this.lastAngle,this.lastAngle=o}
vendor: 9,211 bytes, lines 4541-4567
4541else this.isTranslating&&n.forEach(o=>{if(o.inputSource!==this.inputSource)return;let a=null;if(o.results.length>0&&(a=this.getHitPoint(o.results[0])),a==null&&(a=this.getTouchLocation()),a!=null){if(this.goalPosition.sub(this.lastDragPosition),this.placeOnWall===!1){const l=a.y-this.lastDragPosition.y;if(l<0){this.placementBox.offsetHeight=l/s,this.presentedScene.setShadowOffset(l);const c=Ua.copy(i.getCamera().position),h=-l/(c.y-a.y);c.multiplyScalar(h),a.multiplyScalar(1-h).add(c)}}this.goalPosition.add(a),this.lastDragPosition.copy(a)}})}moveScene(e){const t=this.presentedScene,{position:n,yaw:i}=t,s=t.boundingSphere.radius,o=this.goalPosition,a=t.scale.x,l=this.placementBox;let c=St.NONE;if(!o.equals(n)||this.goalScale!==a){c=St.USER_INTERACTION;let{x:h,y:u,z:d}=n;h=this.xDamper.update(h,o.x,e,s),u=this.yDamper.update(u,o.y,e,s),d=this.zDamper.update(d,o.z,e,s),n.set(h,u,d);const f=this.scaleDamper.update(a,this.goalScale,e,1);if(t.scale.set(f,f,f),!this.isTranslating){const m=o.y-u;this.placementComplete&&this.placeOnWall===!1?(l.offsetHeight=m/f,t.setShadowOffset(m)):m===0&&(this.placementComplete=!0,l.show=!1,t.setShadowIntensity(Tb))}}l.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(i,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:c}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const n=this.threeRenderer.xr.getReferenceSpace(),i=t.getViewerPose(n);i==null&&this.tracking===!0&&this.frames>bb&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Iu.NOT_TRACKING}));const s=this.presentedScene;if(i==null||s==null||!s.element.loaded){this.threeRenderer.clear();return}this.tracking===!1&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Iu.TRACKING}));let o=!0;for(const a of i.views){if(this.updateView(a),o){this.moveToFloor(t),this.processInput(t);const l=e-this.lastTick;this.moveScene(l),this.renderer.preRender(s,e,l),this.lastTick=e,s.renderShadow(this.threeRenderer)}this.threeRenderer.render(s,s.getCamera()),o=!1}}}function Ob(r){const e=new Map,t=new Map,n=r.clone();return O0(r,n,function(i,s){e.set(s,i),t.set(i,s)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;const s=i,o=e.get(i),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(l){return t.get(l)}),s.bind(s.skeleton,s.bindMatrix)}),n}function O0(r,e,t){t(r,e);for(let n=0;n<r.children.length;n++)O0(r.children[n],e.children[n],t)}/* @license 4542 * Copyright 2020 Google LLC. All Rights Reserved. 4543 * Licensed under the Apache License, Version 2.0 (the 'License'); 4544 * you may not use this file except in compliance with the License. 4545 * You may obtain a copy of the License at 4546 * 4547 * http://www.apache.org/licenses/LICENSE-2.0 4548 * 4549 * Unless required by applicable law or agreed to in writing, software 4550 * distributed under the License is distributed on an 'AS IS' BASIS, 4551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4552 * See the License for the specific language governing permissions and 4553 * limitations under the License. 4554 */const Mp=Symbol("prepared"),Cl=Symbol("prepare"),Gn=Symbol("preparedGLTF"),Ml=Symbol("clone");class Qb{constructor(e){this[Gn]=e}static prepare(e){if(e.scene==null)throw new Error("Model does not have a scene");if(e[Mp])return e;const t=this[Cl](e);return t[Mp]=!0,t}static[Cl](e){const{scene:t}=e,n=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:n})}get parser(){return this[Gn].parser}get animations(){return this[Gn].animations}get scene(){return this[Gn].scene}get scenes(){return this[Gn].scenes}get cameras(){return this[Gn].cameras}get asset(){return this[Gn].asset}get userData(){return this[Gn].userData}clone(){const e=this.constructor,t=this[Ml]();return new e(t)}dispose(){this.scenes.forEach(e=>{e.traverse(t=>{const n=t;if(!n.material)return;(Array.isArray(n.material)?n.material:[n.material]).forEach(s=>{for(const o in s){const a=s[o];if(a instanceof nt){const l=a.source.data;l.close!=null&&l.close(),a.dispose()}}s.dispose()}),n.geometry.dispose()})})}[Ml](){const e=this[Gn],t=Ob(this.scene);kb(t,this.scene);const n=[t],i=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:n,userData:i})}}const kb=(r,e)=>{Q0(r,e,(t,n)=>{n.userData.variantMaterials!==void 0&&(t.userData.variantMaterials=new Map(n.userData.variantMaterials)),n.userData.variantData!==void 0&&(t.userData.variantData=n.userData.variantData),n.userData.originalMaterial!==void 0&&(t.userData.originalMaterial=n.userData.originalMaterial)})},Q0=(r,e,t)=>{t(r,e);for(let n=0;n<r.children.length;n++)Q0(r.children[n],e.children[n],t)},wp=Symbol("threeGLTF"),bp=Symbol("gltf"),Tp=Symbol("gltfElementMap"),Bp=Symbol("threeObjectMap"),Rp=Symbol("parallelTraverseThreeScene"),Dp=Symbol("correlateOriginalThreeGLTF"),Lp=Symbol("correlateCloneThreeGLTF");class Po{constructor(e,t,n,i){this[wp]=e,this[bp]=t,this[Tp]=i,this[Bp]=n}static from(e,t){return t!=null?this[Lp](e,t):this[Dp](e)}static[Dp](e){const t=e.parser.json,n=e.parser.associations,i=new Map,s={name:"Default"},o={index:-1};for(const a of n.keys())a instanceof Un&&n.get(a)==null&&(o.index<0&&(t.materials==null&&(t.materials=[]),o.index=t.materials.length,t.materials.push(s)),a.name=s.name,n.set(a,{materials:o.index}));for(const[a,l]of n){l&&(a.userData=a.userData||{},a.userData.associations=l);for(const c in l)if(c!=null&&c!=="primitives"){const h=c,d=(t[h]||[])[l[h]];if(d==null)continue;let f=i.get(d);f==null&&(f=new Set,i.set(d,f)),f.add(a)}}return new Po(e,t,n,i)}static[Lp](e,t){const n=t.threeGLTF,i=t.gltf,s=JSON.parse(JSON.stringify(i)),o=new Map,a=new Map;for(let l=0;l<n.scenes.length;l++)this[Rp](n.scenes[l],e.scenes[l],(c,h)=>{const u=t.threeObjectMap.get(c);if(u!=null){for(const d in u)if(d!=null&&d!=="primitives"){const f=d,m=u[f],g=s[f][m],A=o.get(h)||{};A[f]=m,o.set(h,A);const p=a.get(g)||new Set;p.add(h),a.set(g,p)}}});return new Po(e,s,o,a)}static[Rp](e,t,n){const i=(s,o)=>{if(n(s,o),s.isObject3D){const a=s,l=o;if(a.material)if(Array.isArray(a.material))for(let c=0;c<a.material.length;++c)n(a.material[c],l.material[c]);else n(a.material,l.material);for(let c=0;c<s.children.length;++c)i(s.children[c],o.children[c])}};i(e,t)}get threeGLTF(){return this[wp]}get gltf(){return this[bp]}get gltfElementMap(){return this[Tp]}get threeObjectMap(){return this[Bp]}}/* @license 4555 * Copyright 2020 Google LLC. All Rights Reserved. 4556 * Licensed under the Apache License, Version 2.0 (the 'License'); 4557 * you may not use this file except in compliance with the License. 4558 * You may obtain a copy of the License at 4559 * 4560 * http://www.apache.org/licenses/LICENSE-2.0 4561 * 4562 * Unless required by applicable law or agreed to in writing, software 4563 * distributed under the License is distributed on an 'AS IS' BASIS, 4564 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4565 * See the License for the specific language governing permissions and 4566 * limitations under the License. 4567 */const so=Symbol("correlatedSceneGraph");class Gb extends Qb{static[Cl](e){const t=super[Cl](e);t[so]==null&&(t[so]=Po.from(t));const{scene:n}=t,i=new Mn(void 0,1/0);return n.traverse(s=>{s.renderOrder=1e3,s.frustumCulled=!1,s.name||(s.name=s.uuid);const o=s;if(o.material){const{geometry:a}=o;o.castShadow=!0,o.isSkinnedMesh&&(a.boundingSphere=i,a.boundingBox=null);const l=o.material;if(l.isMeshBasicMaterial===!0&&(l.toneMapped=!1),l.shadowSide=Nn,l.aoMap){const{gltf:c,threeObjectMap:h}=t[so],u=h.get(l);if(c.materials!=null&&u!=null&&u.materials!=null){const d=c.materials[u.materials];d.occlusionTexture&&d.occlusionTexture.texCoord===0&&a.attributes.uv!=null&&a.setAttribute("uv2",a.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[Gn][so]}[Ml](){const e=super[Ml](),t=new Map;return e.scene.traverse(n=>{const i=n;if(i.material){const o=i.material;if(o!=null){if(t.has(o.uuid)){i.material=t.get(o.uuid);return}i.material=o.clone(),t.set(o.uuid,i.material)}}const s=n;s.target!==void 0&&s.add(s.target)}),e[so]=Po.from(e,this.correlatedSceneGraph),e}}const k0=(r,e,t)=>{let n;switch(r){case It:n=new Uint8ClampedArray(e*t*4);break;case Gt:n=new Uint16Array(e*t*4);break;case ys:n=new Uint32Array(e*t*4);break;case ng:n=new Int8Array(e*t*4);break;case ig:n=new Int16Array(e*t*4);break;case Ou:n=new Int32Array(e*t*4);break;case Bt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let Na;const Hb=(r,e,t,n)=>{if(Na!==void 0)return Na;const i=new In(1,1,n);e.setRenderTarget(i);const s=new ot(new Yn,new xn({color:16777215}));e.render(s,t),e.setRenderTarget(null);const o=k0(r,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,o),i.dispose(),s.geometry.dispose(),s.material.dispose(),Na=o[0]!==0,Na};class ad{constructor(e){var t,n,i,s,o,a,l,c,h,u,d,f,m,g,A,p;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(_){throw this._renderer.setRenderTarget(null),_}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
vendor: 11,006 bytes, lines 4567-4600
4567=e.colorSpace;const x={format:_t,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((t=e.renderTargetOptions)===null||t===void 0?void 0:t.anisotropy)!==void 0?(n=e.renderTargetOptions)===null||n===void 0?void 0:n.anisotropy:1,generateMipmaps:((i=e.renderTargetOptions)===null||i===void 0?void 0:i.generateMipmaps)!==void 0?(s=e.renderTargetOptions)===null||s===void 0?void 0:s.generateMipmaps:!1,magFilter:((o=e.renderTargetOptions)===null||o===void 0?void 0:o.magFilter)!==void 0?(a=e.renderTargetOptions)===null||a===void 0?void 0:a.magFilter:Xe,minFilter:((l=e.renderTargetOptions)===null||l===void 0?void 0:l.minFilter)!==void 0?(c=e.renderTargetOptions)===null||c===void 0?void 0:c.minFilter:Xe,samples:((h=e.renderTargetOptions)===null||h===void 0?void 0:h.samples)!==void 0?(u=e.renderTargetOptions)===null||u===void 0?void 0:u.samples:void 0,wrapS:((d=e.renderTargetOptions)===null||d===void 0?void 0:d.wrapS)!==void 0?(f=e.renderTargetOptions)===null||f===void 0?void 0:f.wrapS:Ct,wrapT:((m=e.renderTargetOptions)===null||m===void 0?void 0:m.wrapT)!==void 0?(g=e.renderTargetOptions)===null||g===void 0?void 0:g.wrapT:Ct};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=ad.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Hi,this._camera=new Ur,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!Hb(this._type,this._renderer,this._camera,x)){let _;switch(this._type){case Gt:_=this._renderer.extensions.has("EXT_color_buffer_float")?Bt:void 0;break}_!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Bt}`),this._type=_):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new ot(new Yn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new In(this.width,this.height,x),this._renderTarget.texture.mapping=((A=e.renderTargetOptions)===null||A===void 0?void 0:A.mapping)!==void 0?(p=e.renderTargetOptions)===null||p===void 0?void 0:p.mapping:Ir}static instantiateRenderer(){const e=new Yu;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=k0(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new ko(this.toArray(),this.width,this.height,_t,this._type,e?.mapping||Ir,e?.wrapS||Ct,e?.wrapT||Ct,e?.magFilter||Xe,e?.minFilter||Xe,e?.anisotropy||1,it);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof an&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof nt&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof nt&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}const Vb=` 4568varying vec2 vUv; 4569 4570void main() { 4571 vUv = uv; 4572 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); 4573} 4574`,zb=` 4575// min half float value 4576#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) 4577// max half float value 4578#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) 4579 4580uniform sampler2D sdr; 4581uniform sampler2D gainMap; 4582uniform vec3 gamma; 4583uniform vec3 offsetHdr; 4584uniform vec3 offsetSdr; 4585uniform vec3 gainMapMin; 4586uniform vec3 gainMapMax; 4587uniform float weightFactor; 4588 4589varying vec2 vUv; 4590 4591void main() { 4592 vec3 rgb = texture2D( sdr, vUv ).rgb; 4593 vec3 recovery = texture2D( gainMap, vUv ).rgb; 4594 vec3 logRecovery = pow( recovery, gamma ); 4595 vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; 4596 vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; 4597 vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); 4598 gl_FragColor = vec4( clampedHdrColor , 1.0 ); 4599} 4600`;class Wb extends an{constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:i,gainMapMax:s,maxDisplayBoost:o,hdrCapacityMin:a,hdrCapacityMax:l,sdr:c,gainMap:h}){super({name:"GainMapDecoderMaterial",vertexShader:Vb,fragmentShader:zb,uniforms:{sdr:{value:c},gainMap:{value:h},gamma:{value:new D(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new D().fromArray(t)},offsetSdr:{value:new D().fromArray(n)},gainMapMin:{value:new D().fromArray(i)},gainMapMax:{value:new D().fromArray(s)},weightFactor:{value:(Math.log2(o)-a)/(l-a)}},blending:qn,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=o,this._hdrCapacityMin=a,this._hdrCapacityMax=l,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class G0 extends Error{}class H0 extends Error{}const ro=(r,e,t)=>{var n;let i;const s=(n=r.attributes.getNamedItem(e))===null||n===void 0?void 0:n.nodeValue;if(s)i=s;else{const o=r.getElementsByTagName(e)[0];if(o){const a=o.getElementsByTagName("rdf:li");if(a.length===3)i=Array.from(a).map(l=>l.innerHTML);else throw new Error(`Gainmap metadata contains an array of items for ${e} but its length is not 3`)}else{if(t)return t;throw new Error(`Can't find ${e} in gainmap metadata`)}}return i},$b=r=>{var e,t;let n;typeof TextDecoder<"u"?n=new TextDecoder().decode(r):n=r.toString();let i=n.indexOf("<x:xmpmeta");const s=new DOMParser;for(;i!==-1;){const o=n.indexOf("x:xmpmeta>",i);n.slice(i,o+10);const a=n.slice(i,o+10);try{const c=s.parseFromString(a,"text/xml").getElementsByTagName("rdf:Description")[0],h=ro(c,"hdrgm:GainMapMin","0"),u=ro(c,"hdrgm:GainMapMax"),d=ro(c,"hdrgm:Gamma","1"),f=ro(c,"hdrgm:OffsetSDR","0.015625"),m=ro(c,"hdrgm:OffsetHDR","0.015625");let g=(e=c.attributes.getNamedItem("hdrgm:HDRCapacityMin"))===null||e===void 0?void 0:e.nodeValue;g||(g="0");const A=(t=c.attributes.getNamedItem("hdrgm:HDRCapacityMax"))===null||t===void 0?void 0:t.nodeValue;if(!A)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(h)?h.map(p=>parseFloat(p)):[parseFloat(h),parseFloat(h),parseFloat(h)],gainMapMax:Array.isArray(u)?u.map(p=>parseFloat(p)):[parseFloat(u),parseFloat(u),parseFloat(u)],gamma:Array.isArray(d)?d.map(p=>parseFloat(p)):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetSdr:Array.isArray(f)?f.map(p=>parseFloat(p)):[parseFloat(f),parseFloat(f),parseFloat(f)],offsetHdr:Array.isArray(m)?m.map(p=>parseFloat(p)):[parseFloat(m),parseFloat(m),parseFloat(m)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(A)}}catch{}i=n.indexOf("<x:xmpmeta",o)}};class qb{constructor(e){this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,n)=>{const i=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const o=s.byteLength;let a=2,l=0,c;for(;a<o;){if(++l>250){n(new Error(`Found no marker after ${l} loops 😵`));return}if(s.getUint8(a)!==255){n(new Error(`Not a valid marker at offset 0x${a.toString(16)}, found: 0x${s.getUint8(a).toString(16)}`));return}if(c=s.getUint8(a+1),i&&console.log(`Marker: ${c.toString(16)}`),c===226){i&&console.log("Found APP2 marker (0xffe2)");const h=a+4;if(s.getUint32(h)===1297106432){const u=h+4;let d;if(s.getUint16(u)===18761)d=!1;else if(s.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const f=s.getUint32(u+4,!d);if(f<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const m=u+f,g=s.getUint16(m,!d),A=m+2;let p=0;for(let C=A;C<A+12*g;C+=12)s.getUint16(C,!d)===45057&&(p=s.getUint32(C+8,!d));const _=m+2+g*12+4,S=[];for(let C=_;C<_+p*16;C+=16){const I={MPType:s.getUint32(C,!d),size:s.getUint32(C+4,!d),dataOffset:s.getUint32(C+8,!d),dependantImages:s.getUint32(C+12,!d),start:-1,end:-1,isFII:!1};I.dataOffset?(I.start=u+I.dataOffset,I.isFII=!1):(I.start=0,I.isFII=!0),I.end=I.start+I.size,S.push(I)}if(this.options.extractNonFII&&S.length){const C=new Blob([s]),I=[];for(const w of S){if(w.isFII&&!this.options.extractFII)continue;const b=C.slice(w.start,w.end+1,"image/jpeg");I.push(b)}t(I)}}}a+=2+s.getUint16(a+2)}})}}const Xb=async r=>{const e=$b(r);if(!e)throw new H0("Gain map XMP metadata not found");const n=await new qb({extractFII:!0,extractNonFII:!0}).extract(r);if(n.length!==2)throw new G0("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},Pp=r=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(r)});class Yb extends Jn{constructor(e,t){super(t),e&&(this._renderer=e),this._internalLoadingManager=new Qg}
vendor: 4,110 bytes, lines 4600-4604
4600setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=new Wb({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new nt,sdr:new nt});return new ad({width:16,height:16,type:Gt,colorSpace:it,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,n,i){const s=i?new Blob([i],{type:"image/jpeg"}):void 0,o=new Blob([n],{type:"image/jpeg"});let a,l,c=!1;if(typeof createImageBitmap>"u"){const d=await Promise.all([s?Pp(s):Promise.resolve(void 0),Pp(o)]);l=d[0],a=d[1],c=!0}else{const d=await Promise.all([s?createImageBitmap(s,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:"flipY"})]);l=d[0],a=d[1]}const h=new nt(l||new ImageData(2,2),Ir,Ct,Ct,Xe,Sd,_t,It,1,it);h.flipY=c,h.needsUpdate=!0;const u=new nt(a,Ir,Ct,Ct,Xe,Sd,_t,It,1,gt);u.flipY=c,u.needsUpdate=!0,e.width=a.width,e.height=a.height,e.material.gainMap=h,e.material.sdr=u,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class Kb extends Yb{load(e,t,n,i){const s=this.prepareQuadRenderer(),o=new Ei(this._internalLoadingManager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(this.withCredentials),this.manager.itemStart(e),o.load(e,async a=>{if(typeof a=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(a);let c,h,u;try{const d=await Xb(l);c=d.sdr,h=d.gainMap,u=d.metadata}catch(d){if(d instanceof H0||d instanceof G0)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l;else throw d}try{await this.render(s,u,c,h)}catch(d){this.manager.itemError(e),typeof i=="function"&&i(d),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,a=>{this.manager.itemError(e),typeof i=="function"&&i(a)}),s}}class Jb extends cC{constructor(e){super(e),this.type=Gt}parse(e){const o=function(b,v){switch(b){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(v||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(v||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(v||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(v||""))}},h=` 4601`,u=function(b,v,E){v=v||1024;let F=b.pos,R=-1,P=0,N="",G=String.fromCharCode.apply(null,new Uint16Array(b.subarray(F,F+128)));for(;0>(R=G.indexOf(h))&&P<v&&F<b.byteLength;)N+=G,P+=G.length,F+=128,G+=String.fromCharCode.apply(null,new Uint16Array(b.subarray(F,F+128)));return-1<R?(b.pos+=P+R+1,N+G.slice(0,R)):!1},d=function(b){const v=/^#\?(\S+)/,E=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,F=/^\s*FORMAT=(\S+)\s*$/,R=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,P={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let N,G;for((b.pos>=b.byteLength||!(N=u(b)))&&o(1,"no header found"),(G=N.match(v))||o(3,"bad initial token"),P.valid|=1,P.programtype=G[1],P.string+=N+` 4602`;N=u(b),N!==!1;){if(P.string+=N+` 4603`,N.charAt(0)==="#"){P.comments+=N+` 4604`;continue}if((G=N.match(E))&&(P.gamma=parseFloat(G[1])),(G=N.match(L))&&(P.exposure=parseFloat(G[1])),(G=N.match(F))&&
vendor: 1,996 bytes, line 4604
4604(P.valid|=2,P.format=G[1]),(G=N.match(R))&&(P.valid|=4,P.height=parseInt(G[1],10),P.width=parseInt(G[2],10)),P.valid&2&&P.valid&4)break}return P.valid&2||o(3,"missing format specifier"),P.valid&4||o(3,"missing image size specifier"),P},f=function(b,v,E){const L=v;if(L<8||L>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);L!==(b[2]<<8|b[3])&&o(3,"wrong scanline width");const F=new Uint8Array(4*v*E);F.length||o(4,"unable to allocate buffer space");let R=0,P=0;const N=4*L,G=new Uint8Array(4),$=new Uint8Array(N);let O=E;for(;O>0&&P<b.byteLength;){P+4>b.byteLength&&o(1),G[0]=b[P++],G[1]=b[P++],G[2]=b[P++],G[3]=b[P++],(G[0]!=2||G[1]!=2||(G[2]<<8|G[3])!=L)&&o(3,"bad rgbe scanline format");let X=0,q;for(;X<N&&P<b.byteLength;){q=b[P++];const ue=q>128;if(ue&&(q-=128),(q===0||X+q>N)&&o(3,"bad scanline data"),ue){const we=b[P++];for(let z=0;z<q;z++)$[X++]=we}else $.set(b.subarray(P,P+q),X),X+=q,P+=q}const ee=L;for(let ue=0;ue<ee;ue++){let we=0;F[R]=$[ue+we],we+=L,F[R+1]=$[ue+we],we+=L,F[R+2]=$[ue+we],we+=L,F[R+3]=$[ue+we],R+=4}O--}return F},m=function(b,v,E,L){const F=b[v+3],R=Math.pow(2,F-128)/255;E[L+0]=b[v+0]*R,E[L+1]=b[v+1]*R,E[L+2]=b[v+2]*R,E[L+3]=1},g=function(b,v,E,L){const F=b[v+3],R=Math.pow(2,F-128)/255;E[L+0]=na.toHalfFloat(Math.min(b[v+0]*R,65504)),E[L+1]=na.toHalfFloat(Math.min(b[v+1]*R,65504)),E[L+2]=na.toHalfFloat(Math.min(b[v+2]*R,65504)),E[L+3]=na.toHalfFloat(1)},A=new Uint8Array(e);A.pos=0;const p=d(A),x=p.width,_=p.height,S=f(A.subarray(A.pos),x,_);let C,I,w;switch(this.type){case Bt:w=S.length/4;const b=new Float32Array(w*4);for(let E=0;E<w;E++)m(S,E*4,b,E*4);C=b,I=Bt;break;case Gt:w=S.length/4;const v=new Uint16Array(w*4);for(let E=0;E<w;E++)g(S,E*4,v,E*4);C=v,I=Gt;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:x,height:_,data:C,header:p.string,gamma:p.gamma,exposure:p.exposure,type:I}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(o,a){switch(o.type){case Bt:case Gt:o.colorSpace
vendor: 4,824 bytes, lines 4604-4630
4604=it,o.minFilter=Xe,o.magFilter=Xe,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,a)}return super.load(e,s,n,i)}}/* @license 4605 * Copyright 2021 Google LLC. All Rights Reserved. 4606 * Licensed under the Apache License, Version 2.0 (the 'License'); 4607 * you may not use this file except in compliance with the License. 4608 * You may obtain a copy of the License at 4609 * 4610 * http://www.apache.org/licenses/LICENSE-2.0 4611 * 4612 * Unless required by applicable law or agreed to in writing, software 4613 * distributed under the License is distributed on an 'AS IS' BASIS, 4614 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4615 * See the License for the specific language governing permissions and 4616 * limitations under the License. 4617 */const jb={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},Zb={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class Up extends Hi{constructor(e){super(),this.position.y=-3.5;const t=new bs;t.deleteAttribute("uv");const n=new Bo({metalness:0,side:Ht}),i=new Bo({metalness:0}),s=e=="legacy"?jb:Zb,o=new Gg(16777215,s.topLight.intensity,28,2);o.position.set(...s.topLight.position),this.add(o);const a=new ot(t,n);a.position.set(...s.room.position),a.scale.set(...s.room.scale),this.add(a);for(const l of s.boxes){const c=new ot(t,i);c.position.set(...l.position),c.rotation.set(0,l.rotation,0),c.scale.set(...l.scale),this.add(c)}for(const l of s.lights){const c=new ot(t,this.createAreaLightMaterial(l.intensity));c.position.set(...l.position),c.scale.set(...l.scale),this.add(c)}}createAreaLightMaterial(e){const t=new xn;return t.color.setScalar(e),t}}/* @license 4618 * Copyright 2019 Google LLC. All Rights Reserved. 4619 * Licensed under the Apache License, Version 2.0 (the 'License'); 4620 * you may not use this file except in compliance with the License. 4621 * You may obtain a copy of the License at 4622 * 4623 * http://www.apache.org/licenses/LICENSE-2.0 4624 * 4625 * Unless required by applicable law or agreed to in writing, software 4626 * distributed under the License is distributed on an 'AS IS' BASIS, 4627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4628 * See the License for the specific language governing permissions and 4629 * limitations under the License. 4630 */const eT=.04,Zs=20,tT=/\.hdr(\.js)?$/;class Np{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return this._ldrLoader==null&&(this._ldrLoader=new kg),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return this._imageLoader==null&&(this._imageLoader=new Kb(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return this._hdrLoader==null&&(this._hdrLoader=new Jb,this._hdrLoader.setDataType(Gt)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}
vendor: 5,554 bytes, lines 4630-4693
4630async getLottieLoader(){if(this._lottieLoader==null){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise((n,i)=>this.ldrLoader.load(e,n,()=>{},i));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const n=await this.getLottieLoader();n.setQuality(t);const i=await new Promise((s,o)=>n.load(e,s,()=>{},o));return i.name=e,i}async loadEquirect(e,t=()=>{}){try{const n=tT.test(e),i=n?this.hdrLoader:this.imageLoader,s=await new Promise((o,a)=>i.load(e,l=>{const{renderTarget:c}=l;if(c!=null){const{texture:h}=c;l.dispose(!1),o(h)}else o(l)},l=>{t(l.loaded/l.total*.9)},a));return t(1),s.name=e,s.mapping=fl,n||(s.colorSpace=gt),s}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,n=()=>{}){const i=t!=="legacy";(t==="legacy"||t==="neutral")&&(t=null),t=t0(t);let s=Promise.resolve(null),o;e&&(s=this.loadEquirectFromUrl(e,n)),t?o=this.loadEquirectFromUrl(t,n):e?o=this.loadEquirectFromUrl(e,n):o=i?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[a,l]=await Promise.all([o,s]);if(a==null)throw new Error("Failed to load environment map.");return{environmentMap:a,skybox:l}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const n=this.loadEquirect(e,t);this.skyboxCache.set(e,n)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await sM();const n=this.threeRenderer,i=new $u(256,{generateMipmaps:!1,type:Gt,format:_t,colorSpace:it,depthBuffer:!0}),s=new cu(.1,100,i),o=s.renderTarget.texture;o.name=t;const a=n.outputColorSpace,l=n.toneMapping;return n.toneMapping=_i,n.outputColorSpace=it,s.update(n,e),this.blurCubemap(i,eT),n.toneMapping=l,n.outputColorSpace=a,o}async loadGeneratedEnvironmentMap(){return this.generatedEnvironmentMap==null&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new Up("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return this.generatedEnvironmentMapAlt==null&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new Up("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(this.blurMaterial==null){this.blurMaterial=this.getBlurShader(Zs);const i=new bs,s=new ot(i,this.blurMaterial);this.blurScene=new Hi,this.blurScene.add(s)}const n=e.clone();this.halfblur(e,n,t,"latitudinal"),this.halfblur(n,e,t,"longitudinal")}halfblur(e,t,n,i){const o=e.width,a=isFinite(n)?Math.PI/(2*o):2*Math.PI/(2*Zs-1),l=n/a,c=isFinite(n)?1+Math.floor(3*l):Zs;c>Zs&&console.warn(`sigmaRadians, ${n}, is too large and will clip, as it requested ${c} samples when the maximum is set to ${Zs}`);const h=[];let u=0;for(let m=0;m<Zs;++m){const g=m/l,A=Math.exp(-g*g/2);h.push(A),m==0?u+=A:m<c&&(u+=2*A)}for(let m=0;m<h.length;m++)h[m]=h[m]/u;const d=this.blurMaterial.uniforms;d.envMap.value=e.texture,d.samples.value=c,d.weights.value=h,d.latitudinal.value=i==="latitudinal",d.dTheta.value=a,new cu(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),n=new D(0,1,0);return new an({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:n}},vertexShader:` 4631 4632 varying vec3 vOutputDirection; 4633 4634 void main() { 4635 4636 vOutputDirection = vec3( position ); 4637 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4638 4639 } 4640 `,fragmentShader:` 4641 varying vec3 vOutputDirection; 4642 4643 uniform samplerCube envMap; 4644 uniform int samples; 4645 uniform float weights[ n ]; 4646 uniform bool latitudinal; 4647 uniform float dTheta; 4648 uniform vec3 poleAxis; 4649 4650 vec3 getSample( float theta, vec3 axis ) { 4651 4652 float cosTheta = cos( theta ); 4653 // Rodrigues' axis-angle rotation 4654 vec3 sampleDirection = vOutputDirection * cosTheta 4655 + cross( axis, vOutputDirection ) * sin( theta ) 4656 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 4657 4658 return vec3( textureCube( envMap, sampleDirection ) ); 4659 4660 } 4661 4662 void main() { 4663 4664 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 4665 4666 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 4667 4668 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 4669 4670 } 4671 4672 axis = normalize( axis ); 4673 4674 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 4675 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 4676 4677 for ( int i = 1; i < n; i++ ) { 4678 4679 if ( i >= samples ) { 4680 4681 break; 4682 4683 } 4684 4685 float theta = dTheta * float( i ); 4686 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 4687 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 4688 4689 } 4690 } 4691 `,blending:qn,depthTest:!1,depthWrite:!1,side:Ht})}async dispose(){for(const[,e]of this.skyboxCache)(await e).dispose();this.generatedEnvironmentMap!=null&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),this.generatedEnvironmentMapAlt!=null&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),this.blurMaterial!=null&&this.blurMaterial.dispose()}}/* @license 4692 * Copyright 2019 Google LLC. All Rights Reserved. 4693 * Licensed under the Apache License, Version 2.0 (the 'License');
4694 * you may not use this file except in compliance with the License. 4695 * You may obtain a copy of the License at 4696 * 4697 * http://www.apache.org/licenses/LICENSE-2.0 4698 * 4699 * Unless required by applicable law or agreed to in writing, software 4700 * distributed under the License is distributed on an 'AS IS' BASIS, 4701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4702 * See the License for the specific language governing permissions and 4703 * limitations under the License. 4704 */const nT=.2,uh=40,dh=60,Fp=5,er=[1,.79,.62,.5,.4,.31,.25],iT=3,Op="high-performance",sT=1.3;class Ln extends On{constructor(e){super(),this.loader=new Ut(Gb),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=iT,this.avgFrameDuration=(dh+uh)/2,this.onWebGLContextLost=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;(t=this.textureUtils)===null||t===void 0||t.dispose(),this.textureUtils=new Np(this.threeRenderer);for(const n of this.scenes)n.element[Il]()},this.dpr=vu(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new Yu({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=Rl}catch(t){console.warn(t)}this.arRenderer=new Fb(this),this.textureUtils=this.canRender?new Np(this.threeRenderer):null,Ut.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton||(this._singleton=new Ln({powerPreference:(self.ModelViewerElement||{}).powerPreference||Op,debug:vA()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Ln({powerPreference:(self.ModelViewerElement||{}).powerPreference||Op,debug:vA()});for(const t of e)t.connectedCallback()}get canRender(){return this.threeRenderer!=null}get scaleFactor(){return er[this.scaleStep]}set minScale(e){let t=1;for(;t<er.length&&!(er[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Se;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop((n,i)=>this.render(n,i))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&this.scenes.size===0&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Bu]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,n=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&s.externalRenderer==null&&++t,e.parentElement===s.canvas.parentElement&&(n=s)}const i=t>1;if(n!=null){const s=i&&!this.multipleScenesVisible,o=!n.element.modelIsVisible;if(s||o){const{width:a,height:l}=this.sceneSize(n);this.copyPixels(n,a,l),e.parentElement.removeChild(e)}}this.multipleScenesVisible=i}updateRendererSize(){var e;const t=vu();if(t!==this.dpr)for(const s of this.scenes){const{element:o}=s;o[hr](o.getBoundingClientRect())}let n=0,i=0;for(const s of this.scenes)n=Math.max(n,s.width),i=Math.max(i,s.height);if(!(n===this.width&&i===this.height&&t===this.dpr)){this.width=n,this.height=i,this.dpr=t,n=Math.ceil(n*t),i=Math.ceil(i*t),this.canRender&&this.threeRenderer.setSize(n,i,!1);for(const s of this.scenes){const{canvas:o}=s;o.width=n,o.height=i,s.forceRescale(),(e=s.effectRenderer)===null||e===void 0||e.setSize(n,i)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=zn(nT*(e-this.avgFrameDuration),-Fp,Fp),this.avgFrameDuration>dh?++this.scaleStep:this.avgFrameDuration<uh&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=(dh+uh)/2)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else if(e.scaleStep!=0)e.scaleStep=0,this.rescaleCanvas(e);else return!1;return!0}rescaleCanvas(e){const t=er[e.scaleStep],n=Math.ceil(this.width/t),i=Math.ceil(this.height/t),{style:s}=e.canvas;s.width=`${n}px`,s.height=`${i}px`,this.canvas3D.style.width=`${n}px`,this.canvas3D.style.height=`${i}px`;const o=this.dpr*t,a=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:o,minimumDpr:this.dpr*er[this.lastStep],pixelWidth:Math.ceil(e.width*o),pixelHeight:Math.ceil(e.height*o),reason:a}}))}sceneSize(e){const{dpr:t}=this,n=er[e.scaleStep],i=Math.min(Math.ceil(e.width*n*t),this.canvas3D.width),s=Math.min(Math.ceil(e.height*n*t),this.canvas3D.height);return{width:i,height:s}}
vendor: 8,666 bytes, lines 4704-4751
4704copyPixels(e,t,n){const i=e.context;if(i==null){console.log("could not acquire 2d context");return}i.clearRect(0,0,t,n),i.drawImage(this.canvas3D,0,0,t,n,0,0,t,n),e.canvas.classList.add("show")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const n of this.scenes)n.element.modelIsVisible===t&&e.push(n);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,n){const{element:i,exposure:s,toneMapping:o}=e;i[Xn](t,n);const a=typeof s=="number"&&!Number.isNaN(s),l=i.environmentImage,c=i.skyboxImage,h=o===Fu&&(l==="neutral"||l==="legacy"||!l&&!c);this.threeRenderer.toneMappingExposure=(a?s:1)*(h?sT:1)}render(e,t){if(t!=null){this.arRenderer.onWebXRFrame(e,t);return}const n=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(n),this.renderedLastFrame=!1);const{canvas3D:i}=this;for(const s of this.orderedScenes()){const{element:o}=s;if(!o.loaded||!o.modelIsVisible&&s.renderCount>0||(this.preRender(s,e,n),!this.shouldRender(s)))continue;if(s.externalRenderer!=null){const c=s.getCamera();c.updateMatrix();const{matrix:h,projectionMatrix:u}=c,d=h.elements.slice(),f=s.getTarget();d[12]+=f.x,d[13]+=f.y,d[14]+=f.z,s.externalRenderer.render({viewMatrix:d,projectionMatrix:u.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const c of this.scenes)c.element.modelIsVisible&&c.queueRender();const{width:a,height:l}=this.sceneSize(s);s.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-l,a,l),s.effectRenderer!=null?s.effectRenderer.render(n):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=s.toneMapping,this.threeRenderer.render(s,s.camera)),this.multipleScenesVisible||!s.element.modelIsVisible&&s.renderCount===0?this.copyPixels(s,a,l):i.parentElement!==s.canvas.parentElement&&(s.canvas.parentElement.appendChild(i),s.canvas.classList.remove("show")),s.hasRendered(),++s.renderCount,this.renderedLastFrame=!0}}dispose(){this.textureUtils!=null&&this.textureUtils.dispose(),this.threeRenderer!=null&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}/* @license 4705 * Copyright 2020 Google LLC. All Rights Reserved. 4706 * Licensed under the Apache License, Version 2.0 (the 'License'); 4707 * you may not use this file except in compliance with the License. 4708 * You may obtain a copy of the License at 4709 * 4710 * http://www.apache.org/licenses/LICENSE-2.0 4711 * 4712 * Unless required by applicable law or agreed to in writing, software 4713 * distributed under the License is distributed on an 'AS IS' BASIS, 4714 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4715 * See the License for the specific language governing permissions and 4716 * limitations under the License. 4717 */const Fe=Symbol("correlatedObjects"),Ke=Symbol("onUpdate");class Vo{constructor(e,t=null){this[Ke]=e,this[Fe]=t}}/* @license 4718 * Copyright 2020 Google LLC. All Rights Reserved. 4719 * Licensed under the Apache License, Version 2.0 (the 'License'); 4720 * you may not use this file except in compliance with the License. 4721 * You may obtain a copy of the License at 4722 * 4723 * http://www.apache.org/licenses/LICENSE-2.0 4724 * 4725 * Unless required by applicable law or agreed to in writing, software 4726 * distributed under the License is distributed on an 'AS IS' BASIS, 4727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4728 * See the License for the specific language governing permissions and 4729 * limitations under the License. 4730 */const Qp=new xn,rT=new Yn(2,2);let oT=0;const nn=Symbol("threeTexture"),kp=Symbol("threeTextures");class aT extends Vo{get[nn](){var e;return(e=this[Fe])===null||e===void 0?void 0:e.values().next().value}get[kp](){return this[Fe]}constructor(e,t){super(e,new Set(t?[t]:[])),this[nn].image.src||(this[nn].image.src=t.name?t.name:"adhoc_image"+oT++),this[nn].image.name||(this[nn].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[nn].image.name||""}get uri(){return this[nn].image.src}get bufferView(){return this[nn].image.bufferView}get element(){const e=this[nn];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[nn];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return this.uri!=null?"external":"embedded"}set name(e){for(const t of this[kp])t.image.name=e}update(){const e=this[nn];e&&e.isCanvasTexture&&!e.animation&&(this[nn].needsUpdate=!0,this[Ke]())}async createThumbnail(e,t){const n=new Hi;Qp.map=this[nn];const i=new ot(rT,Qp);n.add(i);const s=new Ur(-1,1,1,-1,0,1),{threeRenderer:o}=Ln.singleton,a=new In(e,t);o.setRenderTarget(a),o.render(n,s),o.setRenderTarget(null);const l=new Uint8Array(e*t*4);o.readRenderTargetPixels(a,0,0,e,t,l),ki.width=e,ki.height=t;const c=ki.getContext("2d"),h=c.createImageData(e,t);return h.data.set(l),c.putImageData(h,0,0),new Promise(async(u,d)=>{ki.toBlob(f=>{if(!f)return d("Failed to capture thumbnail.");u(URL.createObjectURL(f))},"image/png")})}}var Qt;(function(r){r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.NearestMipmapNearest=9984]="NearestMipmapNearest",r[r.LinearMipmapNearest=9985]="LinearMipmapNearest",r[r.NearestMipmapLinear=9986]="NearestMipmapLinear",r[r.LinearMipmapLinear=9987]="LinearMipmapLinear"})(Qt||(Qt={}));var Gi;(function(r){r[r.ClampToEdge=33071]="ClampToEdge",r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.Repeat=10497]="Repeat"})(Gi||(Gi={}));/* @license 4731 * Copyright 2020 Google LLC. All Rights Reserved. 4732 * Licensed under the Apache License, Version 2.0 (the 'License'); 4733 * you may not use this file except in compliance with the License. 4734 * You may obtain a copy of the License at 4735 * 4736 * http://www.apache.org/licenses/LICENSE-2.0 4737 * 4738 * Unless required by applicable law or agreed to in writing, software 4739 * distributed under the License is distributed on an 'AS IS' BASIS, 4740 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4741 * See the License for the specific language governing permissions and 4742 * limitations under the License. 4743 */const Gp=new Map([[Gi.Repeat,Fn],[Gi.ClampToEdge,Ct],[Gi.MirroredRepeat,vs]]),Cu=new Map([[Fn,Gi.Repeat],[Ct,Gi.ClampToEdge],[vs,Gi.MirroredRepeat]]),lT=new Map([[Qt.Nearest,Tt],[Qt.Linear,Xe],[Qt.NearestMipmapNearest,No],[Qt.LinearMipmapNearest,gs],[Qt.NearestMipmapLinear,Fi],[Qt.LinearMipmapLinear,on]]),V0=new Map([[Tt,Qt.Nearest],[Xe,Qt.Linear],[No,Qt.NearestMipmapNearest],[gs,Qt.LinearMipmapNearest],[Fi,Qt.NearestMipmapLinear],[on,Qt.LinearMipmapLinear]]),cT=new Map([[Qt.Nearest,Tt],[Qt.Linear,Xe]]),z0=new Map([[Tt,Qt.Nearest],[Xe,Qt.Linear]]),hT=r=>V0.has(r),uT=r=>z0.has(r),dT=r=>Cu.has(r),fT=(r,e)=>{switch(r){case"minFilter":return hT(e);case"magFilter":return uT(e);case"wrapS":case"wrapT":return dT(e);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${r}" on Sampler`)}},li=Symbol("threeTexture"),Hp=Symbol("threeTextures"),Ti=Symbol("setProperty");class AT extends Vo{get[li](){var e;return(e=this[Fe])===null||e===void 0?void 0:e.values().next().value}get[Hp](){return this[Fe]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[li].name||""}get minFilter(){return V0.get(this[li].minFilter)}get magFilter(){return z0.get(this[li].magFilter)}get wrapS(){return Cu.get(this[li].wrapS)}get wrapT(){return Cu.get(this[li].wrapT)}get rotation(){return this[li].rotation}get scale(){return Ru(this[li].repeat)}get offset(){return Ru(this[li].offset)}setMinFilter(e){this[Ti]("minFilter",lT.get(e))}setMagFilter(e){this[Ti]("magFilter",cT.get(e))}setWrapS(e){this[Ti]("wrapS",Gp.get(e))}setWrapT(e){this[Ti]("wrapT",Gp.get(e))}setRotation(e){e==null&&(e=0),this[Ti]("rotation",e)}setScale(e){e==null&&(e={u:1,v:1}),this[Ti]("repeat",new Se(e.u,e.v))}setOffset(e){e==null&&(e={u:0,v:0}),this[Ti]("offset",new Se(e.u,e.v))}[Ti](e,t){if(fT(e,t))for(const n of this[Hp])n[e]=t,n.needsUpdate=!0;this[Ke]()}}/* @license 4744 * Copyright 2020 Google LLC. All Rights Reserved. 4745 * Licensed under the Apache License, Version 2.0 (the 'License'); 4746 * you may not use this file except in compliance with the License. 4747 * You may obtain a copy of the License at 4748 * 4749 * http://www.apache.org/licenses/LICENSE-2.0 4750 * 4751 * Unless required by applicable law or agreed to in writing, softw
4751are 4752 * distributed under the License is distributed on an 'AS IS' BASIS, 4753 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4754 * See the License for the specific language governing permissions and 4755 * limitations under the License. 4756 */const Vp=Symbol("image"),zp=Symbol("sampler"),Wp=Symbol("threeTexture");class W0 extends Vo{constructor(e,t){super(e,new Set(t?[t]:[])),this[zp]=new AT(e,t),this[Vp]=new aT(e,t)}get[Wp](){var e;return(e=this[Fe])===null||e===void 0?void 0:e.values().next().value}get name(){return this[Wp].name||""}set name(e){for(const t of this[Fe])t.name=e}get sampler(){return this[zp]}get source(){return this[Vp]}}/* @license 4757 * Copyright 2020 Google LLC. All Rights Reserved. 4758 * Licensed under the Apache License, Version 2.0 (the 'License'); 4759 * you may not use this file except in compliance with the License. 4760 * You may obtain a copy of the License at 4761 * 4762 * http://www.apache.org/licenses/LICENSE-2.0 4763 * 4764 * Unless required by applicable law or agreed to in writing, software 4765 * distributed under the License is distributed on an 'AS IS' BASIS, 4766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4767 * See the License for the specific language governing permissions and 4768 * limitations under the License. 4769 */var $0,q0,X0;const ls=Symbol("texture"),cs=Symbol("transform"),fh=Symbol("materials"),$p=Symbol("usage"),tr=Symbol("onUpdate"),yo=Symbol("activeVideo");var xe;(function(r){r[r.Base=0]="Base",r[r.MetallicRoughness=1]="MetallicRoughness",r[r.Normal=2]="Normal",r[r.Occlusion=3]="Occlusion",r[r.Emissive=4]="Emissive",r[r.Clearcoat=5]="Clearcoat",r[r.ClearcoatRoughness=6]="ClearcoatRoughness",r[r.ClearcoatNormal=7]="ClearcoatNormal",r[r.SheenColor=8]="SheenColor",r[r.SheenRoughness=9]="SheenRoughness",r[r.Transmission=10]="Transmission",r[r.Thickness=11]="Thickness",r[r.Specular=12]="Specular",r[r.SpecularColor=13]="SpecularColor",r[r.Iridescence=14]="Iridescence",r[r.IridescenceThickness=15]="IridescenceThickness",r[r.Anisotropy=16]="Anisotropy"})(xe||(xe={}));class gr{constructor(e,t,n,i){this[$0]=null,this[q0]={rotation:0,scale:new Se(1,1),offset:new Se(0,0)},this[X0]=!1,n&&(this[cs].rotation=n.rotation,this[cs].scale.copy(n.repeat),this[cs].offset.copy(n.offset),this[ls]=new W0(e,n)),this[tr]=e,this[fh]=i,this[$p]=t}get texture(){return this[ls]}setTexture(e){var t,n;
vendor: 4,211 bytes, lines 4769-4795
4769const i=e!=null?e.source[nn]:null,s=(t=this[ls])===null||t===void 0?void 0:t.source[nn];if(s!=null&&s.isVideoTexture?this[yo]=!1:!((n=this[ls])===null||n===void 0)&&n.source.animation&&this[ls].source.animation.removeEventListener("enterFrame",this[tr]),this[ls]=e,i!=null&&i.isVideoTexture){const a=i.image;if(this[yo]=!0,a.requestVideoFrameCallback!=null){const l=()=>{this[yo]&&(this[tr](),a.requestVideoFrameCallback(l))};a.requestVideoFrameCallback(l)}else{const l=()=>{this[yo]&&(this[tr](),requestAnimationFrame(l))};requestAnimationFrame(l)}}else e?.source.animation!=null&&e.source.animation.addEventListener("enterFrame",this[tr]);let o=gt;if(this[fh])for(const a of this[fh]){switch(this[$p]){case xe.Base:a.map=i;break;case xe.MetallicRoughness:o=it,a.metalnessMap=i,a.roughnessMap=i;break;case xe.Normal:o=it,a.normalMap=i;break;case xe.Occlusion:o=it,a.aoMap=i;break;case xe.Emissive:a.emissiveMap=i;break;case xe.Clearcoat:a.clearcoatMap=i;break;case xe.ClearcoatRoughness:a.clearcoatRoughnessMap=i;break;case xe.ClearcoatNormal:a.clearcoatNormalMap=i;break;case xe.SheenColor:a.sheenColorMap=i;break;case xe.SheenRoughness:a.sheenRoughnessMap=i;break;case xe.Transmission:a.transmissionMap=i;break;case xe.Thickness:a.thicknessMap=i;break;case xe.Specular:a.specularIntensityMap=i;break;case xe.SpecularColor:a.specularColorMap=i;break;case xe.Iridescence:a.iridescenceMap=i;break;case xe.IridescenceThickness:a.iridescenceThicknessMap=i;break;case xe.Anisotropy:a.anisotropyMap=i;break}a.needsUpdate=!0}i&&(i.colorSpace=o,i.rotation=this[cs].rotation,i.repeat=this[cs].scale,i.offset=this[cs].offset),this[tr]()}}$0=ls,q0=cs,X0=yo;/* @license 4770 * Copyright 2020 Google LLC. All Rights Reserved. 4771 * Licensed under the Apache License, Version 2.0 (the 'License'); 4772 * you may not use this file except in compliance with the License. 4773 * You may obtain a copy of the License at 4774 * 4775 * http://www.apache.org/licenses/LICENSE-2.0 4776 * 4777 * Unless required by applicable law or agreed to in writing, software 4778 * distributed under the License is distributed on an 'AS IS' BASIS, 4779 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4780 * See the License for the specific language governing permissions and 4781 * limitations under the License. 4782 */const oo=Symbol("threeMaterial"),Fa=Symbol("threeMaterials"),qp=Symbol("baseColorTexture"),Xp=Symbol("metallicRoughnessTexture");class pT extends Vo{constructor(e,t){super(e,t);const{map:n,metalnessMap:i}=t.values().next().value;this[qp]=new gr(e,xe.Base,n,t),this[Xp]=new gr(e,xe.MetallicRoughness,i,t)}get[Fa](){return this[Fe]}get[oo](){var e;return(e=this[Fe])===null||e===void 0?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[oo].opacity];return this[oo].color.toArray(e),e}get metallicFactor(){return this[oo].metalness}get roughnessFactor(){return this[oo].roughness}get baseColorTexture(){return this[qp]}get metallicRoughnessTexture(){return this[Xp]}setBaseColorFactor(e){const t=new Ce;e instanceof Array?t.fromArray(e):t.set(e);for(const n of this[Fa])n.color.set(t),e instanceof Array&&e.length>3?n.opacity=e[3]:(e=[0,0,0,n.opacity],t.toArray(e));this[Ke]()}setMetallicFactor(e){for(const t of this[Fa])t.metalness=e;this[Ke]()}setRoughnessFactor(e){for(const t of this[Fa])t.roughness=e;this[Ke]()}}/* @license 4783 * Copyright 2020 Google LLC. All Rights Reserved. 4784 * Licensed under the Apache License, Version 2.0 (the 'License'); 4785 * you may not use this file except in compliance with the License. 4786 * You may obtain a copy of the License at 4787 * 4788 * http://www.apache.org/licenses/LICENSE-2.0 4789 * 4790 * Unless required by applicable law or agreed to in writing, software 4791 * distributed under the License is distributed on an 'AS IS' BASIS, 4792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4793 * See the License for the specific language governing permissions and 4794 * limitations under the License. 4795 */var Yp,Kp;const Jp=Symbol("pbrMetallicRoughness"),jp=Symbol("normalTexture"),Zp=Symbol("occlusionTexture"),em=Symbol("emissiveTexture"),ht=Symbol("backingThreeMaterial"),tm=Symbol("applyAlphaCutoff"),Ah=Symbol("getAlphaMode"),nr=Symbol("lazyLoadGLTFInfo"),ph=Symbol("initialize"),Mu
vendor: 5,396 bytes, lines 4795-4796
4795=Symbol("getLoadedMaterial"),ce=Symbol("ensureMaterialIsLoaded"),nm=Symbol("gltfIndex"),xo=Symbol("setActive"),al=Symbol("variantIndices"),mh=Symbol("isActive"),ll=Symbol("variantSet"),im=Symbol("modelVariants"),gh=Symbol("name"),rn=Symbol("pbrTextures");class _h extends Vo{constructor(e,t,n,i,s,o,a=void 0){super(e,s),this[Yp]=new Set,this[Kp]=new Map,this[nm]=t,this[mh]=n,this[im]=i,this[gh]=o,a==null?this[ph]():this[nr]=a}get[(Yp=ll,Kp=rn,ht)](){return this[Fe].values().next().value}[ph](){const e=this[Ke],t=this[Fe];this[Jp]=new pT(e,t);const{normalMap:n,aoMap:i,emissiveMap:s}=t.values().next().value;this[jp]=new gr(e,xe.Normal,n,t),this[Zp]=new gr(e,xe.Occlusion,i,t),this[em]=new gr(e,xe.Emissive,s,t);const o=a=>{this[rn].set(a,new gr(e,a,null,t))};o(xe.Clearcoat),o(xe.ClearcoatRoughness),o(xe.ClearcoatNormal),o(xe.SheenColor),o(xe.SheenRoughness),o(xe.Transmission),o(xe.Thickness),o(xe.Specular),o(xe.SpecularColor),o(xe.Iridescence),o(xe.IridescenceThickness),o(xe.Anisotropy)}async[Mu](){if(this[nr]!=null){const{set:e,material:t}=await this[nr].doLazyLoad();return this[Fe]=e,this[ph](),this[nr]=void 0,this.ensureLoaded=async()=>{},t}return this[Fe].values().next().value}colorFromRgb(e){const t=new Ce;return e instanceof Array?t.fromArray(e):t.set(e),t}[ce](){if(this[nr]!=null)throw new Error(`Material "${this.name}" has not been loaded, call 'await 4796 myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Mu]()}get isLoaded(){return this[nr]==null}get isActive(){return this[mh]}[xo](e){this[mh]=e}get name(){return this[gh]||""}set name(e){if(this[gh]=e,this[Fe]!=null)for(const t of this[Fe])t.name=e}get pbrMetallicRoughness(){return this[ce](),this[Jp]}get normalTexture(){return this[ce](),this[jp]}get occlusionTexture(){return this[ce](),this[Zp]}get emissiveTexture(){return this[ce](),this[em]}get emissiveFactor(){return this[ce](),this[ht].emissive.toArray()}get index(){return this[nm]}[al](){return this[ll]}hasVariant(e){const t=this[im].get(e);return t!=null&&this[ll].has(t.index)}setEmissiveFactor(e){this[ce]();const t=this.colorFromRgb(e);for(const n of this[Fe])n.emissive.set(t);this[Ke]()}[Ah](){return this[ht].transparent?"BLEND":this[ht].alphaTest>0?"MASK":"OPAQUE"}[tm](){this[ce]();for(const e of this[Fe])this[Ah]()==="MASK"?e.alphaTest==null&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[ce]();for(const t of this[Fe])t.alphaTest=e,t.needsUpdate=!0;this[tm](),this[Ke]()}getAlphaCutoff(){return this[ce](),this[ht].alphaTest}setDoubleSided(e){this[ce]();for(const t of this[Fe])t.side=e?Yt:Nn,t.needsUpdate=!0;this[Ke]()}getDoubleSided(){return this[ce](),this[ht].side==Yt}setAlphaMode(e){this[ce]();const t=(n,i)=>{n.transparent=i,n.depthWrite=!i};for(const n of this[Fe])t(n,e==="BLEND"),e==="MASK"?n.alphaTest=.5:n.alphaTest=void 0,n.needsUpdate=!0;this[Ke]()}getAlphaMode(){return this[ce](),this[Ah]()}get emissiveStrength(){return this[ce](),this[ht].emissiveIntensity}setEmissiveStrength(e){this[ce]();for(const t of this[Fe])t.emissiveIntensity=e;this[Ke]()}get clearcoatFactor(){return this[ce](),this[ht].clearcoat}get clearcoatRoughnessFactor(){return this[ce](),this[ht].clearcoatRoughness}get clearcoatTexture(){return this[ce](),this[rn].get(xe.Clearcoat)}get clearcoatRoughnessTexture(){return this[ce](),this[rn].get(xe.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[ce](),this[rn].get(xe.ClearcoatNormal)}get clearcoatNormalScale(){return this[ce](),this[ht].clearcoatNormalScale.x}setClearcoatFactor(e){this[ce]();for(const t of this[Fe])t.clearcoat=e;this[Ke]()}setClearcoatRoughnessFactor(e){this[ce]();for(const t of this[Fe])t.clearcoatRoughness=e;this[Ke]()}setClearcoatNormalScale(e){this[ce]();for(const t of this[Fe])t.clearcoatNormalScale=new Se(e,e);this[Ke]()}get ior(){return this[ce](),this[ht].ior}setIor(e){this[ce]();for(const t of this[Fe])t.ior=e;this[Ke]()}get sheenColorFactor(){return this[ce](),this[ht].sheenColor.toArray()}get sheenColorTexture(){return this[ce](),this[rn].get(xe.SheenColor)}get sheenRoughnessFactor(){return this[ce](),this[ht].sheenRoughness}get sheenRoughnessTexture(){return this[ce](),this[rn].get(xe.SheenRoughness)}setSheenColorFactor(e){this[ce]();const t=this.colorFromRgb(e);for(const n of this[Fe])n.sheenColor.set(t),n.sheen=1;this[Ke]()}setSheenRoughnessFactor(e){this[ce]();for(const t of this[Fe])t.sheenRoughness=e,t.sheen=1;this[Ke]()}get transmissionFactor(){return this[ce](),this[ht].transmission}get transmissionTexture(){return this[ce](),this[rn].get(xe.Transmission)}setTransmissionFactor(e){this[ce]();for(const t of this[Fe])t.transmission=e;this[Ke]()}get thicknessFactor(){return this[ce](),this[ht].thickness}get thicknessTexture(){return this[ce](),this[rn].get(xe.Thickness)}get attenuationDistance(){return this[ce](),this[ht].attenuationDistance}get attenuationColor(){return this[ce](),this[ht].attenuationColor.toArray()}setThicknessFactor(e){this[ce]();for(const t of this[Fe])t.thickness=e;this[Ke]()}setAttenuationDistance(e){this[ce]();for(const t of this[Fe])t.attenuationDistance=e;this[Ke]()}setAttenuationColor(e){this[ce]();const t=this.colorFromRgb(e);for(const n of this[Fe])n.attenuationColor.set(t);this[Ke]()}get specularFactor(){return this[ce](),this[ht].specularIntensity}get specularTexture(){return this[ce](),this[rn].get(xe.Specular)}
4796get specularColorFactor(){return this[ce](),this[ht].specularColor.toArray()}get specularColorTexture(){return this[ce](),this[rn].get(xe.SheenColor)}setSpecularFactor(e){this[ce]();for(const t of this[Fe])t.specularIntensity=e;this[Ke]()}setSpecularColorFactor(e){this[ce]();const t=this.colorFromRgb(e);for(const n of this[Fe])n.specularColor.set(t);this[Ke]()}get iridescenceFactor(){return this[ce](),this[ht].iridescence}get iridescenceTexture(){return this[ce](),this[rn].get(xe.Iridescence)}get iridescenceIor(){return this[ce](),this[ht].iridescenceIOR}get iridescenceThicknessMinimum(){return this[ce](),this[ht].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[ce](),this[ht].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[ce](),this[rn].get(xe.IridescenceThickness)}setIridescenceFactor(e){this[ce]();for(const t of this[Fe])t.iridescence=e;this[Ke]()}setIridescenceIor(e){this[ce]();for(const t of this[Fe])t.iridescenceIOR=e;this[Ke]()}setIridescenceThicknessMinimum(e){this[ce]();for(const t of this[Fe])t.iridescenceThicknessRange[0]=e;this[Ke]()}setIridescenceThicknessMaximum(e){this[ce]();for(const t of this[Fe])t.iridescenceThicknessRange[1]=e;this[Ke]()}get anisotropyStrength(){return this[ce](),this[ht].anisotropy}get anisotropyRotation(){return this[ce](),this[ht].anisotropyRotation}get anisotropyTexture(){return this[ce](),this[rn].get(xe.Anisotropy)}setAnisotropyStrength(e){this[ce]();for(const t of this[Fe])t.anisotropy=e;this[Ke]()}setAnisotropyRotation(e){this[ce]();for(const t of this[Fe])t.anisotropyRotation=e;this[Ke]()}}class Y0{constructor(e){this.name="",this.children=new Array,this.name=e}}class Eh extends Y0{constructor(e,t,n,i){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:s,threeGLTF:o,threeObjectMap:a}=i;this.parser=o.parser,this.modelVariants=n,this.mesh.userData.variantData=n;const l=a.get(e.material);l.materials!=null?this.initialMaterialIdx=this.activeMaterialIdx=l.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const c=e.userData.associations||{};if(c.meshes==null){console.error("Mesh is missing primitive index association");return}const d=((s.meshes||[])[c.meshes].primitives||[])[c.primitives];if(d==null){console.error("Mesh primitive definition is missing.");return}if(d.material!=null)this.materials.set(d.material,t[d.material]);else{const f=t.findIndex(m=>m.name==="Default");f>=0?this.materials.set(f,t[f]):console.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const f=d.extensions.KHR_materials_variants,g=o.parser.json.extensions.KHR_materials_variants.variants;for(const A of f.mappings){const p=t[A.material];this.materials.set(A.material,p);for(const x of A.variants){const{name:_}=g[x];this.variantToMaterialMap.set(x,p),p[al]().add(x),n.has(_)||n.set(_,{name:_,index:x})}}}}async setActiveMaterial(e){const t=this.materials.get(e);if(t!=null&&e!==this.activeMaterialIdx){this.mesh.material=await t[Mu]();const{normalScale:n}=this.mesh.material;n!=null&&n.y*n.x<0!=(this.mesh.geometry.attributes.tangent==null)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(e==null)return this.setActiveMaterial(this.initialMaterialIdx);if(this.variantToMaterialMap!=null&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(this.variantToMaterialMap!=null&&e!=null){const t=this.variantToMaterialMap.get(e);if(t!=null)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(this.variantToMaterialMap!=null)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(t.material!=null)continue;const n=await this.enableVariantHelper(e);n!=null&&(t.material=n)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const i=this.modelVariants.get(t).index;return e[al]().add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateV
vendor: 5,066 bytes, lines 4796-4812
4796ariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;t?.delete(e)}}updateVariantUserData(e,t){t[al]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map,this.mesh.userData.variantMaterials.set(e,{material:t[Fe].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return t!=null&&this.variantInfo.has(t.index)?(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1):!0}}/* @license 4797 * Copyright 2020 Google LLC. All Rights Reserved. 4798 * Licensed under the Apache License, Version 2.0 (the 'License'); 4799 * you may not use this file except in compliance with the License. 4800 * You may obtain a copy of the License at 4801 * 4802 * http://www.apache.org/licenses/LICENSE-2.0 4803 * 4804 * Unless required by applicable law or agreed to in writing, software 4805 * distributed under the License is distributed on an 'AS IS' BASIS, 4806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4807 * See the License for the specific language governing permissions and 4808 * limitations under the License. 4809 */var sm,rm,om,am,lm,cm;const is=Symbol("materials"),Oa=Symbol("hierarchy"),hm=Symbol("roots"),ci=Symbol("primitives"),K0=Symbol("prepareVariantsForExport"),J0=Symbol("switchVariant"),j0=Symbol("materialFromPoint"),wu=Symbol("nodeFromPoint"),Z0=Symbol("nodeFromIndex"),qt=Symbol("variantData"),bu=Symbol("availableVariants"),vh=Symbol("modelOnUpdate"),um=Symbol("cloneMaterial");class mT{constructor(e,t,n,i){this.gltf=e,this.gltfElementMap=t,this.mapKey=n,this.doLazyLoad=i}}class gT{constructor(e,t=()=>{}){this[sm]=new Array,this[rm]=new Array,this[om]=new Array,this[am]=new Array,this[lm]=()=>{},this[cm]=new Map,this[vh]=t;const{gltf:n,threeGLTF:i,gltfElementMap:s}=e;for(const[l,c]of n.materials.entries()){const h=s.get(c);if(h!=null)this[is].push(new _h(t,l,!0,this[qt],h,c.name));else{const d=(n.materials||[])[l],f=l,m=async()=>{const g=await i.parser.getDependency("material",f),A=new Set;return s.set(d,A),A.add(g),{set:A,material:g}};this[is].push(new _h(t,l,!1,this[qt],h,c.name,new mT(n,s,d,m)))}}const o=new Map,a=new Array;for(const l of i.scene.children)a.push(l);for(;a.length>0;){const l=a.pop();let c=null;l instanceof ot?(c=new Eh(l,this.materials,this[qt],e),this[ci].push(c)):c=new Y0(l.name);const h=o.get(l);h!=null?h.children.push(c):this[hm].push(c),this[Oa].push(c);for(const u of l.children)a.push(u),o.set(l,c)}}get materials(){return this[is]}[(sm=is,rm=Oa,om=hm,am=ci,lm=vh,cm=qt,bu)](){const e=Array.from(this[qt].values());return e.sort((t,n)=>t.index-n.index),e.map(t=>t.name)}getMaterialByName(e){const t=this[is].filter(n=>n.name===e);return t.length>0?t[0]:null}[Z0](e,t){const n=this[Oa].find(i=>{if(i instanceof Eh){const{meshes:s,primitives:o}=i.mesh.userData.associations;if(s==e&&o==t)return!0}return!1});return n??null}[wu](e){return this[Oa].find(t=>t instanceof Eh&&t.mesh===e.object)}[j0](e){return this[wu](e).getActiveMaterial()}async[J0](e){for(const t of this[ci])await t.enableVariant(e);for(const t of this.materials)t[xo](!1);for(const t of this[ci])this.materials[t.getActiveMaterial().index][xo](!0)}async[K0](){const e=new Array;for(const t of this[ci])e.push(t.instantiateVariants());await Promise.all(e)}[um](e,t){const n=this.materials[e];n.isLoaded||console.error(`Cloning an unloaded material, 4810 call 'material.ensureLoaded() before cloning the material.`);const i=n[Fe],s=new Set;for(const[a,l]of i.entries()){const c=l.clone();c.name=t+(i.size>1?"_inst"+a:""),s.add(c)}const o=new _h(this[vh],this[is].length,!1,this[qt],s,t);return this[is].push(o),o}createMaterialInstanceForVariant(e,t,n,i=!0){let s=null;for(const o of this[ci]){const a=this[qt].get(n);a!=null&&o.variantInfo.has(a.index)||o.getMaterial(e)!=null&&(this.hasVariant(n)||this.createVariant(n),s==null&&(s=this[um](e,t)),o.addVariant(s,n))}if(i&&s!=null){s[xo](!0),this.materials[e][xo](!1);for(const o of this[ci])o.enableVariant(n)}return s}createVariant(e){this[qt].has(e)?console.warn(`Variant '${e}'' already exists`):this[qt].set(e,{name:e,index:this[qt].size})}hasVariant(e){return this[qt].has(e)}setMaterialToVariant(e,t){if(this[bu]().find(n=>n===t)==null){console.warn(`Can't add material to '${t}', the variant does not exist.'`);return}if(e<0||e>=this.materials.length){console.error("setMaterialToVariant(): materialIndex is out of bounds.");return}for(const n of this[ci]){const i=n.getMaterial(e);i!=null&&n.addVariant(i,t)}}updateVariantName(e,t){const n=this[qt].get(e);n!=null&&(n.name=t,this[qt].set(t,n),this[qt].delete(e))}deleteVariant(e){const t=this[qt].get(e);if(t!=null){for(const n of this.materials)n.hasVariant(e)&&n[ll].delete(t.index);for(const n of this[ci])n.deleteVariant(t.index);this[qt].delete(e)}}}/* @license 4811 * Copyright 2020 Google LLC. All Rights Reserved. 4812 * Licensed under the Apache License, Version 2.0 (the 'License');
4813 * you may not use this file except in compliance with the License. 4814 * You may obtain a copy of the License at 4815 * 4816 * http://www.apache.org/licenses/LICENSE-2.0 4817 * 4818 * Unless required by applicable law or agreed to in writing, software 4819 * distributed under the License is distributed on an 'AS IS' BASIS, 4820 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4821 * See the License for the specific language governing permissions and 4822 * limitations under the License. 4823 */var yh=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const cl=Symbol("currentGLTF"),hl=Symbol("originalGltfJson"),hs=Symbol("model"),xh=Symbol("getOnUpdateMethod"),ao=Symbol("buildTexture"),_T=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this[e]=void 0,this[t]=null,this[n]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[hs]}get availableVariants(){return this.model?this.model[bu]():[]}get originalGltfJson(){return this[hl]}[(e=hs,t=cl,n=hl,xh)](){return()=>{this[Kt]()}}[ao](o){return o.colorSpace=gt,o.wrapS=Fn,o.wrapT=Fn,new W0(this[xh](),o)}async createTexture(o,a="image/png"){const{textureUtils:l}=this[je],c=await l.loadImage(o);return c.userData.mimeType=a,this[ao](c)}async createLottieTexture(o,a=1){const{textureUtils:l}=this[je],c=await l.loadLottie(o,a);return this[ao](c)}createVideoTexture(o){const a=document.createElement("video");a.crossOrigin=this.withCredentials?"use-credentials":"anonymous",a.src=o,a.muted=!0,a.playsInline=!0,a.loop=!0,a.play();const l=new KI(a);return this[ao](l)}createCanvasTexture(){const o=document.createElement("canvas"),a=new Ug(o);return this[ao](a)}async updated(o){if(super.updated(o),o.has("variantName")){const a=this[Cs].beginActivity("variant-update");a(.1);const l=this[hs],{variantName:c}=this;l!=null&&(await l[J0](c),this[Kt](),this.dispatchEvent(new CustomEvent("variant-applied"))),a(1)}if(o.has("orientation")||o.has("scale")){if(!this.loaded)return;const a=this[te];a.applyTransform(),a.updateBoundingBox(),a.updateShadow(),this[je].arRenderer.onUpdateScene(),this[Kt]()}}[zi](){super[zi]();const{currentGLTF:o}=this[te];if(o!=null){const{correlatedSceneGraph:a}=o;a!=null&&o!==this[cl]&&(this[hs]=new gT(a,this[xh]()),this[hl]=JSON.parse(JSON.stringify(a.gltf))),"variants"in o.userData&&this.requestUpdate("variantName")}this[cl]=o}async exportScene(o){const a=this[te];return new Promise(async(l,c)=>{const h={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(h,o),h.animations=a.animations,h.truncateDrawRange=!0;const u=a.shadow;let d=!1;u!=null&&(d=u.visible,u.visible=!1),await this[hs][K0](),new od().register(m=>new kw(m)).parse(a.model,m=>l(new Blob([h.binary?m:JSON.stringify(m)],{type:h.binary?"application/octet-stream":"application/json"})),()=>c("glTF export failed"),h),u!=null&&(u.visible=d)})}materialFromPoint(o,a){const l=this[hs];if(l==null)return null;const c=this[te],h=c.getNDC(o,a),u=c.hitFromPoint(h);return u==null||u.face==null?null:l[j0](u)}}return yh([ve({type:String,attribute:"variant-name"})],i.prototype,"variantName",void 0),yh([ve({type:String,attribute:"orientation"})],i.prototype,"orientation",void 0),yh([ve({type:String,attribute:"scale"})],i.prototype,"scale",void 0),i};/* @license 4824 * Copyright 2023 Google LLC. All Rights Reserved. 4825 * Licensed under the Apache License, Version 2.0 (the 'License'); 4826 * you may not use this file except in compliance with the License. 4827 * You may obtain a copy of the License at 4828 * 4829 * http://www.apache.org/licenses/LICENSE-2.0 4830 * 4831 * Unless required by applicable law or agreed to in writing, software 4832 * distributed under the License is distributed on an 'AS IS' BASIS, 4833 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4834 * See the License for the specific language governing permissions and 4835 * limitations under the License. 4836 */class ET extends ot{constructor(){super(void 0,new xn({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&this.geometry!=null&&this.map!=null}updateGeometry(e=this.height,t=this.radius,n=128){(e!=this.height||t!=this.radius||n!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=n,e>0&&t>0&&(this.geometry.dispose(),this.geometry=vT(e,t,n)))}}function vT(r,e,t){const n=new Zu(e,2*t,t);n.scale(1,1,-1);const i=n.getAttribute("position"),s=new D;for(let o=0;o<i.count;++o)if(s.fromBufferAttribute(i,o),s.y<0){const a=-r*3/2,l=s.y<a?-r/s.y:1-s.y*s.y/(3*a*a);s.multiplyScalar(l),s.toArray(i.array,3*o)}return i.needsUpdate=!0,n}/* @license 4837 * Copyright 2020 Google LLC. All Rights Reserved. 4838 * Licensed under the Apache License, Version 2.0 (the 'License');
4839 * you may not use this file except in compliance with the License. 4840 * You may obtain a copy of the License at 4841 * 4842 * http://www.apache.org/licenses/LICENSE-2.0 4843 * 4844 * Unless required by applicable law or agreed to in writing, software 4845 * distributed under the License is distributed on an 'AS IS' BASIS, 4846 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4847 * See the License for the specific language governing permissions and 4848 * limitations under the License. 4849 */const Qa=new D,Sh=new D,Ih=new D,ka=new De,dm=new yn,fm=new fn;class e_ extends mw{constructor(e){super(document.createElement("div")),this.normal=new D(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){(!this.facingCamera||!this.initialized)&&this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,this.referenceCount===0}updatePosition(e){if(e==null)return;const t=gi(e)[0].terms;for(let n=0;n<3;++n)this.position.setComponent(n,$n(t[n]).number);this.updateMatrixWorld()}updateNormal(e){if(e==null)return;const t=gi(e)[0].terms;for(let n=0;n<3;++n)this.normal.setComponent(n,t[n].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:n,bary:i}=this;if(t==null||n==null||i==null)return;t.getVertexPosition(n.x,Qa),t.getVertexPosition(n.y,Sh),t.getVertexPosition(n.z,Ih),Qa.toArray(ka.elements,0),Sh.toArray(ka.elements,3),Ih.toArray(ka.elements,6),this.position.copy(i).applyMatrix3(ka);const s=this.parent;s.worldToLocal(t.localToWorld(this.position)),dm.set(Qa,Sh,Ih),dm.getNormal(this.normal).transformDirection(t.matrixWorld);const o=s.parent;fm.setFromAxisAngle(Qa.set(0,1,0),-o.yaw),this.normal.applyQuaternion(fm)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t,i=n.dataset.visibilityAttribute;if(i!=null){const s=`data-${i}`;n.toggleAttribute(s,e)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}const yT={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` 4850 4851 varying vec2 vUv; 4852 4853 void main() { 4854 4855 vUv = uv; 4856 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4857 4858 }`,fragmentShader:` 4859 4860 uniform sampler2D tDiffuse; 4861 uniform float h; 4862 4863 varying vec2 vUv; 4864 4865 void main() { 4866 4867 vec4 sum = vec4( 0.0 ); 4868 4869 sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051; 4870 sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918; 4871 sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245; 4872 sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531; 4873 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4874 sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531; 4875 sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245; 4876 sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918; 4877 sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051; 4878 4879 gl_FragColor = sum; 4880 4881 }`},xT={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:` 4882 4883 varying vec2 vUv; 4884 4885 void main() { 4886 4887 vUv = uv; 4888 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4889 4890 }`,fragmentShader:` 4891 4892 uniform sampler2D tDiffuse; 4893 uniform float v; 4894 4895 varying vec2 vUv; 4896 4897 void main() { 4898 4899 vec4 sum = vec4( 0.0 ); 4900 4901 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051; 4902 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918; 4903 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245; 4904 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531; 4905 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; 4906 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531; 4907 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245; 4908 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918; 4909 sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051; 4910 4911 gl_FragColor = sum; 4912 4913 }`};function Am(r,e,t){return(1-t)*r+t*e}/* @license 4914 * Copyright 2022 Google LLC. All Rights Reserved. 4915 * Licensed under the Apache License, Version 2.0 (the 'License');
4916 * you may not use this file except in compliance with the License. 4917 * You may obtain a copy of the License at 4918 * 4919 * http://www.apache.org/licenses/LICENSE-2.0 4920 * 4921 * Unless required by applicable law or agreed to in writing, software 4922 * distributed under the License is distributed on an 'AS IS' BASIS, 4923 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4924 * See the License for the specific language governing permissions and 4925 * limitations under the License. 4926 */const pm=9,ST=6,Ch=2,IT=.3;class CT extends lt{constructor(e,t,n){super(),this.camera=new Ur,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new Rg,this.horizontalBlurMaterial=new an(yT),this.verticalBlurMaterial=new an(xT),this.intensity=0,this.softness=1,this.boundingBox=new sn,this.size=new D,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:i}=this;i.rotation.x=Math.PI/2,i.left=-.5,i.right=.5,i.bottom=-.5,i.top=.5,this.add(i);const s=new Yn,o=new xn({opacity:1,transparent:!0,side:Ht});this.floor=new ot(s,o),this.floor.userData.noHit=!0,i.add(this.floor),this.blurPlane=new ot(s),this.blurPlane.visible=!1,i.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(a){a.fragmentShader=a.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,n)}setScene(e,t,n){const{boundingBox:i,size:s,rotation:o,position:a}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(s.x,s.y,s.z)*(this.isAnimated?Ch:1),this.boundingBox.getCenter(a),n==="back"){const{min:l,max:c}=i;[l.y,l.z]=[l.z,l.y],[c.y,c.z]=[c.z,c.y],[s.y,s.z]=[s.z,s.y],o.x=Math.PI/2,o.y=Math.PI}else o.x=0,o.y=0;if(this.isAnimated){const l=i.min.y,c=i.max.y;s.y=this.maxDimension,i.expandByVector(s.subScalar(this.maxDimension).multiplyScalar(-.5)),i.min.y=l,i.max.y=c,s.set(this.maxDimension,c-l,this.maxDimension)}n==="bottom"?a.y=i.min.y:a.z=i.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:n}=this,i=this.isAnimated?Ch:1,s=i*Math.pow(2,pm-e*(pm-ST));this.setMapSize(s);const o=t.y/2,a=t.y*i;n.near=0,n.far=Am(a,o,e),this.depthMaterial.opacity=1/e,n.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=Ch);const n=Math.floor(t.x>t.z?e:e*t.x/t.z),i=Math.floor(t.x>t.z?e*t.z/t.x:e),s=10,o=s+n,a=s+i;if(this.renderTarget!=null&&(this.renderTarget.width!==o||this.renderTarget.height!==a)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),this.renderTarget==null){const l={format:_t};this.renderTarget=new In(o,a,l),this.renderTargetBlur=new In(o,a,l),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+s/n),t.z*(1+s/i),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*Am(IT,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return .001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const n=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const i=e.xr.enabled;e.xr.enabled=!1;const s=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=i,e.setRenderTarget(s),e.setClearAlpha(n)}blurShadow(e){const{camera:t,horizontalBlurMaterial:n,verticalBlurMaterial:i,renderTarget:s,renderTargetBlur:o,blurPlane:a}=this;a.visible=!0,a.material=n,n.uniforms.h.value=1/this.renderTarget.width,n.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(o),e.render(a,t),a.material=i,i.uniforms.v.value=1/this.renderTarget.height,i.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(s),e.render(a,t),a.visible=!1}dispose(){this.renderTarget!=null&&this.renderTarget.dispose(),this.renderTargetBlur!=null&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}/* @license 4927 * Copyright 2019 Google LLC. All Rights Reserved. 4928 * Licensed under the Apache License, Version 2.0 (the 'License');
4929 * you may not use this file except in compliance with the License. 4930 * You may obtain a copy of the License at 4931 * 4932 * http://www.apache.org/licenses/LICENSE-2.0 4933 * 4934 * Unless required by applicable law or agreed to in writing, software 4935 * distributed under the License is distributed on an 'AS IS' BASIS, 4936 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4937 * See the License for the specific language governing permissions and 4938 * limitations under the License. 4939 */const mm=10,Mh=100,wh=new D,gm=new D,_m=new D,bh=new BC,MT=new D,lo=new Se;class wT extends Hi{constructor({canvas:e,element:t,width:n,height:i}){super(),this.annotationRenderer=new gw,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new Ft(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new lt,this.animationNames=[],this.boundingBox=new sn,this.boundingSphere=new Mn,this.size=new D,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=Rl,this.canScale=!0,this.isDirty=!1,this.goalTarget=new D,this.targetDamperX=new un,this.targetDamperY=new un,this.targetDamperZ=new un,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new ET,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new Ft(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(n,i),this.target.name="Target",this.mixer=new TC(this.target);const{domElement:s}=this.annotationRenderer,{style:o}=s;o.display="none",o.pointerEvents="none",o.position="absolute",o.top="0",this.element.shadowRoot.querySelector(".default").appendChild(s),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return this.xrCamera!=null?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url){t(1);return}if(this.reset(),this.url=e,this.externalRenderer!=null){const a=await this.externalRenderer.load(t);this.boundingSphere.radius=a.framedRadius,this.idealAspect=a.fieldOfViewAspect;return}this.cancelPendingSourceChange!=null&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let n;try{n=await new Promise(async(a,l)=>{this.cancelPendingSourceChange=()=>l();try{const c=await this.element[je].loader.load(e,this.element,t);a(c)}catch(c){l(c)}})}catch(a){if(a==null)return;throw a}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=n,n!=null&&(this._model=n.scene,this.target.add(n.scene));const{animations:i}=n,s=new Map,o=[];for(const a of i)s.set(a.name,a),o.push(a.name);this.animations=i,this.animationsByName=s,this.animationNames=o,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),this.shadow!=null&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;e!=null&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;t!=null&&(t.dispose(),this._currentGLTF=null),this.currentAnimationAction!=null&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),this.shadow!=null&&(this.shadow.dispose(),this.shadow=null),this.element[cl]=null,this.element[hl]=null,this.element[hs]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(!(this.width===e&&this.height===t)){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,this.externalRenderer!=null){const n=vu();this.externalRenderer.resize(e*n,t*n)}this.queueRender()}}
vendor: 8,087 bytes, line 4939
4939markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new sn;e.traverse(n=>{const i=n;if(!i.material||!i.material.transparent)return;t.setFromObject(i);const o=t.getSize(MT),a=Math.min(o.x,o.y,o.z);Math.max(o.x,o.y,o.z)<Mh*a||this.markBakedShadow(i)})}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,n=new sn;this.boundingBox.getSize(this.size);for(const i of this.bakedShadows)n.setFromObject(i),!(n.min.y<e.y+this.size.y/Mh&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.z<=e.z&&n.max.z>=t.z)&&(n.min.z<e.z+this.size.z/Mh&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.y<=e.y&&n.max.y>=t.y||this.unmarkBakedShadow(i))}applyTransform(){const{model:e}=this;if(e==null)return;const t=gi(this.element.orientation)[0].terms,n=$n(t[0]).number,i=$n(t[1]).number,s=$n(t[2]).number;e.quaternion.setFromEuler(new Cn(i,s,n,"YXZ"));const o=gi(this.element.scale)[0].terms;e.scale.set(o[0].number,o[1].number,o[2].number)}updateBoundingBox(){const{model:e}=this;if(e==null)return;this.target.remove(e),this.findBakedShadows(e);const t=(n,i)=>n.expandByPoint(i);this.setBakedShadowVisibility(!1),this.boundingBox=Sa(e,t,new sn),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(n=>this.unmarkBakedShadow(n)),this.boundingBox=Sa(e,t,new sn)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(e==null)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());const n=(s,o)=>Math.max(s,t.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(Sa(e,n,0));const i=(s,o)=>{o.sub(t);const a=Math.sqrt(o.x*o.x+o.z*o.z);return Math.max(s,a/(this.idealCameraDistance()-Math.abs(o.y)))};this.idealAspect=Sa(e,i,0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(this.xrCamera!=null)lo.set(e/window.screen.width,t/window.screen.height);else{const n=this.element.getBoundingClientRect();lo.set((e-n.x)/this.width,(t-n.y)/this.height)}return lo.multiplyScalar(2).subScalar(1),lo.y*=-1,lo}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[je].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(this.groundedSkybox.parent!=null?mm:1)}setGroundedSkybox(){const e=gi(this.element.skyboxHeight)[0].terms[0],t=$n(e).number,n=mm*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,n),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,n){this.goalTarget.set(-e,-t,-n)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(y0)}updateTarget(e){const t=this.goalTarget,n=this.target.position;if(t.equals(n))return!1;{const i=this.boundingSphere.radius/10;let{x:s,y:o,z:a}=n;return s=this.targetDamperX.update(s,t.x,e,i),o=this.targetDamperY.update(o,t.y,e,i),a=this.targetDamperZ.update(a,t.z,e,i),this.groundedSkybox.position.x=-s,this.groundedSkybox.position.z=-a,this.target.position.set(s,o,a),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:n,z:i}=this.position;this.yaw=Math.atan2(e-n,t-i)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(this.currentAnimationAction!=null){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===Gu&&(e&1)===1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return this.currentAnimationAction!=null&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return this.currentAnimationAction!=null}playAnimation(e=null,t=0,n=ku,i=1/0){if(this._currentGLTF==null)return;const{animations:s}=this;if(s==null||s.length===0)return;let o=null;if(e!=null&&(o=this.animationsByName.get(e),o==null)){const a=parseInt(e);!isNaN(a)&&a>=0&&a<s.length&&(o=s[a])}o==null&&(o=s[0]);try{const{currentAnimationAction:a}=this,l=this.mixer.clipAction(o,this);this.currentAnimationAction=l,this.element.paused?this.mixer.stopAllAction():(l.paused=!1,a!=null&&l!==a?l.crossFadeFrom(a,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),l.setLoop(n,i),l.enabled=!0,l.clampWhenFinished=!0,l.play()}catch(a){console.error(a)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(e!=null){const t=this.element.arPlacement==="wall"?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;t!=null&&t.needsUpdate==!0&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){this.shadow!=null&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,this._currentGLTF!=null&&(this.setBakedShadowVisibility(),!(e<=0&&this.shadow==null))){if(this.shadow==null){const t=this.element.arPlacement==="wall"?"back":"bottom";this.shadow=new CT(this,this.shadowSoftness,t)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;t?.setSoftness(e)}setShadowOffset(e){const t=this.shadow;t?.setOffset(e)}hitFromPoint(e,t=this){return bh.setFromCamera(e,this.getCamera()),bh.intersectObject(t,!0).find(i=>i.object.visible&&!i.object.userData.noHit)}positionAndNormalFromPoint(e,t=this){var n;const i=this.hitFromPoint(e,t);if(i==null)return null;const s=i.point,o=i.face!=null?i.face.normal.clone().applyNormalMatrix(new De().getNormalMatrix(i.object.matrixWorld)):bh.ray.direction.clone().multiplyScalar(-1),a=(n=i.uv)!==null&&n!==void 0?n:null;return{position:s,normal:o,uv:a}}surfaceFromPoint(e,t=this){const n=this.element.model;if(n==null)return null;const i=this.hitFromPoint(e,t);if(i==null||i.face==null)return null;const s=n[wu](i),{meshes:o,primitives:a}=s.mesh.userData.associations,l=new D,c=new D,h=new D,{a:u,b:d,c:f}=i.face,m=i.object;m.getVertexPosition(u,l),m.getVertexPosition(d,c),m.getVertexPosition(f,h);const g=new yn(l,c,h),A=new D;return g.getBarycoord(m.worldToLocal(i.point),A),`${o} ${a} ${u} ${d} ${f} ${A.x.toFixed(3)} ${A.y.toFixed(3)} ${A.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let n=0,i=t.length;n<i;n++){const s=t[n];s instanceof e_&&e(s)}}initializeSurface(e){if(e.surface!=null&&e.mesh==null){const t=gi(e.surface)[0].terms;if(t.length!=8){console.warn(e.surface+" does not have exactly 8 numbers.");return}const n=this.element.model[Z0](t[0].number,t[1].number),i=new D(t[2].number,t[3].number,t[4].number);
vendor: 4,361 bytes, lines 4939-4965
4939if(n==null){console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");return}const s=n.mesh.geometry.attributes.position.count;if(i.x>=s||i.y>=s||i.z>=s){console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");return}const o=new D(t[5].number,t[6].number,t[7].number);e.mesh=n.mesh,e.tri=i,e.bary=o}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots(t=>{this.initializeSurface(t),t.updateSurface(e)})}updateHotspotsVisibility(e){this.forHotspots(t=>{wh.copy(e),gm.setFromMatrixPosition(t.matrixWorld),wh.sub(gm),_m.copy(t.normal).transformDirection(this.target.matrixWorld),wh.dot(_m)<0?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;const{schemaElement:n,element:i}=this,{alt:s,poster:o,iosSrc:a}=i;if(e!=null){const l=[{"@type":"MediaObject",contentUrl:e,encodingFormat:((t=e.split(".").pop())===null||t===void 0?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];a&&l.push({"@type":"MediaObject",contentUrl:a,encodingFormat:"model/vnd.usdz+zip"});const c={"@context":"http://schema.org/","@type":"3DModel",image:o??void 0,name:s??void 0,encoding:l};n.textContent=JSON.stringify(c),document.head.appendChild(n)}else n.parentElement!=null&&n.parentElement.removeChild(n)}}/* @license 4940 * Copyright 2019 Google LLC. All Rights Reserved. 4941 * Licensed under the Apache License, Version 2.0 (the 'License'); 4942 * you may not use this file except in compliance with the License. 4943 * You may obtain a copy of the License at 4944 * 4945 * http://www.apache.org/licenses/LICENSE-2.0 4946 * 4947 * Unless required by applicable law or agreed to in writing, software 4948 * distributed under the License is distributed on an 'AS IS' BASIS, 4949 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4950 * See the License for the specific language governing permissions and 4951 * limitations under the License. 4952 */class bT extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),this.ongoingActivityCount===1&&this.announceTotalProgress(t,0,e),n=>{let i;return i=Math.max(zn(n,0,1),t.progress),i!==t.progress&&this.announceTotalProgress(t,i,e),t.progress}}announceTotalProgress(e,t,n){let i=0,s=0;t==1&&(e.completed=!0);for(const l of this.ongoingActivities){const{progress:c}=l;i+=1-c,l.completed&&s++}const o=e.progress;e.progress=t,this.totalProgress+=(t-o)*(1-this.totalProgress)/i;const a=s===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:a,reason:n}})),s===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}/* @license 4953 * Copyright 2019 Google LLC. All Rights Reserved. 4954 * Licensed under the Apache License, Version 2.0 (the 'License'); 4955 * you may not use this file except in compliance with the License. 4956 * You may obtain a copy of the License at 4957 * 4958 * http://www.apache.org/licenses/LICENSE-2.0 4959 * 4960 * Unless required by applicable law or agreed to in writing, software 4961 * distributed under the License is distributed on an 'AS IS' BASIS, 4962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4963 * See the License for the specific language governing permissions and 4964 * limitations under the License. 4965 */var Ql=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Em,vm,ym,xm,Sm,Im,Cm,Mm,wm,bm,Tm,Bm,Rm;const TT=10,BT=50,RT=0,DT=300,LT=150,ki=document.createElement("canvas"),Th=Symbol("fallbackResizeHandler"),Dm=Symbol("defaultAriaLabel"),Ga=Symbol("resizeObserver"),ir=Symbol("clearModelTimeout"),Bh=Symbol("onContextLost"),sr=Symbol("loaded"),Rh=Symbol("status"),Dh=Symbol("onFocus"),Lh=Symbol("onBlur"),hr=Symbol("updateSize"),Ha=Symbol("intersectionObserver"),us=Symbol("isElementInViewport"),wl=Symbol("announceModelVisibility"),_r=Symbol("ariaLabel"),Tu=Symbol("altDefaulted"),co=Symbol("statusElement"),bl=Symbol("updateStatus"),So=Symbol("loadedT
4965ime"),Sr=Symbol("updateSource"),Lm=Symbol("markLoaded"),ul=Symbol("container"),Dn=Symbol("input"),Bu=Symbol("canvas"),te=Symbol("scene"),Kt=Symbol("needsRender"),Xn=Symbol("tick"),zi=Symbol("onModelLoad"),Uo=Symbol("onResize"),je=Symbol("renderer"),Cs=Symbol("progressTracker"),Pm=Symbol("getLoaded"),Ms=Symbol("getModelIsVisible"),Pr=Symbol("shouldAttemptPreload"),Ni=r=>({x:r.x,y:r.y,z:r.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),Ru=r=>({u:r.x,v:r.y,toString(){return`${this.u} ${this.v}`}});class zo extends As{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Em]=!1,this[vm]=!1,this[ym]=0,this[xm]="",this[Sm]=null,this[Im]=EA(()=>{const i=this.getBoundingClientRect();this[hr](i)},BT),this[Cm]=EA(i=>{const s=this.modelIsVisible;s!==i&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:s}}))},RT),this[Mm]=null,this[wm]=null,this[bm]=new bT,this[Tm]=()=>{this[co].textContent=this[Rh]},this[Bm]=()=>{this[co].textContent=""},this[Rm]=i=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:i.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;pM(e),this[ul]=e.querySelector(".container"),this[Dn]=e.querySelector(".userIn
4965put"),this[Bu]=e.querySelector("canvas"),this[co]=e.querySelector("#status"),this[Dm]=this[Dn].getAttribute("aria-label");let t,n;if(this.isConnected){const i=this.getBoundingClientRect();t=i.width,n=i.height}else t=DT,n=LT;this[te]=new wT({canvas:this[Bu],element:this,width:t,height:n}),Promise.resolve().then(()=>{this[hr](this.getBoundingClientRect())}),Lc&&(this[Ga]=new ResizeObserver(i=>{if(!this[je].isPresenting)for(let s of i)s.target===this&&this[hr](s.contentRect)})),Pc?this[Ha]=new IntersectionObserver(i=>{for(let s of i)if(s.target===this){const o=this.modelIsVisible;this[us]=s.isIntersecting,this[wl](o),this[us]&&!this.loaded&&this[Sr]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[us]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){Ut[Li].evictionThreshold=e}static get modelCacheSize(){return Ut[Li].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Ln.singleton.minScale=e}static get minimumRenderScale(){return Ln.singleton.minScale}get loaded(){return this[Pm]()}get[(Em=us,vm=sr,ym=So,xm=Rh,Sm=ir,Im=Th,Cm=wl,Mm=Ga,wm=Ha,bm=Cs,je)](){return Ln.singleton}get modelIsVisible(){return this[Ms]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Lc?this[Ga].observe(this):self.addEventListener("resize",this[Th]),Pc&&this[Ha].observe(this),this.addEventListener("focus",this[Dh]),this.addEventListener("blur",this[Lh]);const e=this[je];e.addEventListener("contextlost",this[Bh]),e.registerScene(this[te]),this[ir]!=null&&(self.clearTimeout(this[ir]),this[ir]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Lc?this[Ga].unobserve(this):self.removeEventListener("resize",this[Th]),Pc&&this[Ha].unobserve(this),this.removeEventListener("focus",this[Dh]),this.removeEventListener("blur",this[Lh]);const e=this[je];e.removeEventListener("contextlost",this[Bh]),e.unregisterScene(this[te]),this[ir]=self.setTimeout(()=>{this[te].dispose(),this[ir]=null},TT)}updated(e){super.updated(e),e.has("src")&&(this.src==null?(this[sr]=!1,this[So]=0,this[te].reset()):this.src!==this[te].url&&(this[sr]=!1,this[So]=0,this[Sr]())),e.has("alt")&&this[Dn].setAttribute("aria-label",this[_r]),e.has("withCredentials")&&(Ut.withCredentials=this.withCredentials,this[je].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[te].updateSchema(this.src):this[te].updateSchema(null))}toDataURL(e,t){return this[je].displayCanvas(this[te]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,n=e?e.qualityArgument:void 0,i=e?e.idealAspect:void 0,{width:s,height:o,idealAspect:a,aspect:l}=this[te],{dpr:c,scaleFactor:h}=this[je];let u=s*h*c,d=o*h*c,f=0,m=0;if(i===!0)if(a>l){const g=d;d=Math.round(u/a),m=(g-d)/2}else{const g=u;u=Math.round(d*a),f=(g-u)/2}ki.width=u,ki.height=d;try{return new Promise(async(g,A)=>{ki.getContext("2d").drawImage(this[je].displayCanvas(this[te]),f,m,u,d,0,0,u,d),ki.toBlob(p=>{if(!p)return A(new Error("Unable to retrieve canvas blob"));g(p)},t,n)})}finally{this[hr]({width:s,height:o})}}registerEffectComposer(e){e.setRenderer(this[je].threeRenderer),e.setMainCamera(this[te].getCamera()),e.setMainScene(this[te]),this[te].effectRenderer=e}unregisterEffectComposer(){this[te].effectRenderer=null}registerRenderer(e){this[te].externalRenderer=e}unregisterRenderer(){this[te].externalRenderer=null}get[_r](){return this[Tu]}get[Tu](){return this.alt==null||this.alt==="null"?this[Dm]:this.alt}[Pm](){return this[sr]}[Ms](){return this.loaded&&this[us]}[Pr](){return!!this.src&&this[us]}[hr]({width:e,height:t}){e===0||t===0||(this[ul].style.width=`${e}px`,this[ul].style.height=`${t}px`,this[Uo]({width:e,height:t}))}[Xn](e,t){var n;(n=this[te].effectRenderer)===null||n===void 0||n.beforeRender(e,t)}[Lm](){this[sr]||(this[sr]=!0,this[So]=performance.now())}[Kt](){this[te].queueRender()}[zi](){}[bl](e){this[Rh]=e;const t=this.getRootNode();t!=null&&t.activeElement===this&&this[co].textContent!=e&&(this[co].textContent=e)}[(Tm=Dh,Bm=Lh,Uo)](e){this[te].setSize(e.width,e.height)}async[(Rm=Bh,Sr)](){const e=this[te];if(this.loaded||!this[Pr]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[bl]("Loading"),e.stopAnimation();const t=this[Cs].beginActivity("model-load"),n=this.src;try{const i=e.setSource(n,o=>t(zn(o,0,1)*.95)),s=this[Il]();await Promise.all([i,s]),this[Lm](),this[zi](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(o=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:n}})),o()})})})}catch(i){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:i}}))}finally{t(1)}}}Ql([ve({type:String})],zo.prototype,"alt",void 0);Ql([ve({type:String})],zo.prototype,"src",void 0);Ql([ve({type:Boolean,attribute:"with-credentials"})],zo.prototype,"withCredentials",void 0);Ql([ve({type:Boolean,attribute:"generate-schema"})],zo.prototype,"generateSchema",void 0);/* @license 4966 * Copyright 2019 Google LLC. All Rights Reserved. 4967 * Licensed under the Apache License, Version 2.0 (the 'License');
vendor: 5,450 bytes, lines 4968-4991
4968 * you may not use this file except in compliance with the License. 4969 * You may obtain a copy of the License at 4970 * 4971 * http://www.apache.org/licenses/LICENSE-2.0 4972 * 4973 * Unless required by applicable law or agreed to in writing, software 4974 * distributed under the License is distributed on an 'AS IS' BASIS, 4975 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4976 * See the License for the specific language governing permissions and 4977 * limitations under the License. 4978 */var Ph=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const Um=1e3,Va=Symbol("changeAnimation"),hi=Symbol("paused"),PT={repetitions:1/0,pingpong:!1},UT=r=>{var e;class t extends r{constructor(...i){super(i),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0,this[te].subscribeMixerEvent("loop",s=>{const o=s.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:o}}))}),this[te].subscribeMixerEvent("finished",()=>{this[hi]=!0,this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[te].animationNames:[]}get duration(){return this[te].duration}get paused(){return this[hi]}get currentTime(){return this[te].animationTime}set currentTime(i){this[te].animationTime=i,this[Kt]()}get timeScale(){return this[te].animationTimeScale}set timeScale(i){this[te].animationTimeScale=i}pause(){this[hi]||(this[hi]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(i){this.availableAnimations.length>0&&(this[hi]=!1,this[Va](i),this.dispatchEvent(new CustomEvent("play")))}[(e=hi,zi)](){super[zi](),this[hi]=!0,this.animationName!=null&&this[Va](),this.autoplay&&this.play()}[Xn](i,s){super[Xn](i,s),!(this[hi]||!this[Ms]()&&!this[je].isPresenting)&&(this[te].updateAnimation(s/Um),this[Kt]())}updated(i){super.updated(i),i.has("autoplay")&&this.autoplay&&this.play(),i.has("animationName")&&this[Va]()}[Va](i=PT){var s;const o=(s=i.repetitions)!==null&&s!==void 0?s:1/0,a=i.pingpong?Gu:o===1?hg:ku;this[te].playAnimation(this.animationName,this.animationCrossfadeDuration/Um,a,o),this[hi]&&(this[te].updateAnimation(0),this[Kt]())}}return Ph([ve({type:Boolean})],t.prototype,"autoplay",void 0),Ph([ve({type:String,attribute:"animation-name"})],t.prototype,"animationName",void 0),Ph([ve({type:Number,attribute:"animation-crossfade-duration"})],t.prototype,"animationCrossfadeDuration",void 0),t};/* @license 4979 * Copyright 2019 Google LLC. All Rights Reserved. 4980 * Licensed under the Apache License, Version 2.0 (the 'License'); 4981 * you may not use this file except in compliance with the License. 4982 * You may obtain a copy of the License at 4983 * 4984 * http://www.apache.org/licenses/LICENSE-2.0 4985 * 4986 * Unless required by applicable law or agreed to in writing, software 4987 * distributed under the License is distributed on an 'AS IS' BASIS, 4988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4989 * See the License for the specific language governing permissions and 4990 * limitations under the License. 4991 */const ss=Symbol("hotspotMap"),Uh=Symbol("mutationCallback"),ho=Symbol("observer"),Nh=Symbol("addHotspot"),Nm=Symbol("removeHotspot"),Fh=new Me,NT=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this[e]=new Map,this[t]=o=>{o.forEach(a=>{(!(a instanceof MutationRecord)||a.type==="childList")&&(a.addedNodes.forEach(l=>{this[Nh](l)}),a.removedNodes.forEach(l=>{this[Nm](l)}),this[Kt]())})},this[n]=new MutationObserver(this[Uh])}connectedCallback(){super.connectedCallback();for(let a=0;a<this.children.length;++a)this[Nh](this.children[a]);const{ShadyDOM:o}=self;o==null?this[ho].observe(this,{childList:!0}):this[ho]=o.observeChildren(this,this[Uh])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:o}=self;o==null?this[ho].disconnect():o.unobserveChildren(this[ho])}[(e=ss,t=Uh,n=ho,Xn)](o,a){super[Xn](o,a);const l=this[te],{annotationRenderer:c}=l,h=l.getCamera();l.shouldRender()&&(l.updateSurfaceHotspots(),l.updateHotspotsVisibility(h.position),c.domElement.style.display="",c.render(l,h))}updateHotspot(o){const a=this[ss].get(o.name);a!=null&&(a.updatePosition(o.position),a.updateNormal(o.normal),a.surface=o.surface,this[Kt]())}queryHotspot(o){const a=this[ss].get(o);if(a==null)return null;const l=Ni(a.position),c=Ni(a.normal),h=a.facingCamera,u=this[te],d=u.getCamera(),f=new D;f.setFromMatrixPosition(a.matrixWorld),f.project(d);const m=u.width/2,g=u.height/2;f.x=f.x*m+m,f.y=-(f.y*g)+g;const A=Ni(new D(f.x,f.y,f.z));return!Number.isFinite(A.x)||!Number.isFinite(A.y)?null:{position:l,normal:c,canvasPosition:A,facingCamera:h}}positionAndNormalFromPoint(o,a){const l=this[te],c=l.getNDC(o,a),h=l.positionAndNormalFromPoint(c);if(h==null)return null;Fh.copy(l.target.matrixWorld).invert();const u=Ni(h.position.applyMatrix4(Fh)),d=Ni(h.normal.transformDirection(Fh));let f=null;return h.uv!=null&&(f=Ru(h.uv)),{position:u,normal:d,uv:f}}surfaceFromPoint(o,a){const l=this[te],c=l.getNDC(o,a);return l.surfaceFromPoint(c)}[Nh](o){if(!(o instanceof HTMLElement&&o.slot.indexOf("hotspot")===0))return;let a=this[ss].get(o.slot);a!=null?a.increment():(a=new e_({name:o.slot,position:o.dataset.position,normal:o.dataset.normal,surface:o.dataset.surface}),this[ss].set(o.slot,a),this[te].addHotspot(a)),this[te].queueRender()}
4991[Nm](o){if(!(o instanceof HTMLElement))return;const a=this[ss].get(o.slot);a&&(a.decrement()&&(this[te].removeHotspot(a),this[ss].delete(o.slot)),this[te].queueRender())}}return i};/*! 4992fflate - fast JavaScript compression/decompression 4993<https://101arrowz.github.io/fflate> 4994Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE 4995version 0.8.2 4996*/var jt=Uint8Array,Sn=Uint16Array,ld=Int32Array,cd=new jt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),hd=new jt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Fm=new jt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t_=function(r,e){for(var t=new Sn(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new ld(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return{b:t,r:i}},n_=t_(cd,2),FT=n_.b,Du=n_.r;FT[28]=258,Du[258]=28;var OT=t_(hd,0),Om=OT.r,i_=new Sn(32768);for(var dt=0;dt<32768;++dt){var Bi=(dt&43690)>>1|(dt&21845)<<1;Bi=(Bi&52428)>>2|(Bi&13107)<<2,Bi=(Bi&61680)>>4|(Bi&3855)<<4,i_[dt]=((Bi&65280)>>8|(Bi&255)<<8)>>1}var wo=function(r,e,t){for(var n=r.length,i=0,s=new Sn(e);i<n;++i)r[i]&&++s[r[i]-1];var o=new Sn(e);for(i=1;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;var a;for(a=new Sn(n),i=0;i<n;++i)r[i]&&(a[i]=i_[o[r[i]-1]++]>>15-r[i]);return a},ws=new jt(288);for(var dt=0;dt<144;++dt)ws[dt]=8;for(var dt=144;dt<256;++dt)ws[dt]=9;for(var dt=256;dt<280;++dt)ws[dt]=7;for(var dt=280;dt<288;++dt)ws[dt]=8;var Tl=new jt(32);for(var dt=0;dt<32;++dt)Tl[dt]=5;var QT=wo(ws,9),kT=wo(Tl,5),s_=function(r){return(r+7)/8|0},r_=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new jt(r.subarray(e,t))}
vendor: 17,485 bytes, lines 4996-5144
4996,GT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],kl=function(r,e,t){var n=new Error(e||GT[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,kl),!t)throw n;return n},ui=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8},uo=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8,r[n+2]|=t>>16},Oh=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return{t:a_,l:0};if(i==1){var o=new jt(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(C,I){return C.f-I.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,h=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=t[t[c].f<t[u].f?c++:u++],l=t[c!=h&&t[c].f<t[u].f?c++:u++],t[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var f=new Sn(d+1),m=Lu(t[h-1],f,0);if(m>e){var n=0,g=0,A=m-e,p=1<<A;for(s.sort(function(I,w){return f[w.s]-f[I.s]||I.f-w.f});n<i;++n){var x=s[n].s;if(f[x]>e)g+=p-(1<<m-f[x]),f[x]=e;else break}for(g>>=A;g>0;){var _=s[n].s;f[_]<e?g-=1<<e-f[_]++-1:++n}for(;n>=0&&g;--n){var S=s[n].s;f[S]==e&&(--f[S],++g)}m=e}return{t:new jt(f),l:m}},Lu=function(r,e,t){return r.s==-1?Math.max(Lu(r.l,e,t+1),Lu(r.r,e,t+1)):e[r.s]=t},Qm=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Sn(++e),n=0,i=r[0],s=1,o=function(l){t[n++]=l},a=1;a<=e;++a)if(r[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=r[a]}return{c:t.subarray(0,n),n:e}},fo=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},o_=function(r,e,t){var n=t.length,i=s_(e+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=t[s];return(i+4+n)*8},km=function(r,e,t,n,i,s,o,a,l,c,h){ui(e,h++,t),++i[256];for(var u=Oh(i,15),d=u.t,f=u.l,m=Oh(s,15),g=m.t,A=m.l,p=Qm(d),x=p.c,_=p.n,S=Qm(g),C=S.c,I=S.n,w=new Sn(19),b=0;b<x.length;++b)++w[x[b]&31];for(var b=0;b<C.length;++b)++w[C[b]&31];for(var v=Oh(w,7),E=v.t,L=v.l,F=19;F>4&&!E[Fm[F-1]];--F);var R=c+5<<3,P=fo(i,ws)+fo(s,Tl)+o,N=fo(i,d)+fo(s,g)+o+14+3*F+fo(w,E)+2*w[16]+3*w[17]+7*w[18];if(l>=0&&R<=P&&R<=N)return o_(e,h,r.subarray(l,l+c));var G,$,O,X;if(ui(e,h,1+(N<P)),h+=2,N<P){G=wo(d,f),$=d,O=wo(g,A),X=g;var q=wo(E,L);ui(e,h,_-257),ui(e,h+5,I-1),ui(e,h+10,F-4),h+=14;for(var b=0;b<F;++b)ui(e,h+3*b,E[Fm[b]]);h+=3*F;for(var ee=[x,C],ue=0;ue<2;++ue)for(var we=ee[ue],b=0;b<we.length;++b){var z=we[b]&31;ui(e,h,q[z]),h+=E[z],z>15&&(ui(e,h,we[b]>>5&127),h+=we[b]>>12)}}else G=QT,$=ws,O=kT,X=Tl;for(var b=0;b<a;++b){var K=n[b];if(K>255){var z=K>>18&31;uo(e,h,G[z+257]),h+=$[z+257],z>7&&(ui(e,h,K>>23&31),h+=cd[z]);var le=K&31;uo(e,h,O[le]),h+=X[le],le>3&&(uo(e,h,K>>5&8191),h+=hd[le])}else uo(e,h,G[K]),h+=$[K]}return uo(e,h,G[256]),h+$[256]},HT=new ld([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),a_=new jt(0),VT=function(r,e,t,n,i,s){var o=s.z||r.length,a=new jt(n+o+5*(1+Math.ceil(o/7e3))+i),l=a.subarray(n,a.length-i),c=s.l,h=(s.r||0)&7;if(e){h&&(l[0]=s.r>>3);for(var u=HT[e-1],d=u>>13,f=u&8191,m=(1<<t)-1,g=s.p||new Sn(32768),A=s.h||new Sn(m+1),p=Math.ceil(t/3),x=2*p,_=function(vt){return(r[vt]^r[vt+1]<<p^r[vt+2]<<x)&m},S=new ld(25e3),C=new Sn(288),I=new Sn(32),w=0,b=0,v=s.i||0,E=0,L=s.w||0,F=0;v+2<o;++v){var R=_(v),P=v&32767,N=A[R];if(g[P]=N,A[R]=P,L<=v){var G=o-v;if((w>7e3||E>24576)&&(G>423||!c)){h=km(r,l,0,S,C,I,b,E,F,v-F,h),E=w=b=0,F=v;for(var $=0;$<286;++$)C[$]=0;for(var $=0;$<30;++$)I[$]=0}var O=2,X=0,q=f,ee=P-N&32767;if(G>2&&R==_(v-ee))for(var ue=Math.min(d,G)-1,we=Math.min(32767,v),z=Math.min(258,G);ee<=we&&--q&&P!=N;){if(r[v+O]==r[v+O-ee]){for(var K=0;K<z&&r[v+K]==r[v+K-ee];++K);if(K>O){if(O=K,X=ee,K>ue)break;for(var le=Math.min(ee,K-2),oe=0,$=0;$<le;++$){var Be=v-ee+$&32767,Oe=g[Be],Ve=Be-Oe&32767;Ve>oe&&(oe=Ve,N=Be)}}}P=N,N=g[P],ee+=P-N&32767}if(X){S[E++]=268435456|Du[O]<<18|Om[X];var Q=Du[O]&31,Ge=Om[X]&31;b+=cd[Q]+hd[Ge],++C[257+Q],++I[Ge],L=v+O,++w}else S[E++]=r[v],++C[r[v]]}}for(v=Math.max(v,L);v<o;++v)S[E++]=r[v],++C[r[v]];h=km(r,l,c,S,C,I,b,E,F,v-F,h),c||(s.r=h&7|l[h/8|0]<<3,h-=7,s.h=A,s.p=g,s.i=v,s.w=L)}else{for(var v=s.w||0;v<o+c;v+=65535){var Ee=v+65535;Ee>=o&&(l[h/8|0]=c,Ee=o),h=o_(l,h+1,r.subarray(v,Ee))}s.i=o}return r_(a,0,n+s_(h)+i)},zT=function(){for(var r=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;r[e]=t}return r}(),WT=function(){var r=-1;return{p:function(e){for(var t=r,n=0;n<e.length;++n)t=zT[t&255^e[n]]^t>>>8;r=t},d:function(){return~r}}},$T=function(r,e,t,n,i){if(!i&&(i={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),o=new jt(s.length+r.length);o.set(s),o.set(r,s.length),r=o,i.w=s.length}return VT(r,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,t,n,i)},l_=function(r,e){var t={};for(var n in r)t[n]=r[n];for(var n in e)t[n]=e[n];return t},kt=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function qT(r,e){return $T(r,e||{},0,0)}var c_=function(r,e,t,n){for(var i in r){var s=r[i],o=e+i,a=n;Array.isArray(s)&&(a=l_(n,s[1]),s=s[0]),s instanceof jt?t[o]=[s,a]:(t[o+="/"]=[new jt(0),a],c_(s,o,t,n))}},Gm=typeof TextEncoder<"u"&&new TextEncoder,XT=typeof TextDecoder<"u"&&new TextDecoder,YT=0;try{XT.decode(a_,{stream:!0}),YT=1}catch{}function Bl(r,e){var t;if(Gm)return Gm.encode(r);for(var n=r.length,i=new jt(r.length+(r.length>>1)),s=0,o=function(c){i[s++]=c},t=0;t<n;++t){if(s+5>i.length){var a=new jt(s+8+(n-t<<1));a.set(i),i=a}var l=r.charCodeAt(t);l<128||e?o(l):l<2048?(o(192|l>>6),o(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|r.charCodeAt(++t)&1023,o(240|l>>18),o(128|l>>12&63),o(128|l>>6&63),o(128|l&63)):(o(224|l>>12),o(128|l>>6&63),o(128|l&63))}return r_(i,0,s)}var Pu=function(r){var e=0;if(r)for(var t in r){var n=r[t].length;n>65535&&kl(9),e+=n+4}return e},Hm=function(r,e,t,n,i,s,o,a){var l=n.length,c=t.extra,h=a&&a.length,u=Pu(c);kt(r,e,o!=null?33639248:67324752),e+=4,o!=null&&(r[e++]=20,r[e++]=t.os),r[e]=20,e+=2,r[e++]=t.flag<<1|(s<0&&8),r[e++]=i&&8,r[e++]=t.compression&255,r[e++]=t.compression>>8;var d=new Date(t.mtime==null?Date.now():t.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&kl(10),kt(r,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,s!=-1&&(kt(r,e,t.crc),kt(r,e+4,s<0?-s-2:s),kt(r,e+8,t.size)),kt(r,e+12,l),kt(r,e+14,u),e+=16,o!=null&&(kt(r,e,h),kt(r,e+6,t.attrs),kt(r,e+10,o),e+=14),r.set(n,e),e+=l,u)for(var m in c){var g=c[m],A=g.length;kt(r,e,+m),kt(r,e+2,A),r.set(g,e+4),e+=4+A}return h&&(r.set(a,e),e+=h),e},KT=function(r,e,t,n,i){kt(r,e,101010256),kt(r,e+8,t),kt(r,e+10,t),kt(r,e+12,n),kt(r,e+16,i)};function JT(r,e){e||(e={});var t={},n=[];c_(r,"",t,e);var i=0,s=0;for(var o in t){var a=t[o],l=a[0],c=a[1],h=c.level==0?0:8,u=Bl(o),d=u.length,f=c.comment,m=f&&Bl(f),g=m&&m.length,A=Pu(c.extra);d>65535&&kl(11);var p=h?qT(l,c):l,x=p.length,_=WT();_.p(l),n.push(l_(c,{size:l.length,crc:_.d(),c:p,f:u,m,u:d!=o.length||m&&f.length!=g,o:i,compression:h})),i+=30+d+A+x,s+=76+2*(d+A)+(g||0)+x}for(var S=new jt(s+22),C=i,I=s-i,w=0;w<n.length;++w){var u=n[w];Hm(S,u.o,u,u.f,u.u,u.c.length);var b=30+u.f.length+Pu(u.extra);S.set(u.c,u.o+b),Hm(S,i,u,u.f,u.u,u.c.length,u.o,u.m),i+=16+b+(u.m?u.m.length:0)}return KT(S,i,n.length,I,C),S}class jT{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const n={},i="model.usda";n[i]=null;let s=h_();s+=eB(t);const o={},a={};e.traverseVisible(c=>{if(c.isMesh){const h=c.geometry,u=c.material;if(u.isMeshStandardMaterial){const d="geometries/Geometry_"+h.id+".usda";if(!(d in n)){const f=sB(h);n[d]=nB(f)}u.uuid in o||(o[u.uuid]=u),s+=iB(c,h,u)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",c)}else c.isCamera&&(s+=fB(c))}),s+=tB(),s+=hB(o,a,t.quickLookCompatible),n[i]=Bl(s),s=null;for(const c in a){let h=a[c];h.isCompressedTexture===!0&&(h=il(h));const u=ZT(h.image,h.flipY,t.maxTextureSize),d=await new Promise(f=>u.toBlob(f,"image/png",1));n[`textures/Texture_${c}.png`]=new Uint8Array(await d.arrayBuffer())}let l=0;for(const c in n){const h=n[c],u=34+c.length;l+=u;const d=l&63;if(d!==4){const f=64-d,m=new Uint8Array(f);n[c]=[h,{extra:{12345:m}}]}l=h.length}return JT(n,{level:0})}}function ZT(r,e,t){if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&r instanceof ImageBitmap){const n=t/Math.max(r.width,r.height),i=document.createElement("canvas");i.width=r.width*Math.min(1,n),i.height=r.height*Math.min(1,n);const s=i.getContext("2d");return e===!0&&(s.translate(0,i.height),s.scale(1,-1)),s.drawImage(r,0,0,i.width,i.height),i}else throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const Xt=7;function h_(){return`#usda 1.0 4997( 4998 customLayerData = { 4999 string creator = "Three.js USDZExporter" 5000 } 5001 defaultPrim = "Root" 5002 metersPerUnit = 1 5003 upAxis = "Y" 5004) 5005 5006`}function eB(r){return`def Xform "Root" 5007{ 5008 def Scope "Scenes" ( 5009 kind = "sceneLibrary" 5010 ) 5011 { 5012 def Xform "Scene" ( 5013 customData = { 5014 bool preliminary_collidesWithEnvironment = 0 5015 string sceneName = "Scene" 5016 } 5017 sceneName = "Scene" 5018 ) 5019 { 5020 token preliminary:anchoring:type = "${r.ar.anchoring.type}" 5021 token preliminary:planeAnchoring:alignment = "${r.ar.planeAnchoring.alignment}" 5022 5023`}function tB(){return` 5024 } 5025 } 5026} 5027 5028`}function nB(r){let e=h_();return e+=r,Bl(e)}function iB(r,e,t){const n="Object_"+r.id,i=u_(r.matrixWorld);return r.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r),`def Xform "${n}" ( 5029 prepend references = @./geometries/Geometry_${e.id}.usda@</Geometry> 5030 prepend apiSchemas = ["MaterialBindingAPI"] 5031) 5032{ 5033 matrix4d xformOp:transform = ${i} 5034 uniform token[] xformOpOrder = ["xformOp:transform"] 5035 5036 rel material:binding = </Materials/Material_${t.id}> 5037} 5038 5039`}function u_(r){const e=r.elements;return`( ${za(e,0)}, ${za(e,4)}, ${za(e,8)}, ${za(e,12)} )`}function za(r,e){return`(${r[e+0]}, ${r[e+1]}, ${r[e+2]}, ${r[e+3]})`}function sB(r){return` 5040def "Geometry" 5041{ 5042${rB(r)} 5043} 5044`}function rB(r){const e="Geometry",t=r.attributes,n=t.position.count;return` 5045 def Mesh "${e}" 5046 { 5047 int[] faceVertexCounts = [${oB(r)}] 5048 int[] faceVertexIndices = [${aB(r)}] 5049 normal3f[] normals = [${Uu(t.normal,n)}] ( 5050 interpolation = "vertex" 5051 ) 5052 point3f[] points = [${Uu(t.position,n)}] 5053${cB(t)} 5054 uniform token subdivisionScheme = "none" 5055 } 5056`}function oB(r){const e=r.index!==null?r.index.count:r.attributes.position.count;return Array(e/3).fill(3).join(", ")}function aB(r){const e=r.index,t=[];if(e!==null)for(let n=0;n<e.count;n++)t.push(e.getX(n));else{const n=r.attributes.position.count;for(let i=0;i<n;i++)t.push(i)}return t.join(", ")}function Uu(r,e){if(r===void 0)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const t=[];for(let n=0;n<r.count;n++){const i=r.getX(n),s=r.getY(n),o=r.getZ(n);t.push(`(${i.toPrecision(Xt)}, ${s.toPrecision(Xt)}, ${o.toPrecision(Xt)})`)}return t.join(", ")}function lB(r){const e=[];for(let t=0;t<r.count;t++){const n=r.getX(t),i=r.getY(t);e.push(`(${n.toPrecision(Xt)}, ${1-i.toPrecision(Xt)})`)}return e.join(", ")}function cB(r){let e="";for(let n=0;n<4;n++){const i=n>0?n:"",s=r["uv"+i];s!==void 0&&(e+=` 5057 texCoord2f[] primvars:st${i} = [${lB(s)}] ( 5058 interpolation = "vertex" 5059 )`)}const t=r.color;if(t!==void 0){const n=t.count;e+=` 5060 color3f[] primvars:displayColor = [${Uu(t,n)}] ( 5061 interpolation = "vertex" 5062 )`}return e}function hB(r,e,t=!1){const n=[];for(const i in r){const s=r[i];n.push(uB(s,e,t))}return`def "Materials" 5063{ 5064${n.join("")} 5065} 5066 5067`}function uB(r,e,t=!1){const n=" ",i=[],s=[];function o(a,l,c){const h=a.source.id+"_"+a.flipY;e[h]=a;const u=a.channel>0?"st"+a.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},f=a.repeat.clone(),m=a.offset.clone(),g=a.rotation,A=Math.sin(g),p=Math.cos(g);return m.y=1-m.y-f.y,t?(m.x=m.x/f.x,m.y=m.y/f.y,m.x+=A/f.x,m.y+=p-1):(m.x+=A*f.x,m.y+=(1-p)*f.y),` 5068 def Shader "PrimvarReader_${l}" 5069 { 5070 uniform token info:id = "UsdPrimvarReader_float2" 5071 float2 inputs:fallback = (0.0, 0.0) 5072 token inputs:varname = "${u}" 5073 float2 outputs:result 5074 } 5075 5076 def Shader "Transform2d_${l}" 5077 { 5078 uniform token info:id = "UsdTransform2d" 5079 token inputs:in.connect = </Materials/Material_${r.id}/PrimvarReader_${l}.outputs:result> 5080 float inputs:rotation = ${(g*(180/Math.PI)).toFixed(Xt)} 5081 float2 inputs:scale = ${zm(f)} 5082 float2 inputs:translation = ${zm(m)} 5083 float2 outputs:result 5084 } 5085 5086 def Shader "Texture_${a.id}_${l}" 5087 { 5088 uniform token info:id = "UsdUVTexture" 5089 asset inputs:file = @textures/Texture_${h}.png@ 5090 float2 inputs:st.connect = </Materials/Material_${r.id}/Transform2d_${l}.outputs:result> 5091 ${c!==void 0?"float4 inputs:scale = "+dB(c):""} 5092 token inputs:sourceColorSpace = "${a.colorSpace===vn?"raw":"sRGB"}" 5093 token inputs:wrapS = "${d[a.wrapS]}" 5094 token inputs:wrapT = "${d[a.wrapT]}" 5095 float outputs:r 5096 float outputs:g 5097 float outputs:b 5098 float3 outputs:rgb 5099 ${r.transparent||r.alphaTest>0?"float outputs:a":""} 5100 }`}return r.side===Yt&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",r),r.map!==null?(i.push(`${n}color3f inputs:diffuseColor.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:rgb>`),r.transparent?i.push(`${n}float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`):r.alphaTest>0&&(i.push(`${n}float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`),i.push(`${n}float inputs:opacityThreshold = ${r.alphaTest}`)),s.push(o(r.map,"diffuse",r.color))):i.push(`${n}color3f inputs:diffuseColor = ${Vm(r.color)}`),r.emissiveMap!==null?(i.push(`${n}color3f inputs:emissiveColor.connect = </Materials/Material_${r.id}/Texture_${r.emissiveMap.id}_emissive.outputs:rgb>`),s.push(o(r.emissiveMap,"emissive"))):r.emissive.getHex()>0&&i.push(`${n}color3f inputs:emissiveColor = ${Vm(r.emissive)}`),r.normalMap!==null&&(i.push(`${n}normal3f inputs:normal.connect = </Materials/Material_${r.id}/Texture_${r.normalMap.id}_normal.outputs:rgb>`),s.push(o(r.normalMap,"normal"))),r.aoMap!==null&&(i.push(`${n}float inputs:occlusion.connect = </Materials/Material_${r.id}/Texture_${r.aoMap.id}_occlusion.outputs:r>`),s.push(o(r.aoMap,"occlusion"))),r.roughnessMap!==null&&r.roughness===1?(i.push(`${n}float inputs:roughness.connect = </Materials/Material_${r.id}/Texture_${r.roughnessMap.id}_roughness.outputs:g>`),s.push(o(r.roughnessMap,"roughness"))):i.push(`${n}float inputs:roughness = ${r.roughness}`),r.metalnessMap!==null&&r.metalness===1?(i.push(`${n}float inputs:metallic.connect = </Materials/Material_${r.id}/Texture_${r.metalnessMap.id}_metallic.outputs:b>`),s.push(o(r.metalnessMap,"metallic"))):i.push(`${n}float inputs:metallic = ${r.metalness}`),r.alphaMap!==null?(i.push(`${n}float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.alphaMap.id}_opacity.outputs:r>`),i.push(`${n}float inputs:opacityThreshold = 0.0001`),s.push(o(r.alphaMap,"opacity"))):i.push(`${n}float inputs:opacity = ${r.opacity}`),r.isMeshPhysicalMaterial&&(i.push(`${n}float inputs:clearcoat = ${r.clearcoat}`),i.push(`${n}float inputs:clearcoatRoughness = ${r.clearcoatRoughness}`),i.push(`${n}float inputs:ior = ${r.ior}`)),` 5101 def Material "Material_${r.id}" 5102 { 5103 def Shader "PreviewSurface" 5104 { 5105 uniform token info:id = "UsdPreviewSurface" 5106${i.join(` 5107`)} 5108 int inputs:useSpecularWorkflow = 0 5109 token outputs:surface 5110 } 5111 5112 token outputs:surface.connect = </Materials/Material_${r.id}/PreviewSurface.outputs:surface> 5113 5114${s.join(` 5115`)} 5116 5117 } 5118`}function Vm(r){return`(${r.r}, ${r.g}, ${r.b})`}function dB(r){return`(${r.r}, ${r.g}, ${r.b}, 1.0)`}function zm(r){return`(${r.x}, ${r.y})`}function fB(r){const e=r.name?r.name:"Camera_"+r.id,t=u_(r.matrixWorld);return r.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r),r.isOrthographicCamera?`def Camera "${e}" 5119 { 5120 matrix4d xformOp:transform = ${t} 5121 uniform token[] xformOpOrder = ["xformOp:transform"] 5122 5123 float2 clippingRange = (${r.near.toPrecision(Xt)}, ${r.far.toPrecision(Xt)}) 5124 float horizontalAperture = ${((Math.abs(r.left)+Math.abs(r.right))*10).toPrecision(Xt)} 5125 float verticalAperture = ${((Math.abs(r.top)+Math.abs(r.bottom))*10).toPrecision(Xt)} 5126 token projection = "orthographic" 5127 } 5128 5129 `:`def Camera "${e}" 5130 { 5131 matrix4d xformOp:transform = ${t} 5132 uniform token[] xformOpOrder = ["xformOp:transform"] 5133 5134 float2 clippingRange = (${r.near.toPrecision(Xt)}, ${r.far.toPrecision(Xt)}) 5135 float focalLength = ${r.getFocalLength().toPrecision(Xt)} 5136 float focusDistance = ${r.focus.toPrecision(Xt)} 5137 float horizontalAperture = ${r.getFilmWidth().toPrecision(Xt)} 5138 token projection = "perspective" 5139 float verticalAperture = ${r.getFilmHeight().toPrecision(Xt)} 5140 } 5141 5142 `}/* @license 5143 * Copyright 2019 Google LLC. All Rights Reserved. 5144 * Licensed under the Apache License, Version 2.0 (the 'License');
5145 * you may not use this file except in compliance with the License. 5146 * You may obtain a copy of the License at 5147 * 5148 * http://www.apache.org/licenses/LICENSE-2.0 5149 * 5150 * Unless required by applicable law or agreed to in writing, software 5151 * distributed under the License is distributed on an 'AS IS' BASIS, 5152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5153 * See the License for the specific language governing permissions and 5154 * limitations under the License. 5155 */const AB=r=>e=>{try{const t=gi(e),n=(t.length?t[0].terms:[]).filter(i=>i&&i.type==="ident").map(i=>i.value).filter(i=>r.indexOf(i)>-1);return new Set(n)}catch{}return new Set};/* @license 5156 * Copyright 2019 Google LLC. All Rights Reserved. 5157 * Licensed under the Apache License, Version 2.0 (the 'License'); 5158 * you may not use this file except in compliance with the License. 5159 * You may obtain a copy of the License at 5160 * 5161 * http://www.apache.org/licenses/LICENSE-2.0 5162 * 5163 * Unless required by applicable law or agreed to in writing, software 5164 * distributed under the License is distributed on an 'AS IS' BASIS, 5165 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5166 * See the License for the specific language governing permissions and 5167 * limitations under the License. 5168 */var rr=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};let Wm=!1,$m=!1;const qm="#model-viewer-no-ar-fallback",pB=AB(["quick-look","scene-viewer","webxr","none"]),mB="webxr scene-viewer quick-look",_n={QUICK_LOOK:"quick-look",SCENE_VIEWER:"scene-viewer",WEBXR:"webxr",NONE:"none"},di=Symbol("arButtonContainer"),Xm=Symbol("enterARWithWebXR"),Ym=Symbol("openSceneViewer"),Km=Symbol("openIOSARQuickLook"),gB=Symbol("canActivateAR"),Wa=Symbol("arMode"),Qh=Symbol("arModes"),or=Symbol("arAnchor"),$a=Symbol("preload"),qa=Symbol("onARButtonContainerClick"),kh=Symbol("onARStatus"),Gh=Symbol("onARTracking"),Hh=Symbol("onARTap"),Ao=Symbol("selectARMode"),Vh=Symbol("triggerLoad"),_B=r=>{var e,t,n,i,s,o,a,l,c,h;class u extends r{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes=mB,this.iosSrc=null,this.xrEnvironment=!1,this[e]=!1,this[t]=this.shadowRoot.querySelector(".ar-button"),this[n]=document.createElement("a"),this[i]=new Set,this[s]=_n.NONE,this[o]=!1,this[a]=f=>{f.preventDefault(),this.activateAR()},this[l]=({status:f})=>{(f===Ui.NOT_PRESENTING||this[je].arRenderer.presentedScene===this[te])&&(this.setAttribute("ar-status",f),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:f}})),f===Ui.NOT_PRESENTING?this.removeAttribute("ar-tracking"):f===Ui.SESSION_STARTED&&this.setAttribute("ar-tracking",Iu.TRACKING))},this[c]=({status:f})=>{this.setAttribute("ar-tracking",f),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:f}}))},this[h]=f=>{f.data=="_apple_ar_quicklook_button_tapped"&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[Wa]!==_n.NONE}connectedCallback(){super.connectedCallback(),this[je].arRenderer.addEventListener("status",this[kh]),this.setAttribute("ar-status",Ui.NOT_PRESENTING),this[je].arRenderer.addEventListener("tracking",this[Gh]),this[or].addEventListener("message",this[Hh])}disconnectedCallback(){super.disconnectedCallback(),this[je].arRenderer.removeEventListener("status",this[kh]),this[je].arRenderer.removeEventListener("tracking",this[Gh]),this[or].removeEventListener("message",this[Hh])}update(f){super.update(f),f.has("arScale")&&(this[te].canScale=this.arScale!=="fixed"),f.has("arPlacement")&&(this[te].updateShadow(),this[Kt]()),f.has("arModes")&&(this[Qh]=pB(this.arModes)),(f.has("ar")||f.has("arModes")||f.has("src")||f.has("iosSrc"))&&this[Ao]()}async activateAR(){switch(this[Wa]){case _n.QUICK_LOOK:await this[Km]();break;case _n.WEBXR:await this[Xm]();break;case _n.SCENE_VIEWER:this[Ym]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities");break}}async[(e=gB,t=di,n=or,i=Qh,s=Wa,o=$a,a=qa,l=kh,c=Gh,h=Hh,Ao)](){var f;let m=_n.NONE;
vendor: 4,381 bytes, lines 5168-5170
5168if(this.ar){if(this.src!=null)for(const g of this[Qh]){if(g==="webxr"&&e0&&!Wm&&await this[je].arRenderer.supportsPresentation()){m=_n.WEBXR;break}if(g==="scene-viewer"&&!$m&&(ZC||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(!((f=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)===null||f===void 0)&&f.includes("XR")))){m=_n.SCENE_VIEWER;break}if(g==="quick-look"&&gA){m=_n.QUICK_LOOK;break}}m===_n.NONE&&this.iosSrc!=null&&gA&&(m=_n.QUICK_LOOK)}if(m!==_n.NONE)this[di].classList.add("enabled"),this[di].addEventListener("click",this[qa]);else if(this[di].classList.contains("enabled")){this[di].removeEventListener("click",this[qa]),this[di].classList.remove("enabled");const g=Ui.FAILED;this.setAttribute("ar-status",g),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:g}}))}this[Wa]=m}async[Xm](){console.log("Attempting to present in AR with WebXR..."),await this[Vh]();try{this[di].removeEventListener("click",this[qa]);const{arRenderer:f}=this[je];f.placeOnWall=this.arPlacement==="wall",await f.present(this[te],this.xrEnvironment)}catch(f){console.warn("Error while trying to present in AR with WebXR"),console.error(f),await this[je].arRenderer.stopPresenting(),Wm=!0,console.warn("Falling back to next ar-mode"),await this[Ao](),this.activateAR()}finally{this[Ao]()}}async[Vh](){this.loaded||(this[$a]=!0,this[Sr](),await rM(this,"load"),this[$a]=!1)}[Pr](){return super[Pr]()||this[$a]}[Ym](){const f=self.location.toString(),m=new URL(f),g=new URL(this.src,f);g.hash&&(g.hash="");const A=new URLSearchParams(g.search);if(m.hash=qm,A.set("mode","ar_preferred"),A.has("disable_occlusion")||A.set("disable_occlusion","true"),this.arScale==="fixed"&&A.set("resizable","false"),this.arPlacement==="wall"&&A.set("enable_vertical_placement","true"),A.has("sound")){const _=new URL(A.get("sound"),f);A.set("sound",_.toString())}if(A.has("link")){const _=new URL(A.get("link"),f);A.set("link",_.toString())}const p=`intent://arvr.google.com/scene-viewer/1.2?${A.toString()+"&file="+encodeURIComponent(g.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(m.toString())};end;`,x=()=>{self.location.hash===qm&&($m=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[Ao]())};self.addEventListener("hashchange",x,{once:!0}),this[or].setAttribute("href",p),console.log("Attempting to present in AR with Scene Viewer..."),this[or].click()}async[Km](){const f=!this.iosSrc;this[di].classList.remove("enabled");const m=f?await this.prepareUSDZ():this.iosSrc,g=new URL(m,self.location.toString());if(f){const x=self.location.toString(),_=new URL(x),S=new URL(this.src,_);S.hash&&(g.hash=S.hash)}this.arScale==="fixed"&&(g.hash&&(g.hash+="&"),g.hash+="allowsContentScaling=0");const A=this[or];A.setAttribute("rel","ar");const p=document.createElement("img");A.appendChild(p),A.setAttribute("href",g.toString()),f&&A.setAttribute("download","model.usdz"),A.style.display="none",A.isConnected||this.shadowRoot.appendChild(A),console.log("Attempting to present in AR with Quick Look..."),A.click(),A.removeChild(p),f&&URL.revokeObjectURL(m),this[di].classList.add("enabled")}async prepareUSDZ(){const f=this[Cs].beginActivity("usdz-conversion");await this[Vh]();const{model:m,shadow:g,target:A}=this[te];if(m==null)return"";let p=!1;g!=null&&(p=g.visible,g.visible=!1),f(.2);const x=new jT;A.remove(m),m.position.copy(A.position),m.updateWorldMatrix(!1,!0);const _=await x.parse(m);m.position.set(0,0,0),A.add(m);const S=new Blob([_],{type:"model/vnd.usdz+zip"}),C=URL.createObjectURL(S);return f(1),g!=null&&(g.visible=p),C}}return rr([ve({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),rr([ve({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),rr([ve({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),rr([ve({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),rr([ve({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),rr([ve({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u};/* @license 5169 * Copyright 2019 Google LLC. All Rights Reserved. 5170 * Licensed under the Apache License, Version 2.0 (the 'License');
5171 * you may not use this file except in compliance with the License. 5172 * You may obtain a copy of the License at 5173 * 5174 * http://www.apache.org/licenses/LICENSE-2.0 5175 * 5176 * Unless required by applicable law or agreed to in writing, software 5177 * distributed under the License is distributed on an 'AS IS' BASIS, 5178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5179 * See the License for the specific language governing permissions and 5180 * limitations under the License. 5181 */var zh=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const EB=100,vB="https://www.gstatic.com/draco/versioned/decoders/1.5.6/",yB="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/",xB="https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/LottieLoader.js",Wh={AUTO:"auto"},Jm={AUTO:"auto",EAGER:"eager"},ar=Symbol("defaultProgressBarElement"),$h=Symbol("posterContainerElement"),lr=Symbol("defaultPosterElement"),po=Symbol("shouldDismissPoster"),qh=Symbol("hidePoster"),Xa=Symbol("modelIsRevealed"),Xh=Symbol("updateProgressBar"),SB=Symbol("ariaLabelCallToAction"),Yh=Symbol("onProgress"),IB=r=>{var e,t,n,i,s,o,a,l;class c extends r{constructor(...u){super(...u),this.poster=null,this.reveal=Wh.AUTO,this.loading=Jm.AUTO,this[e]=!1,this[t]=!1,this[n]=this.shadowRoot.querySelector(".slot.poster"),this[i]=this.shadowRoot.querySelector("#default-poster"),this[s]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[o]=this[lr].getAttribute("aria-label"),this[a]=nM(A=>{const p=this[ar].parentNode;requestAnimationFrame(()=>{this[ar].style.transform=`scaleX(${A})`,A===0&&(p.removeChild(this[ar]),p.appendChild(this[ar])),this[ar].classList.toggle("hide",A===1)})},EB),this[l]=A=>{const p=A.detail.totalProgress,x=A.detail.reason;p===1&&(this[Xh].flush(),this.loaded&&(this[po]||this.reveal===Wh.AUTO)&&this[qh]()),this[Xh](p),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:p,reason:x}}))};const d=self.ModelViewerElement||{},f=d.dracoDecoderLocation||vB;Ut.setDRACODecoderLocation(f);const m=d.ktx2TranscoderLocation||yB;Ut.setKTX2TranscoderLocation(m),d.meshoptDecoderLocation&&Ut.setMeshoptDecoderLocation(d.meshoptDecoderLocation);const g=d.lottieLoaderLocation||xB;Ln.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(u){Ut.setDRACODecoderLocation(u)}static get dracoDecoderLocation(){return Ut.getDRACODecoderLocation()}static set ktx2TranscoderLocation(u){Ut.setKTX2TranscoderLocation(u)}static get ktx2TranscoderLocation(){return Ut.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(u){Ut.setMeshoptDecoderLocation(u)}static get meshoptDecoderLocation(){return Ut.getMeshoptDecoderLocation()}static set lottieLoaderLocation(u){Ln.singleton.textureUtils.lottieLoaderUrl=u}static get lottieLoaderLocation(){return Ln.singleton.textureUtils.lottieLoaderUrl}static mapURLs(u){Ln.singleton.loader[as].manager.setURLModifier(u)}dismissPoster(){this.loaded?this[qh]():(this[po]=!0,this[Sr]())}showPoster(){const u=this[$h];if(u.classList.contains("show"))return;u.classList.add("show"),this[Dn].classList.remove("show");const d=this[lr];d.removeAttribute("tabindex"),d.removeAttribute("aria-hidden");const f=this.modelIsVisible;this[Xa]=!1,this[wl](f)}getDimensions(){return Ni(this[te].size)}getBoundingBoxCenter(){return Ni(this[te].boundingBox.getCenter(new D))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Cs].addEventListener("progress",this[Yh])}disconnectedCallback(){super.disconnectedCallback(),this[Cs].removeEventListener("progress",this[Yh])}async updated(u){super.updated(u),u.has("poster")&&this.poster!=null&&(this[lr].style.backgroundImage=`url(${this.poster})`),u.has("alt")&&this[lr].setAttribute("aria-label",this[Tu]),(u.has("reveal")||u.has("loading"))&&this[Sr]()}[(e=Xa,t=po,n=$h,i=lr,s=ar,o=SB,a=Xh,l=Yh,Pr)](){return!!this.src&&(this[po]||this.loading===Jm.EAGER||this.reveal===Wh.AUTO&&this[us])}[qh](){this[po]=!1;const u=this[$h];if(!u.classList.contains("show"))return;u.classList.remove("show"),this[Dn].classList.add("show");const d=this.modelIsVisible;this[Xa]=!0,this[wl](d);const f=this.getRootNode();f&&f.activeElement===this&&this[Dn].focus();const m=this[lr];m.setAttribute("aria-hidden","true"),m.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Ms](){return super[Ms]()&&this[Xa]}}return zh([ve({type:String})],c.prototype,"poster",void 0),zh([ve({type:String})],c.prototype,"reveal",void 0),zh([ve({type:String})],c.prototype,"loading",void 0),c};/* @license 5182 * Copyright 2019 Google LLC. All Rights Reserved. 5183 * Licensed under the Apache License, Version 2.0 (the 'License');
5184 * you may not use this file except in compliance with the License. 5185 * You may obtain a copy of the License at 5186 * 5187 * http://www.apache.org/licenses/LICENSE-2.0 5188 * 5189 * Unless required by applicable law or agreed to in writing, software 5190 * distributed under the License is distributed on an 'AS IS' BASIS, 5191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5192 * See the License for the specific language governing permissions and 5193 * limitations under the License. 5194 */var Kh=function(r,e,t,n){for(var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o,a=r.length-1;a>=0;a--)(o=r[a])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const CB=Math.PI/32,MB=3e3,wB={basis:[Ol(Jt(CB,"rad"))],keywords:{auto:[null]}},cr=Symbol("autoRotateStartTime"),Jh=Symbol("radiansPerSecond"),jm=Symbol("syncRotationRate"),jh=Symbol("onCameraChange"),bB=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=MB,this.rotationPerSecond="auto",this[e]=performance.now(),this[t]=0,this[n]=o=>{this.autoRotate&&o.detail.source==="user-interaction"&&(this[cr]=
vendor: 1,799 bytes, lines 5194-5207
5194performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[jh]),this[cr]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[jh]),this[cr]=performance.now()}updated(o){super.updated(o),o.has("autoRotate")&&(this[cr]=performance.now())}[(e=cr,t=Jh,jm)](o){this[Jh]=o[0]}[Xn](o,a){if(super[Xn](o,a),!this.autoRotate||!this[Ms]()||this[je].isPresenting)return;const l=Math.min(a,o-this[cr]-this.autoRotateDelay);l>0&&(this[te].yaw=this.turntableRotation+this[Jh]*l*.001)}get turntableRotation(){return this[te].yaw}resetTurntableRotation(o=0){this[te].yaw=o}}return n=jh,Kh([ve({type:Boolean,attribute:"auto-rotate"})],i.prototype,"autoRotate",void 0),Kh([ve({type:Number,attribute:"auto-rotate-delay"})],i.prototype,"autoRotateDelay",void 0),Kh([Ri({intrinsics:wB,updateHandler:jm}),ve({type:String,attribute:"rotation-per-second"})],i.prototype,"rotationPerSecond",void 0),i};/* @license 5195 * Copyright 2019 Google LLC. All Rights Reserved. 5196 * Licensed under the Apache License, Version 2.0 (the 'License'); 5197 * you may not use this file except in compliance with the License. 5198 * You may obtain a copy of the License at 5199 * 5200 * http://www.apache.org/licenses/LICENSE-2.0 5201 * 5202 * Unless required by applicable law or agreed to in writing, software 5203 * distributed under the License is distributed on an 'AS IS' BASIS, 5204 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5205 * See the License for the specific language governing permissions and 5206 * limitations under the License. 5207 */const TB=NT(_T(bB(hM(Sb(_B(IB(UT(zo))))))));customElements.define("model-viewer",TB);export{Ug as CanvasTexture,Ei as FileLoader,Jn as Loader,TB as ModelViewerElement,Tt as NearestFilter};
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.