@crystaldesign/diva-core 25.12.0-beta.9 → 25.12.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/{ModalsWrapper-bf41cae7.js → ModalsWrapper-a240a47e.js} +2 -2
- package/build/esm/{index-2fd0ac8f.js → index-0d5dd25b.js} +296 -241
- package/build/esm/{index-e727eaed.js → index-b2b214c5.js} +1 -1
- package/build/esm/index.js +1 -1
- package/build/types/core/src/elements/DrawerMenu/index.d.ts.map +1 -1
- package/build/types/core/src/store/BrowserStateStore.d.ts.map +1 -1
- package/build/types/core/src/store/ContentStore.d.ts +1 -1
- package/build/types/core/src/store/ContentStore.d.ts.map +1 -1
- package/build/types/core/src/store/LoadingAndErrorStore.d.ts.map +1 -1
- package/build/types/core/src/store/RootStore.d.ts +10 -0
- package/build/types/core/src/store/RootStore.d.ts.map +1 -1
- package/build/types/core/src/store/index.d.ts +1 -1
- package/build/types/core/src/store/index.d.ts.map +1 -1
- package/build/types/core/src/utils/i18n.d.ts +2 -1
- package/build/types/core/src/utils/i18n.d.ts.map +1 -1
- package/build/umd/145.diva-core.umd.min.js +1 -1
- package/build/umd/703.diva-core.umd.min.js +1 -1
- package/build/umd/721.diva-core.umd.min.js +408 -0
- package/build/umd/{229.diva-core.umd.min.js.LICENSE.txt → 721.diva-core.umd.min.js.LICENSE.txt} +2 -2
- package/build/umd/diva-core.umd.min.js +3 -3
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
- package/build/umd/229.diva-core.umd.min.js +0 -408
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/*! For license information please see 721.diva-core.umd.min.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[721],{7721:(e,t,r)=>{r.r(t),r.d(t,{CanvasTexture:()=>CanvasTexture,FileLoader:()=>three_module_FileLoader,Loader:()=>Loader,ModelViewerElement:()=>Qp,NearestFilter:()=>x});const i=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}};function n(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):i(e,t)}var s;null===(s=window.HTMLSlotElement)||void 0===s||s.prototype.assignedElements;var o=r(5108);const l="163",c=100,h="attached",d=300,p=301,A=302,m=303,g=304,f=306,_=1e3,y=1001,E=1002,x=1003,C=1004,S=1005,I=1006,b=1007,T=1008,B=1009,U=1013,F=1014,Q=1015,O=1016,G=1020,W=1023,q=1026,j=1027,X=1028,Y=1030,K=33776,J=33777,$=33778,ee=33779,te=35840,ie=35842,ne=36196,re=37492,se=37496,ae=37808,oe=37812,le=36492,ce=2201,he=2202,ue=2300,de=2301,pe=2302,Ae=2400,me=2401,ge=2402,fe=2500,_e="",ve="srgb",ye="srgb-linear",Ee="display-p3",xe="display-p3-linear",Me="linear",Ce="srgb",Se="rec709",Ie="p3",be=7680,we=35044,Te="300 es",Be=2e3,Re=2001;class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const r=this._listeners[e];if(void 0!==r){const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const r=t.slice(0);for(let t=0,s=r.length;t<s;t++)r[t].call(this,e);e.target=null}}}const Le=["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 De=1234567;const Ue=Math.PI/180,Pe=180/Math.PI;function generateUUID(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,s=4294967295*Math.random()|0;return(Le[255&e]+Le[e>>8&255]+Le[e>>16&255]+Le[e>>24&255]+"-"+Le[255&t]+Le[t>>8&255]+"-"+Le[t>>16&15|64]+Le[t>>24&255]+"-"+Le[63&r|128]+Le[r>>8&255]+"-"+Le[r>>16&255]+Le[r>>24&255]+Le[255&s]+Le[s>>8&255]+Le[s>>16&255]+Le[s>>24&255]).toLowerCase()}function clamp(e,t,r){return Math.max(t,Math.min(r,e))}function euclideanModulo(e,t){return(e%t+t)%t}function lerp(e,t,r){return(1-r)*e+r*t}function denormalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function normalize(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Fe={DEG2RAD:Ue,RAD2DEG:Pe,generateUUID,clamp,euclideanModulo,mapLinear:function mapLinear(e,t,r,s,o){return s+(e-t)*(o-s)/(r-t)},inverseLerp:function inverseLerp(e,t,r){return e!==t?(r-e)/(t-e):0},lerp,damp:function damp(e,t,r,s){return lerp(e,t,1-Math.exp(-r*s))},pingpong:function pingpong(e,t=1){return t-Math.abs(euclideanModulo(e,2*t)-t)},smoothstep:function smoothstep(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function smootherstep(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function randInt(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function randFloat(e,t){return e+Math.random()*(t-e)},randFloatSpread:function randFloatSpread(e){return e*(.5-Math.random())},seededRandom:function seededRandom(e){void 0!==e&&(De=e);let t=De+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function degToRad(e){return e*Ue},radToDeg:function radToDeg(e){return e*Pe},isPowerOfTwo:function isPowerOfTwo(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function ceilPowerOfTwo(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function floorPowerOfTwo(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function setQuaternionFromProperEuler(e,t,r,s,l){const c=Math.cos,h=Math.sin,d=c(r/2),p=h(r/2),A=c((t+s)/2),m=h((t+s)/2),g=c((t-s)/2),f=h((t-s)/2),_=c((s-t)/2),y=h((s-t)/2);switch(l){case"XYX":e.set(d*m,p*g,p*f,d*A);break;case"YZY":e.set(p*f,d*m,p*g,d*A);break;case"ZXZ":e.set(p*g,p*f,d*m,d*A);break;case"XZX":e.set(d*m,p*y,p*_,d*A);break;case"YXY":e.set(p*_,d*m,p*y,d*A);break;case"ZYZ":e.set(p*y,p*_,d*m,d*A);break;default:o.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+l)}},normalize,denormalize};class Vector2{constructor(e=0,t=0){Vector2.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}sub(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,r=this.y,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6],this.y=s[1]*t+s[4]*r+s[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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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(0===t)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(clamp(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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 r=Math.cos(t),s=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*r-l*s+e.x,this.y=o*s+l*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(e,t,r,s,o,l,c,h,d){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,r,s,o,l,c,h,d)}set(e,t,r,s,o,l,c,h,d){const p=this.elements;return p[0]=e,p[1]=s,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=r,p[7]=l,p[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,s=t.elements,o=this.elements,l=r[0],c=r[3],h=r[6],d=r[1],p=r[4],A=r[7],m=r[2],g=r[5],f=r[8],_=s[0],y=s[3],E=s[6],x=s[1],C=s[4],S=s[7],I=s[2],b=s[5],T=s[8];return o[0]=l*_+c*x+h*I,o[3]=l*y+c*C+h*b,o[6]=l*E+c*S+h*T,o[1]=d*_+p*x+A*I,o[4]=d*y+p*C+A*b,o[7]=d*E+p*S+A*T,o[2]=m*_+g*x+f*I,o[5]=m*y+g*C+f*b,o[8]=m*E+g*S+f*T,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],r=e[1],s=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8];return t*l*p-t*c*d-r*o*p+r*c*h+s*o*d-s*l*h}invert(){const e=this.elements,t=e[0],r=e[1],s=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8],A=p*l-c*d,m=c*h-p*o,g=d*o-l*h,f=t*A+r*m+s*g;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const _=1/f;return e[0]=A*_,e[1]=(s*d-p*r)*_,e[2]=(c*r-s*l)*_,e[3]=m*_,e[4]=(p*t-s*h)*_,e[5]=(s*o-c*t)*_,e[6]=g*_,e[7]=(r*h-d*t)*_,e[8]=(l*t-r*o)*_,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,r,s,o,l,c){const h=Math.cos(o),d=Math.sin(o);return this.set(r*h,r*d,-r*(h*l+d*c)+l+e,-s*d,s*h,-s*(-d*l+h*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(Ne.makeScale(e,t)),this}rotate(e){return this.premultiply(Ne.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ne.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),r=Math.sin(e);return this.set(t,-r,0,r,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,r=e.elements;for(let e=0;e<9;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const Ne=new Matrix3;function arrayNeedsUint32(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function createElementNS(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function createCanvasElement(){const e=createElementNS("canvas");return e.style.display="block",e}const Qe={};function warnOnce(e){e in Qe||(Qe[e]=!0,o.warn(e))}const Oe=(new Matrix3).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ke=(new Matrix3).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ge={[ye]:{transfer:Me,primaries:Se,toReference:e=>e,fromReference:e=>e},[ve]:{transfer:Ce,primaries:Se,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[xe]:{transfer:Me,primaries:Ie,toReference:e=>e.applyMatrix3(ke),fromReference:e=>e.applyMatrix3(Oe)},[Ee]:{transfer:Ce,primaries:Ie,toReference:e=>e.convertSRGBToLinear().applyMatrix3(ke),fromReference:e=>e.applyMatrix3(Oe).convertLinearToSRGB()}},Ve=new Set([ye,xe]),He={enabled:!0,_workingColorSpace:ye,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!Ve.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,r){if(!1===this.enabled||t===r||!t||!r)return e;const s=Ge[t].toReference;return(0,Ge[r].fromReference)(s(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return Ge[e].primaries},getTransfer:function(e){return e===_e?Me:Ge[e].transfer}};function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function LinearToSRGB(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let ze;let We=0;class Source{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:We++}),this.uuid=generateUUID(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const r={uuid:this.uuid,url:""},s=this.data;if(null!==s){let e;if(Array.isArray(s)){e=[];for(let t=0,r=s.length;t<r;t++)s[t].isDataTexture?e.push(serializeImage(s[t].image)):e.push(serializeImage(s[t]))}else e=serializeImage(s);r.url=e}return t||(e.images[this.uuid]=r),r}}function serializeImage(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?class ImageUtils{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===ze&&(ze=createElementNS("canvas")),ze.width=e.width,ze.height=e.height;const r=ze.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=ze}return t.width>2048||t.height>2048?(o.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("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=createElementNS("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let e=0;e<o.length;e++)o[e]=255*SRGBToLinear(o[e]/255);return r.putImageData(s,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*SRGBToLinear(t[e]/255)):t[e]=SRGBToLinear(t[e]);return{data:t,width:e.width,height:e.height}}return o.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(o.warn("THREE.Texture: Unable to serialize Texture."),{})}let qe=0;class Texture extends EventDispatcher{constructor(e=Texture.DEFAULT_IMAGE,t=Texture.DEFAULT_MAPPING,r=1001,s=1001,o=1006,l=1008,c=1023,h=1009,d=Texture.DEFAULT_ANISOTROPY,p=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:qe++}),this.uuid=generateUUID(),this.name="",this.source=new Source(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=s,this.magFilter=o,this.minFilter=l,this.anisotropy=d,this.format=c,this.internalFormat=null,this.type=h,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,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=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const r={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&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==d)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case _:e.x=e.x-Math.floor(e.x);break;case y:e.x=e.x<0?0:1;break;case E:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case _:e.y=e.y-Math.floor(e.y);break;case y:e.y=e.y<0?0:1;break;case E:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=d,Texture.DEFAULT_ANISOTROPY=1;class Vector4{constructor(e=0,t=0,r=0,s=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=s}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,r,s){return this.x=e,this.y=t,this.z=r,this.w=s,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=void 0!==e.w?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,r=this.y,s=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*r+l[8]*s+l[12]*o,this.y=l[1]*t+l[5]*r+l[9]*s+l[13]*o,this.z=l[2]*t+l[6]*r+l[10]*s+l[14]*o,this.w=l[3]*t+l[7]*r+l[11]*s+l[15]*o,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,r,s,o;const l=.01,c=.1,h=e.elements,d=h[0],p=h[4],A=h[8],m=h[1],g=h[5],f=h[9],_=h[2],y=h[6],E=h[10];if(Math.abs(p-m)<l&&Math.abs(A-_)<l&&Math.abs(f-y)<l){if(Math.abs(p+m)<c&&Math.abs(A+_)<c&&Math.abs(f+y)<c&&Math.abs(d+g+E-3)<c)return this.set(1,0,0,0),this;t=Math.PI;const e=(d+1)/2,h=(g+1)/2,x=(E+1)/2,C=(p+m)/4,S=(A+_)/4,I=(f+y)/4;return e>h&&e>x?e<l?(r=0,s=.707106781,o=.707106781):(r=Math.sqrt(e),s=C/r,o=S/r):h>x?h<l?(r=.707106781,s=0,o=.707106781):(s=Math.sqrt(h),r=C/s,o=I/s):x<l?(r=.707106781,s=.707106781,o=0):(o=Math.sqrt(x),r=S/o,s=I/o),this.set(r,s,o,t),this}let x=Math.sqrt((y-f)*(y-f)+(A-_)*(A-_)+(m-p)*(m-p));return Math.abs(x)<.001&&(x=1),this.x=(y-f)/x,this.y=(A-_)/x,this.z=(m-p)/x,this.w=Math.acos((d+g+E-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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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 RenderTarget extends EventDispatcher{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t);const s={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:I,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},r);const o=new Texture(s,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);o.flipY=!1,o.generateMipmaps=r.generateMipmaps,o.internalFormat=r.internalFormat,this.textures=[];const l=r.count;for(let e=0;e<l;e++)this.textures[e]=o.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let s=0,o=this.textures.length;s<o;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=r;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 t=0,r=e.textures.length;t<r;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class WebGLRenderTarget extends RenderTarget{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class DataArrayTexture extends Texture{constructor(e=null,t=1,r=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:s},this.magFilter=x,this.minFilter=x,this.wrapR=y,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Data3DTexture extends Texture{constructor(e=null,t=1,r=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:s},this.magFilter=x,this.minFilter=x,this.wrapR=y,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class three_module_Quaternion{constructor(e=0,t=0,r=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=s}static slerpFlat(e,t,r,s,o,l,c){let h=r[s+0],d=r[s+1],p=r[s+2],A=r[s+3];const m=o[l+0],g=o[l+1],f=o[l+2],_=o[l+3];if(0===c)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=A);if(1===c)return e[t+0]=m,e[t+1]=g,e[t+2]=f,void(e[t+3]=_);if(A!==_||h!==m||d!==g||p!==f){let e=1-c;const t=h*m+d*g+p*f+A*_,r=t>=0?1:-1,s=1-t*t;if(s>Number.EPSILON){const o=Math.sqrt(s),l=Math.atan2(o,t*r);e=Math.sin(e*l)/o,c=Math.sin(c*l)/o}const o=c*r;if(h=h*e+m*o,d=d*e+g*o,p=p*e+f*o,A=A*e+_*o,e===1-c){const e=1/Math.sqrt(h*h+d*d+p*p+A*A);h*=e,d*=e,p*=e,A*=e}}e[t]=h,e[t+1]=d,e[t+2]=p,e[t+3]=A}static multiplyQuaternionsFlat(e,t,r,s,o,l){const c=r[s],h=r[s+1],d=r[s+2],p=r[s+3],A=o[l],m=o[l+1],g=o[l+2],f=o[l+3];return e[t]=c*f+p*A+h*g-d*m,e[t+1]=h*f+p*m+d*A-c*g,e[t+2]=d*f+p*g+c*m-h*A,e[t+3]=p*f-c*A-h*m-d*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,s){return this._x=e,this._y=t,this._z=r,this._w=s,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 r=e._x,s=e._y,l=e._z,c=e._order,h=Math.cos,d=Math.sin,p=h(r/2),A=h(s/2),m=h(l/2),g=d(r/2),f=d(s/2),_=d(l/2);switch(c){case"XYZ":this._x=g*A*m+p*f*_,this._y=p*f*m-g*A*_,this._z=p*A*_+g*f*m,this._w=p*A*m-g*f*_;break;case"YXZ":this._x=g*A*m+p*f*_,this._y=p*f*m-g*A*_,this._z=p*A*_-g*f*m,this._w=p*A*m+g*f*_;break;case"ZXY":this._x=g*A*m-p*f*_,this._y=p*f*m+g*A*_,this._z=p*A*_+g*f*m,this._w=p*A*m-g*f*_;break;case"ZYX":this._x=g*A*m-p*f*_,this._y=p*f*m+g*A*_,this._z=p*A*_-g*f*m,this._w=p*A*m+g*f*_;break;case"YZX":this._x=g*A*m+p*f*_,this._y=p*f*m+g*A*_,this._z=p*A*_-g*f*m,this._w=p*A*m-g*f*_;break;case"XZY":this._x=g*A*m-p*f*_,this._y=p*f*m-g*A*_,this._z=p*A*_+g*f*m,this._w=p*A*m+g*f*_;break;default:o.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,s=Math.sin(r);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],s=t[4],o=t[8],l=t[1],c=t[5],h=t[9],d=t[2],p=t[6],A=t[10],m=r+c+A;if(m>0){const e=.5/Math.sqrt(m+1);this._w=.25/e,this._x=(p-h)*e,this._y=(o-d)*e,this._z=(l-s)*e}else if(r>c&&r>A){const e=2*Math.sqrt(1+r-c-A);this._w=(p-h)/e,this._x=.25*e,this._y=(s+l)/e,this._z=(o+d)/e}else if(c>A){const e=2*Math.sqrt(1+c-r-A);this._w=(o-d)/e,this._x=(s+l)/e,this._y=.25*e,this._z=(h+p)/e}else{const e=2*Math.sqrt(1+A-r-c);this._w=(l-s)/e,this._x=(o+d)/e,this._y=(h+p)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(0===r)return this;const s=Math.min(1,t/r);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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 0===e?(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 r=e._x,s=e._y,o=e._z,l=e._w,c=t._x,h=t._y,d=t._z,p=t._w;return this._x=r*p+l*c+s*d-o*h,this._y=s*p+l*h+o*c-r*d,this._z=o*p+l*d+r*h-s*c,this._w=l*p-r*c-s*h-o*d,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const r=this._x,s=this._y,o=this._z,l=this._w;let c=l*e._w+r*e._x+s*e._y+o*e._z;if(c<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,c=-c):this.copy(e),c>=1)return this._w=l,this._x=r,this._y=s,this._z=o,this;const h=1-c*c;if(h<=Number.EPSILON){const e=1-t;return this._w=e*l+t*this._w,this._x=e*r+t*this._x,this._y=e*s+t*this._y,this._z=e*o+t*this._z,this.normalize(),this}const d=Math.sqrt(h),p=Math.atan2(d,c),A=Math.sin((1-t)*p)/d,m=Math.sin(t*p)/d;return this._w=l*A+this._w*m,this._x=r*A+this._x*m,this._y=s*A+this._y*m,this._z=o*A+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),s=Math.sqrt(1-r),o=Math.sqrt(r);return this.set(s*Math.sin(e),s*Math.cos(e),o*Math.sin(t),o*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 three_module_Vector3{constructor(e=0,t=0,r=0){three_module_Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,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(Xe.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Xe.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,s=this.z,o=e.elements;return this.x=o[0]*t+o[3]*r+o[6]*s,this.y=o[1]*t+o[4]*r+o[7]*s,this.z=o[2]*t+o[5]*r+o[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,s=this.z,o=e.elements,l=1/(o[3]*t+o[7]*r+o[11]*s+o[15]);return this.x=(o[0]*t+o[4]*r+o[8]*s+o[12])*l,this.y=(o[1]*t+o[5]*r+o[9]*s+o[13])*l,this.z=(o[2]*t+o[6]*r+o[10]*s+o[14])*l,this}applyQuaternion(e){const t=this.x,r=this.y,s=this.z,o=e.x,l=e.y,c=e.z,h=e.w,d=2*(l*s-c*r),p=2*(c*t-o*s),A=2*(o*r-l*t);return this.x=t+h*d+l*A-c*p,this.y=r+h*p+c*d-o*A,this.z=s+h*A+o*p-l*d,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,r=this.y,s=this.z,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*s,this.y=o[1]*t+o[5]*r+o[9]*s,this.z=o[2]*t+o[6]*r+o[10]*s,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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,s=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=s*h-o*c,this.y=o*l-r*h,this.z=r*c-s*l,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return je.copy(this).projectOnVector(e),this.sub(je)}reflect(e){return this.sub(je.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(clamp(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,s=this.z-e.z;return t*t+r*r+s*s}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,r){const s=Math.sin(t)*e;return this.x=s*Math.sin(r),this.y=Math.cos(t)*e,this.z=s*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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=2*Math.random()-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const je=new three_module_Vector3,Xe=new three_module_Quaternion;class Box3{constructor(e=new three_module_Vector3(1/0,1/0,1/0),t=new three_module_Vector3(-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,r=e.length;t<r;t+=3)this.expandByPoint(Ke.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(Ke.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=Ke.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 r=e.geometry;if(void 0!==r){const s=r.getAttribute("position");if(!0===t&&void 0!==s&&!0!==e.isInstancedMesh)for(let t=0,r=s.count;t<r;t++)!0===e.isMesh?e.getVertexPosition(t,Ke):Ke.fromBufferAttribute(s,t),Ke.applyMatrix4(e.matrixWorld),this.expandByPoint(Ke);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Je.copy(e.boundingBox)):(null===r.boundingBox&&r.computeBoundingBox(),Je.copy(r.boundingBox)),Je.applyMatrix4(e.matrixWorld),this.union(Je)}const s=e.children;for(let e=0,r=s.length;e<r;e++)this.expandByObject(s[e],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,Ke),Ke.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rt),st.subVectors(this.max,rt),$e.subVectors(e.a,rt),Ze.subVectors(e.b,rt),et.subVectors(e.c,rt),tt.subVectors(Ze,$e),it.subVectors(et,Ze),nt.subVectors($e,et);let t=[0,-tt.z,tt.y,0,-it.z,it.y,0,-nt.z,nt.y,tt.z,0,-tt.x,it.z,0,-it.x,nt.z,0,-nt.x,-tt.y,tt.x,0,-it.y,it.x,0,-nt.y,nt.x,0];return!!satForAxes(t,$e,Ze,et,st)&&(t=[1,0,0,0,1,0,0,0,1],!!satForAxes(t,$e,Ze,et,st)&&(at.crossVectors(tt,it),t=[at.x,at.y,at.z],satForAxes(t,$e,Ze,et,st)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ke).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Ke).length()),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()||(Ye[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ye[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ye[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ye[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ye[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ye[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ye[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ye[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ye)),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 Ye=[new three_module_Vector3,new three_module_Vector3,new three_module_Vector3,new three_module_Vector3,new three_module_Vector3,new three_module_Vector3,new three_module_Vector3,new three_module_Vector3],Ke=new three_module_Vector3,Je=new Box3,$e=new three_module_Vector3,Ze=new three_module_Vector3,et=new three_module_Vector3,tt=new three_module_Vector3,it=new three_module_Vector3,nt=new three_module_Vector3,rt=new three_module_Vector3,st=new three_module_Vector3,at=new three_module_Vector3,ot=new three_module_Vector3;function satForAxes(e,t,r,s,o){for(let l=0,c=e.length-3;l<=c;l+=3){ot.fromArray(e,l);const c=o.x*Math.abs(ot.x)+o.y*Math.abs(ot.y)+o.z*Math.abs(ot.z),h=t.dot(ot),d=r.dot(ot),p=s.dot(ot);if(Math.max(-Math.max(h,d,p),Math.min(h,d,p))>c)return!1}return!0}const lt=new Box3,ct=new three_module_Vector3,ht=new three_module_Vector3;class Sphere{constructor(e=new three_module_Vector3,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 r=this.center;void 0!==t?r.copy(t):lt.setFromPoints(e).getCenter(r);let s=0;for(let t=0,o=e.length;t<o;t++)s=Math.max(s,r.distanceToSquared(e[t]));return this.radius=Math.sqrt(s),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 r=this.center.distanceToSquared(e);return t.copy(e),r>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;ct.subVectors(e,this.center);const t=ct.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),r=.5*(e-this.radius);this.center.addScaledVector(ct,r/e),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(ht.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ct.copy(e.center).add(ht)),this.expandByPoint(ct.copy(e.center).sub(ht))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const ut=new three_module_Vector3,dt=new three_module_Vector3,pt=new three_module_Vector3,At=new three_module_Vector3,mt=new three_module_Vector3,gt=new three_module_Vector3,ft=new three_module_Vector3;class Ray{constructor(e=new three_module_Vector3,t=new three_module_Vector3(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,ut)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ut.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ut.copy(this.origin).addScaledVector(this.direction,t),ut.distanceToSquared(e))}distanceSqToSegment(e,t,r,s){dt.copy(e).add(t).multiplyScalar(.5),pt.copy(t).sub(e).normalize(),At.copy(this.origin).sub(dt);const o=.5*e.distanceTo(t),l=-this.direction.dot(pt),c=At.dot(this.direction),h=-At.dot(pt),d=At.lengthSq(),p=Math.abs(1-l*l);let A,m,g,f;if(p>0)if(A=l*h-c,m=l*c-h,f=o*p,A>=0)if(m>=-f)if(m<=f){const e=1/p;A*=e,m*=e,g=A*(A+l*m+2*c)+m*(l*A+m+2*h)+d}else m=o,A=Math.max(0,-(l*m+c)),g=-A*A+m*(m+2*h)+d;else m=-o,A=Math.max(0,-(l*m+c)),g=-A*A+m*(m+2*h)+d;else m<=-f?(A=Math.max(0,-(-l*o+c)),m=A>0?-o:Math.min(Math.max(-o,-h),o),g=-A*A+m*(m+2*h)+d):m<=f?(A=0,m=Math.min(Math.max(-o,-h),o),g=m*(m+2*h)+d):(A=Math.max(0,-(l*o+c)),m=A>0?o:Math.min(Math.max(-o,-h),o),g=-A*A+m*(m+2*h)+d);else m=l>0?-o:o,A=Math.max(0,-(l*m+c)),g=-A*A+m*(m+2*h)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,A),s&&s.copy(dt).addScaledVector(pt,m),g}intersectSphere(e,t){ut.subVectors(e.center,this.origin);const r=ut.dot(this.direction),s=ut.dot(ut)-r*r,o=e.radius*e.radius;if(s>o)return null;const l=Math.sqrt(o-s),c=r-l,h=r+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,s,o,l,c,h;const d=1/this.direction.x,p=1/this.direction.y,A=1/this.direction.z,m=this.origin;return d>=0?(r=(e.min.x-m.x)*d,s=(e.max.x-m.x)*d):(r=(e.max.x-m.x)*d,s=(e.min.x-m.x)*d),p>=0?(o=(e.min.y-m.y)*p,l=(e.max.y-m.y)*p):(o=(e.max.y-m.y)*p,l=(e.min.y-m.y)*p),r>l||o>s?null:((o>r||isNaN(r))&&(r=o),(l<s||isNaN(s))&&(s=l),A>=0?(c=(e.min.z-m.z)*A,h=(e.max.z-m.z)*A):(c=(e.max.z-m.z)*A,h=(e.min.z-m.z)*A),r>h||c>s?null:((c>r||r!=r)&&(r=c),(h<s||s!=s)&&(s=h),s<0?null:this.at(r>=0?r:s,t)))}intersectsBox(e){return null!==this.intersectBox(e,ut)}intersectTriangle(e,t,r,s,o){mt.subVectors(t,e),gt.subVectors(r,e),ft.crossVectors(mt,gt);let l,c=this.direction.dot(ft);if(c>0){if(s)return null;l=1}else{if(!(c<0))return null;l=-1,c=-c}At.subVectors(this.origin,e);const h=l*this.direction.dot(gt.crossVectors(At,gt));if(h<0)return null;const d=l*this.direction.dot(mt.cross(At));if(d<0)return null;if(h+d>c)return null;const p=-l*At.dot(ft);return p<0?null:this.at(p/c,o)}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 three_module_Matrix4{constructor(e,t,r,s,o,l,c,h,d,p,A,m,g,f,_,y){three_module_Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,r,s,o,l,c,h,d,p,A,m,g,f,_,y)}set(e,t,r,s,o,l,c,h,d,p,A,m,g,f,_,y){const E=this.elements;return E[0]=e,E[4]=t,E[8]=r,E[12]=s,E[1]=o,E[5]=l,E[9]=c,E[13]=h,E[2]=d,E[6]=p,E[10]=A,E[14]=m,E[3]=g,E[7]=f,E[11]=_,E[15]=y,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 three_module_Matrix4).fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,s=1/_t.setFromMatrixColumn(e,0).length(),o=1/_t.setFromMatrixColumn(e,1).length(),l=1/_t.setFromMatrixColumn(e,2).length();return t[0]=r[0]*s,t[1]=r[1]*s,t[2]=r[2]*s,t[3]=0,t[4]=r[4]*o,t[5]=r[5]*o,t[6]=r[6]*o,t[7]=0,t[8]=r[8]*l,t[9]=r[9]*l,t[10]=r[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,s=e.y,o=e.z,l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s),p=Math.cos(o),A=Math.sin(o);if("XYZ"===e.order){const e=l*p,r=l*A,s=c*p,o=c*A;t[0]=h*p,t[4]=-h*A,t[8]=d,t[1]=r+s*d,t[5]=e-o*d,t[9]=-c*h,t[2]=o-e*d,t[6]=s+r*d,t[10]=l*h}else if("YXZ"===e.order){const e=h*p,r=h*A,s=d*p,o=d*A;t[0]=e+o*c,t[4]=s*c-r,t[8]=l*d,t[1]=l*A,t[5]=l*p,t[9]=-c,t[2]=r*c-s,t[6]=o+e*c,t[10]=l*h}else if("ZXY"===e.order){const e=h*p,r=h*A,s=d*p,o=d*A;t[0]=e-o*c,t[4]=-l*A,t[8]=s+r*c,t[1]=r+s*c,t[5]=l*p,t[9]=o-e*c,t[2]=-l*d,t[6]=c,t[10]=l*h}else if("ZYX"===e.order){const e=l*p,r=l*A,s=c*p,o=c*A;t[0]=h*p,t[4]=s*d-r,t[8]=e*d+o,t[1]=h*A,t[5]=o*d+e,t[9]=r*d-s,t[2]=-d,t[6]=c*h,t[10]=l*h}else if("YZX"===e.order){const e=l*h,r=l*d,s=c*h,o=c*d;t[0]=h*p,t[4]=o-e*A,t[8]=s*A+r,t[1]=A,t[5]=l*p,t[9]=-c*p,t[2]=-d*p,t[6]=r*A+s,t[10]=e-o*A}else if("XZY"===e.order){const e=l*h,r=l*d,s=c*h,o=c*d;t[0]=h*p,t[4]=-A,t[8]=d*p,t[1]=e*A+o,t[5]=l*p,t[9]=r*A-s,t[2]=s*A-r,t[6]=c*p,t[10]=o*A+e}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(yt,e,Et)}lookAt(e,t,r){const s=this.elements;return Ct.subVectors(e,t),0===Ct.lengthSq()&&(Ct.z=1),Ct.normalize(),xt.crossVectors(r,Ct),0===xt.lengthSq()&&(1===Math.abs(r.z)?Ct.x+=1e-4:Ct.z+=1e-4,Ct.normalize(),xt.crossVectors(r,Ct)),xt.normalize(),Mt.crossVectors(Ct,xt),s[0]=xt.x,s[4]=Mt.x,s[8]=Ct.x,s[1]=xt.y,s[5]=Mt.y,s[9]=Ct.y,s[2]=xt.z,s[6]=Mt.z,s[10]=Ct.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,s=t.elements,o=this.elements,l=r[0],c=r[4],h=r[8],d=r[12],p=r[1],A=r[5],m=r[9],g=r[13],f=r[2],_=r[6],y=r[10],E=r[14],x=r[3],C=r[7],S=r[11],I=r[15],b=s[0],T=s[4],B=s[8],U=s[12],F=s[1],Q=s[5],O=s[9],G=s[13],W=s[2],q=s[6],j=s[10],X=s[14],Y=s[3],K=s[7],J=s[11],$=s[15];return o[0]=l*b+c*F+h*W+d*Y,o[4]=l*T+c*Q+h*q+d*K,o[8]=l*B+c*O+h*j+d*J,o[12]=l*U+c*G+h*X+d*$,o[1]=p*b+A*F+m*W+g*Y,o[5]=p*T+A*Q+m*q+g*K,o[9]=p*B+A*O+m*j+g*J,o[13]=p*U+A*G+m*X+g*$,o[2]=f*b+_*F+y*W+E*Y,o[6]=f*T+_*Q+y*q+E*K,o[10]=f*B+_*O+y*j+E*J,o[14]=f*U+_*G+y*X+E*$,o[3]=x*b+C*F+S*W+I*Y,o[7]=x*T+C*Q+S*q+I*K,o[11]=x*B+C*O+S*j+I*J,o[15]=x*U+C*G+S*X+I*$,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],r=e[4],s=e[8],o=e[12],l=e[1],c=e[5],h=e[9],d=e[13],p=e[2],A=e[6],m=e[10],g=e[14];return e[3]*(+o*h*A-s*d*A-o*c*m+r*d*m+s*c*g-r*h*g)+e[7]*(+t*h*g-t*d*m+o*l*m-s*l*g+s*d*p-o*h*p)+e[11]*(+t*d*A-t*c*g-o*l*A+r*l*g+o*c*p-r*d*p)+e[15]*(-s*c*p-t*h*A+t*c*m+s*l*A-r*l*m+r*h*p)}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,r){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],s=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8],A=e[9],m=e[10],g=e[11],f=e[12],_=e[13],y=e[14],E=e[15],x=A*y*d-_*m*d+_*h*g-c*y*g-A*h*E+c*m*E,C=f*m*d-p*y*d-f*h*g+l*y*g+p*h*E-l*m*E,S=p*_*d-f*A*d+f*c*g-l*_*g-p*c*E+l*A*E,I=f*A*h-p*_*h-f*c*m+l*_*m+p*c*y-l*A*y,b=t*x+r*C+s*S+o*I;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return e[0]=x*T,e[1]=(_*m*o-A*y*o-_*s*g+r*y*g+A*s*E-r*m*E)*T,e[2]=(c*y*o-_*h*o+_*s*d-r*y*d-c*s*E+r*h*E)*T,e[3]=(A*h*o-c*m*o-A*s*d+r*m*d+c*s*g-r*h*g)*T,e[4]=C*T,e[5]=(p*y*o-f*m*o+f*s*g-t*y*g-p*s*E+t*m*E)*T,e[6]=(f*h*o-l*y*o-f*s*d+t*y*d+l*s*E-t*h*E)*T,e[7]=(l*m*o-p*h*o+p*s*d-t*m*d-l*s*g+t*h*g)*T,e[8]=S*T,e[9]=(f*A*o-p*_*o-f*r*g+t*_*g+p*r*E-t*A*E)*T,e[10]=(l*_*o-f*c*o+f*r*d-t*_*d-l*r*E+t*c*E)*T,e[11]=(p*c*o-l*A*o-p*r*d+t*A*d+l*r*g-t*c*g)*T,e[12]=I*T,e[13]=(p*_*s-f*A*s+f*r*m-t*_*m-p*r*y+t*A*y)*T,e[14]=(f*c*s-l*_*s-f*r*h+t*_*h+l*r*y-t*c*y)*T,e[15]=(l*A*s-p*c*s+p*r*h-t*A*h-l*r*m+t*c*m)*T,this}scale(e){const t=this.elements,r=e.x,s=e.y,o=e.z;return t[0]*=r,t[4]*=s,t[8]*=o,t[1]*=r,t[5]*=s,t[9]*=o,t[2]*=r,t[6]*=s,t[10]*=o,t[3]*=r,t[7]*=s,t[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,s))}makeTranslation(e,t,r){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,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),s=Math.sin(t),o=1-r,l=e.x,c=e.y,h=e.z,d=o*l,p=o*c;return this.set(d*l+r,d*c-s*h,d*h+s*c,0,d*c+s*h,p*c+r,p*h-s*l,0,d*h-s*c,p*h+s*l,o*h*h+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,s,o,l){return this.set(1,r,o,0,e,1,l,0,t,s,1,0,0,0,0,1),this}compose(e,t,r){const s=this.elements,o=t._x,l=t._y,c=t._z,h=t._w,d=o+o,p=l+l,A=c+c,m=o*d,g=o*p,f=o*A,_=l*p,y=l*A,E=c*A,x=h*d,C=h*p,S=h*A,I=r.x,b=r.y,T=r.z;return s[0]=(1-(_+E))*I,s[1]=(g+S)*I,s[2]=(f-C)*I,s[3]=0,s[4]=(g-S)*b,s[5]=(1-(m+E))*b,s[6]=(y+x)*b,s[7]=0,s[8]=(f+C)*T,s[9]=(y-x)*T,s[10]=(1-(m+_))*T,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,r){const s=this.elements;let o=_t.set(s[0],s[1],s[2]).length();const l=_t.set(s[4],s[5],s[6]).length(),c=_t.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14],vt.copy(this);const h=1/o,d=1/l,p=1/c;return vt.elements[0]*=h,vt.elements[1]*=h,vt.elements[2]*=h,vt.elements[4]*=d,vt.elements[5]*=d,vt.elements[6]*=d,vt.elements[8]*=p,vt.elements[9]*=p,vt.elements[10]*=p,t.setFromRotationMatrix(vt),r.x=o,r.y=l,r.z=c,this}makePerspective(e,t,r,s,o,l,c=2e3){const h=this.elements,d=2*o/(t-e),p=2*o/(r-s),A=(t+e)/(t-e),m=(r+s)/(r-s);let g,f;if(c===Be)g=-(l+o)/(l-o),f=-2*l*o/(l-o);else{if(c!==Re)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);g=-l/(l-o),f=-l*o/(l-o)}return h[0]=d,h[4]=0,h[8]=A,h[12]=0,h[1]=0,h[5]=p,h[9]=m,h[13]=0,h[2]=0,h[6]=0,h[10]=g,h[14]=f,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,r,s,o,l,c=2e3){const h=this.elements,d=1/(t-e),p=1/(r-s),A=1/(l-o),m=(t+e)*d,g=(r+s)*p;let f,_;if(c===Be)f=(l+o)*A,_=-2*A;else{if(c!==Re)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);f=o*A,_=-1*A}return h[0]=2*d,h[4]=0,h[8]=0,h[12]=-m,h[1]=0,h[5]=2*p,h[9]=0,h[13]=-g,h[2]=0,h[6]=0,h[10]=_,h[14]=-f,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let e=0;e<16;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const _t=new three_module_Vector3,vt=new three_module_Matrix4,yt=new three_module_Vector3(0,0,0),Et=new three_module_Vector3(1,1,1),xt=new three_module_Vector3,Mt=new three_module_Vector3,Ct=new three_module_Vector3,St=new three_module_Matrix4,It=new three_module_Quaternion;class Euler{constructor(e=0,t=0,r=0,s=Euler.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=s}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,r,s=this._order){return this._x=e,this._y=t,this._z=r,this._order=s,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,r=!0){const s=e.elements,l=s[0],c=s[4],h=s[8],d=s[1],p=s[5],A=s[9],m=s[2],g=s[6],f=s[10];switch(t){case"XYZ":this._y=Math.asin(clamp(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-A,f),this._z=Math.atan2(-c,l)):(this._x=Math.atan2(g,p),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(h,f),this._z=Math.atan2(d,p)):(this._y=Math.atan2(-m,l),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-m,f),this._z=Math.atan2(-c,p)):(this._y=0,this._z=Math.atan2(d,l));break;case"ZYX":this._y=Math.asin(-clamp(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(g,f),this._z=Math.atan2(d,l)):(this._x=0,this._z=Math.atan2(-c,p));break;case"YZX":this._z=Math.asin(clamp(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-A,p),this._y=Math.atan2(-m,l)):(this._x=0,this._y=Math.atan2(h,f));break;case"XZY":this._z=Math.asin(-clamp(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(g,p),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-A,f),this._y=0);break;default:o.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return St.makeRotationFromQuaternion(e),this.setFromRotationMatrix(St,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return It.setFromEuler(this),this.setFromQuaternion(It,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],void 0!==e[3]&&(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}}Euler.DEFAULT_ORDER="XYZ";class Layers{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 0!=(this.mask&e.mask)}isEnabled(e){return 0!=(this.mask&(1<<e|0))}}let bt=0;const wt=new three_module_Vector3,Tt=new three_module_Quaternion,Bt=new three_module_Matrix4,Rt=new three_module_Vector3,Lt=new three_module_Vector3,Dt=new three_module_Vector3,Ut=new three_module_Quaternion,Pt=new three_module_Vector3(1,0,0),Ft=new three_module_Vector3(0,1,0),Nt=new three_module_Vector3(0,0,1),Qt={type:"added"},Ot={type:"removed"},kt={type:"childadded",child:null},Gt={type:"childremoved",child:null};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:bt++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();const e=new three_module_Vector3,t=new Euler,r=new three_module_Quaternion,s=new three_module_Vector3(1,1,1);t._onChange((function onRotationChange(){r.setFromEuler(t,!1)})),r._onChange((function onQuaternionChange(){t.setFromQuaternion(r,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new three_module_Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new three_module_Matrix4,this.matrixWorld=new three_module_Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,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 Tt.setFromAxisAngle(e,t),this.quaternion.multiply(Tt),this}rotateOnWorldAxis(e,t){return Tt.setFromAxisAngle(e,t),this.quaternion.premultiply(Tt),this}rotateX(e){return this.rotateOnAxis(Pt,e)}rotateY(e){return this.rotateOnAxis(Ft,e)}rotateZ(e){return this.rotateOnAxis(Nt,e)}translateOnAxis(e,t){return wt.copy(e).applyQuaternion(this.quaternion),this.position.add(wt.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Pt,e)}translateY(e){return this.translateOnAxis(Ft,e)}translateZ(e){return this.translateOnAxis(Nt,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bt.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?Rt.copy(e):Rt.set(e,t,r);const s=this.parent;this.updateWorldMatrix(!0,!1),Lt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bt.lookAt(Lt,Rt,this.up):Bt.lookAt(Rt,Lt,this.up),this.quaternion.setFromRotationMatrix(Bt),s&&(Bt.extractRotation(s.matrixWorld),Tt.setFromRotationMatrix(Bt),this.quaternion.premultiply(Tt.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(o.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(Qt),kt.child=e,this.dispatchEvent(kt),kt.child=null):o.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ot),Gt.child=e,this.dispatchEvent(Gt),Gt.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bt.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Bt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Qt),kt.child=e,this.dispatchEvent(kt),kt.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 r=0,s=this.children.length;r<s;r++){const s=this.children[r].getObjectByProperty(e,t);if(void 0!==s)return s}}getObjectsByProperty(e,t,r=[]){this[e]===t&&r.push(this);const s=this.children;for(let o=0,l=s.length;o<l;o++)s[o].getObjectsByProperty(e,t,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lt,e,Dt),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lt,Ut,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 r=0,s=t.length;r<s;r++)t[r].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let r=0,s=t.length;r<s;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(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)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,s=t.length;r<s;r++){const s=t[r];!0!==s.matrixWorldAutoUpdate&&!0!==e||s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const r=this.parent;if(!0===e&&null!==r&&!0===r.matrixWorldAutoUpdate&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){const e=this.children;for(let t=0,r=e.length;t<r;t++){const r=e[t];!0===r.matrixWorldAutoUpdate&&r.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};function serialize(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),null!==this.boundingSphere&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),null!==this.boundingBox&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=serialize(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const r=t.shapes;if(Array.isArray(r))for(let t=0,s=r.length;t<s;t++){const s=r[t];serialize(e.shapes,s)}else serialize(e.shapes,r)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let r=0,s=this.material.length;r<s;r++)t.push(serialize(e.materials,this.material[r]));s.material=t}else s.material=serialize(e.materials,this.material);if(this.children.length>0){s.children=[];for(let t=0;t<this.children.length;t++)s.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let t=0;t<this.animations.length;t++){const r=this.animations[t];s.animations.push(serialize(e.animations,r))}}if(t){const t=extractFromCache(e.geometries),s=extractFromCache(e.materials),o=extractFromCache(e.textures),l=extractFromCache(e.images),c=extractFromCache(e.shapes),h=extractFromCache(e.skeletons),d=extractFromCache(e.animations),p=extractFromCache(e.nodes);t.length>0&&(r.geometries=t),s.length>0&&(r.materials=s),o.length>0&&(r.textures=o),l.length>0&&(r.images=l),c.length>0&&(r.shapes=c),h.length>0&&(r.skeletons=h),d.length>0&&(r.animations=d),p.length>0&&(r.nodes=p)}return r.object=s,r;function extractFromCache(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}}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)),!0===t)for(let t=0;t<e.children.length;t++){const r=e.children[t];this.add(r.clone())}return this}}Object3D.DEFAULT_UP=new three_module_Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Vt=new three_module_Vector3,Ht=new three_module_Vector3,zt=new three_module_Vector3,Wt=new three_module_Vector3,qt=new three_module_Vector3,jt=new three_module_Vector3,Xt=new three_module_Vector3,Yt=new three_module_Vector3,Kt=new three_module_Vector3,Jt=new three_module_Vector3;class Triangle{constructor(e=new three_module_Vector3,t=new three_module_Vector3,r=new three_module_Vector3){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,s){s.subVectors(r,t),Vt.subVectors(e,t),s.cross(Vt);const o=s.lengthSq();return o>0?s.multiplyScalar(1/Math.sqrt(o)):s.set(0,0,0)}static getBarycoord(e,t,r,s,o){Vt.subVectors(s,t),Ht.subVectors(r,t),zt.subVectors(e,t);const l=Vt.dot(Vt),c=Vt.dot(Ht),h=Vt.dot(zt),d=Ht.dot(Ht),p=Ht.dot(zt),A=l*d-c*c;if(0===A)return o.set(0,0,0),null;const m=1/A,g=(d*h-c*p)*m,f=(l*p-c*h)*m;return o.set(1-g-f,f,g)}static containsPoint(e,t,r,s){return null!==this.getBarycoord(e,t,r,s,Wt)&&(Wt.x>=0&&Wt.y>=0&&Wt.x+Wt.y<=1)}static getInterpolation(e,t,r,s,o,l,c,h){return null===this.getBarycoord(e,t,r,s,Wt)?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,Wt.x),h.addScaledVector(l,Wt.y),h.addScaledVector(c,Wt.z),h)}static isFrontFacing(e,t,r,s){return Vt.subVectors(r,t),Ht.subVectors(e,t),Vt.cross(Ht).dot(s)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,s){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,r,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,s),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 Vt.subVectors(this.c,this.b),Ht.subVectors(this.a,this.b),.5*Vt.cross(Ht).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,s,o){return Triangle.getInterpolation(e,this.a,this.b,this.c,t,r,s,o)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,s=this.b,o=this.c;let l,c;qt.subVectors(s,r),jt.subVectors(o,r),Yt.subVectors(e,r);const h=qt.dot(Yt),d=jt.dot(Yt);if(h<=0&&d<=0)return t.copy(r);Kt.subVectors(e,s);const p=qt.dot(Kt),A=jt.dot(Kt);if(p>=0&&A<=p)return t.copy(s);const m=h*A-p*d;if(m<=0&&h>=0&&p<=0)return l=h/(h-p),t.copy(r).addScaledVector(qt,l);Jt.subVectors(e,o);const g=qt.dot(Jt),f=jt.dot(Jt);if(f>=0&&g<=f)return t.copy(o);const _=g*d-h*f;if(_<=0&&d>=0&&f<=0)return c=d/(d-f),t.copy(r).addScaledVector(jt,c);const y=p*f-g*A;if(y<=0&&A-p>=0&&g-f>=0)return Xt.subVectors(o,s),c=(A-p)/(A-p+(g-f)),t.copy(s).addScaledVector(Xt,c);const E=1/(y+_+m);return l=_*E,c=m*E,t.copy(r).addScaledVector(qt,l).addScaledVector(jt,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const $t={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},Zt={h:0,s:0,l:0},ei={h:0,s:0,l:0};function hue2rgb(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}class Color{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(void 0===t&&void 0===r){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,He.toWorkingColorSpace(this,t),this}setRGB(e,t,r,s=He.workingColorSpace){return this.r=e,this.g=t,this.b=r,He.toWorkingColorSpace(this,s),this}setHSL(e,t,r,s=He.workingColorSpace){if(e=euclideanModulo(e,1),t=clamp(t,0,1),r=clamp(r,0,1),0===t)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=hue2rgb(o,s,e+1/3),this.g=hue2rgb(o,s,e),this.b=hue2rgb(o,s,e-1/3)}return He.toWorkingColorSpace(this,s),this}setStyle(e,t="srgb"){function handleAlpha(t){void 0!==t&&parseFloat(t)<1&&o.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const l=r[1],c=r[2];switch(l){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return handleAlpha(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(c))return handleAlpha(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(c))return handleAlpha(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:o.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],l=s.length;if(3===l)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(6===l)return this.setHex(parseInt(s,16),t);o.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){const r=$t[e.toLowerCase()];return void 0!==r?this.setHex(r,t):o.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=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return He.fromWorkingColorSpace(ti.copy(this),e),65536*Math.round(clamp(255*ti.r,0,255))+256*Math.round(clamp(255*ti.g,0,255))+Math.round(clamp(255*ti.b,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=He.workingColorSpace){He.fromWorkingColorSpace(ti.copy(this),t);const r=ti.r,s=ti.g,o=ti.b,l=Math.max(r,s,o),c=Math.min(r,s,o);let h,d;const p=(c+l)/2;if(c===l)h=0,d=0;else{const e=l-c;switch(d=p<=.5?e/(l+c):e/(2-l-c),l){case r:h=(s-o)/e+(s<o?6:0);break;case s:h=(o-r)/e+2;break;case o:h=(r-s)/e+4}h/=6}return e.h=h,e.s=d,e.l=p,e}getRGB(e,t=He.workingColorSpace){return He.fromWorkingColorSpace(ti.copy(this),t),e.r=ti.r,e.g=ti.g,e.b=ti.b,e}getStyle(e="srgb"){He.fromWorkingColorSpace(ti.copy(this),e);const t=ti.r,r=ti.g,s=ti.b;return e!==ve?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*r)},${Math.round(255*s)})`}offsetHSL(e,t,r){return this.getHSL(Zt),this.setHSL(Zt.h+e,Zt.s+t,Zt.l+r)}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,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Zt),e.getHSL(ei);const r=lerp(Zt.h,ei.h,t),s=lerp(Zt.s,ei.s,t),o=lerp(Zt.l,ei.l,t);return this.setHSL(r,s,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,r=this.g,s=this.b,o=e.elements;return this.r=o[0]*t+o[3]*r+o[6]*s,this.g=o[1]*t+o[4]*r+o[7]*s,this.b=o[2]*t+o[5]*r+o[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ti=new Color;Color.NAMES=$t;let ii=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ii++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Color(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=be,this.stencilZFail=be,this.stencilZPass=be,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(void 0!==e)for(const t in e){const r=e[t];if(void 0===r){o.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];void 0!==s?s&&s.isColor?s.set(r):s&&s.isVector3&&r&&r.isVector3?s.copy(r):this[t]=r:o.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function extractFromCache(e){const t=[];for(const r in e){const s=e[r];delete s.metadata,t.push(s)}return t}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),void 0!==this.sheen&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(r.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(r.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(r.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(r.combine=this.combine)),void 0!==this.envMapRotation&&(r.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(r.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(r.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(r.size=this.size),null!==this.shadowSide&&(r.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(r.blending=this.blending),0!==this.side&&(r.side=this.side),!0===this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=!0),204!==this.blendSrc&&(r.blendSrc=this.blendSrc),205!==this.blendDst&&(r.blendDst=this.blendDst),this.blendEquation!==c&&(r.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(r.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(r.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(r.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(r.depthFunc=this.depthFunc),!1===this.depthTest&&(r.depthTest=this.depthTest),!1===this.depthWrite&&(r.depthWrite=this.depthWrite),!1===this.colorWrite&&(r.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(r.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(r.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(r.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==be&&(r.stencilFail=this.stencilFail),this.stencilZFail!==be&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==be&&(r.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(r.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.alphaHash&&(r.alphaHash=!0),!0===this.alphaToCoverage&&(r.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=!0),!0===this.forceSinglePass&&(r.forceSinglePass=!0),!0===this.wireframe&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(r.flatShading=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),!1===this.fog&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData),t){const t=extractFromCache(e.textures),s=extractFromCache(e.images);t.length>0&&(r.textures=t),s.length>0&&(r.images=s)}return r}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 r=null;if(null!==t){const e=t.length;r=new Array(e);for(let s=0;s!==e;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,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){!0===e&&this.version++}}class MeshBasicMaterial extends Material{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(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 Euler,this.combine=0,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 ni=_generateTables();function _generateTables(){const e=new ArrayBuffer(4),t=new Float32Array(e),r=new Uint32Array(e),s=new Uint32Array(512),o=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(s[e]=0,s[256|e]=32768,o[e]=24,o[256|e]=24):t<-14?(s[e]=1024>>-t-14,s[256|e]=1024>>-t-14|32768,o[e]=-t-1,o[256|e]=-t-1):t<=15?(s[e]=t+15<<10,s[256|e]=t+15<<10|32768,o[e]=13,o[256|e]=13):t<128?(s[e]=31744,s[256|e]=64512,o[e]=24,o[256|e]=24):(s[e]=31744,s[256|e]=64512,o[e]=13,o[256|e]=13)}const l=new Uint32Array(2048),c=new Uint32Array(64),h=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,r=0;for(;0==(8388608&t);)t<<=1,r-=8388608;t&=-8388609,r+=947912704,l[e]=t|r}for(let e=1024;e<2048;++e)l[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)c[e]=e<<23;c[31]=1199570944,c[32]=2147483648;for(let e=33;e<63;++e)c[e]=2147483648+(e-32<<23);c[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(h[e]=1024);return{floatView:t,uint32View:r,baseTable:s,shiftTable:o,mantissaTable:l,exponentTable:c,offsetTable:h}}function toHalfFloat(e){Math.abs(e)>65504&&o.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=clamp(e,-65504,65504),ni.floatView[0]=e;const t=ni.uint32View[0],r=t>>23&511;return ni.baseTable[r]+((8388607&t)>>ni.shiftTable[r])}function fromHalfFloat(e){const t=e>>10;return ni.uint32View[0]=ni.mantissaTable[ni.offsetTable[t]+(1023&e)]+ni.exponentTable[t],ni.floatView[0]}const ri={toHalfFloat,fromHalfFloat},si=new three_module_Vector3,ai=new Vector2;class three_module_BufferAttribute{constructor(e,t,r=!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=void 0!==e?e.length/t:0,this.normalized=r,this.usage=we,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Q,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return warnOnce("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,r){e*=this.itemSize,r*=t.itemSize;for(let s=0,o=this.itemSize;s<o;s++)this.array[e+s]=t.array[r+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,r=this.count;t<r;t++)ai.fromBufferAttribute(this,t),ai.applyMatrix3(e),this.setXY(t,ai.x,ai.y);else if(3===this.itemSize)for(let t=0,r=this.count;t<r;t++)si.fromBufferAttribute(this,t),si.applyMatrix3(e),this.setXYZ(t,si.x,si.y,si.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)si.fromBufferAttribute(this,t),si.applyMatrix4(e),this.setXYZ(t,si.x,si.y,si.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)si.fromBufferAttribute(this,t),si.applyNormalMatrix(e),this.setXYZ(t,si.x,si.y,si.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)si.fromBufferAttribute(this,t),si.transformDirection(e),this.setXYZ(t,si.x,si.y,si.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=denormalize(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=normalize(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(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=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(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=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,s){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),s=normalize(s,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=s,this}setXYZW(e,t,r,s,o){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),s=normalize(s,this.array),o=normalize(o,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=s,this.array[e+3]=o,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!==we&&(e.usage=this.usage),e}}class Uint16BufferAttribute extends three_module_BufferAttribute{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class Uint32BufferAttribute extends three_module_BufferAttribute{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class three_module_Float32BufferAttribute extends three_module_BufferAttribute{constructor(e,t,r){super(new Float32Array(e),t,r)}}let oi=0;const li=new three_module_Matrix4,ci=new Object3D,hi=new three_module_Vector3,ui=new Box3,di=new Box3,pi=new three_module_Vector3;class three_module_BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oi++}),this.uuid=generateUUID(),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(arrayNeedsUint32(e)?Uint32BufferAttribute:Uint16BufferAttribute)(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 void 0!==this.attributes[e]}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(void 0!==r){const t=(new Matrix3).getNormalMatrix(e);r.applyNormalMatrix(t),r.needsUpdate=!0}const s=this.attributes.tangent;return void 0!==s&&(s.transformDirection(e),s.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return li.makeRotationFromQuaternion(e),this.applyMatrix4(li),this}rotateX(e){return li.makeRotationX(e),this.applyMatrix4(li),this}rotateY(e){return li.makeRotationY(e),this.applyMatrix4(li),this}rotateZ(e){return li.makeRotationZ(e),this.applyMatrix4(li),this}translate(e,t,r){return li.makeTranslation(e,t,r),this.applyMatrix4(li),this}scale(e,t,r){return li.makeScale(e,t,r),this.applyMatrix4(li),this}lookAt(e){return ci.lookAt(e),ci.updateMatrix(),this.applyMatrix4(ci.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hi).negate(),this.translate(hi.x,hi.y,hi.z),this}setFromPoints(e){const t=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new three_module_Float32BufferAttribute(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return o.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new three_module_Vector3(-1/0,-1/0,-1/0),new three_module_Vector3(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){const r=t[e];ui.setFromBufferAttribute(r),this.morphTargetsRelative?(pi.addVectors(this.boundingBox.min,ui.min),this.boundingBox.expandByPoint(pi),pi.addVectors(this.boundingBox.max,ui.max),this.boundingBox.expandByPoint(pi)):(this.boundingBox.expandByPoint(ui.min),this.boundingBox.expandByPoint(ui.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&o.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return o.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new three_module_Vector3,1/0);if(e){const r=this.boundingSphere.center;if(ui.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){const r=t[e];di.setFromBufferAttribute(r),this.morphTargetsRelative?(pi.addVectors(ui.min,di.min),ui.expandByPoint(pi),pi.addVectors(ui.max,di.max),ui.expandByPoint(pi)):(ui.expandByPoint(di.min),ui.expandByPoint(di.max))}ui.getCenter(r);let s=0;for(let t=0,o=e.count;t<o;t++)pi.fromBufferAttribute(e,t),s=Math.max(s,r.distanceToSquared(pi));if(t)for(let o=0,l=t.length;o<l;o++){const l=t[o],c=this.morphTargetsRelative;for(let t=0,o=l.count;t<o;t++)pi.fromBufferAttribute(l,t),c&&(hi.fromBufferAttribute(e,t),pi.add(hi)),s=Math.max(s,r.distanceToSquared(pi))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&o.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(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void o.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const r=t.position,s=t.normal,l=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new three_module_BufferAttribute(new Float32Array(4*r.count),4));const c=this.getAttribute("tangent"),h=[],d=[];for(let e=0;e<r.count;e++)h[e]=new three_module_Vector3,d[e]=new three_module_Vector3;const p=new three_module_Vector3,A=new three_module_Vector3,m=new three_module_Vector3,g=new Vector2,f=new Vector2,_=new Vector2,y=new three_module_Vector3,E=new three_module_Vector3;function handleTriangle(e,t,s){p.fromBufferAttribute(r,e),A.fromBufferAttribute(r,t),m.fromBufferAttribute(r,s),g.fromBufferAttribute(l,e),f.fromBufferAttribute(l,t),_.fromBufferAttribute(l,s),A.sub(p),m.sub(p),f.sub(g),_.sub(g);const o=1/(f.x*_.y-_.x*f.y);isFinite(o)&&(y.copy(A).multiplyScalar(_.y).addScaledVector(m,-f.y).multiplyScalar(o),E.copy(m).multiplyScalar(f.x).addScaledVector(A,-_.x).multiplyScalar(o),h[e].add(y),h[t].add(y),h[s].add(y),d[e].add(E),d[t].add(E),d[s].add(E))}let x=this.groups;0===x.length&&(x=[{start:0,count:e.count}]);for(let t=0,r=x.length;t<r;++t){const r=x[t],s=r.start;for(let t=s,o=s+r.count;t<o;t+=3)handleTriangle(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const C=new three_module_Vector3,S=new three_module_Vector3,I=new three_module_Vector3,b=new three_module_Vector3;function handleVertex(e){I.fromBufferAttribute(s,e),b.copy(I);const t=h[e];C.copy(t),C.sub(I.multiplyScalar(I.dot(t))).normalize(),S.crossVectors(b,t);const r=S.dot(d[e])<0?-1:1;c.setXYZW(e,C.x,C.y,C.z,r)}for(let t=0,r=x.length;t<r;++t){const r=x[t],s=r.start;for(let t=s,o=s+r.count;t<o;t+=3)handleVertex(e.getX(t+0)),handleVertex(e.getX(t+1)),handleVertex(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let r=this.getAttribute("normal");if(void 0===r)r=new three_module_BufferAttribute(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(let e=0,t=r.count;e<t;e++)r.setXYZ(e,0,0,0);const s=new three_module_Vector3,o=new three_module_Vector3,l=new three_module_Vector3,c=new three_module_Vector3,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,A=new three_module_Vector3;if(e)for(let m=0,g=e.count;m<g;m+=3){const g=e.getX(m+0),f=e.getX(m+1),_=e.getX(m+2);s.fromBufferAttribute(t,g),o.fromBufferAttribute(t,f),l.fromBufferAttribute(t,_),p.subVectors(l,o),A.subVectors(s,o),p.cross(A),c.fromBufferAttribute(r,g),h.fromBufferAttribute(r,f),d.fromBufferAttribute(r,_),c.add(p),h.add(p),d.add(p),r.setXYZ(g,c.x,c.y,c.z),r.setXYZ(f,h.x,h.y,h.z),r.setXYZ(_,d.x,d.y,d.z)}else for(let e=0,c=t.count;e<c;e+=3)s.fromBufferAttribute(t,e+0),o.fromBufferAttribute(t,e+1),l.fromBufferAttribute(t,e+2),p.subVectors(l,o),A.subVectors(s,o),p.cross(A),r.setXYZ(e+0,p.x,p.y,p.z),r.setXYZ(e+1,p.x,p.y,p.z),r.setXYZ(e+2,p.x,p.y,p.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)pi.fromBufferAttribute(e,t),pi.normalize(),e.setXYZ(t,pi.x,pi.y,pi.z)}toNonIndexed(){function convertBufferAttribute(e,t){const r=e.array,s=e.itemSize,o=e.normalized,l=new r.constructor(t.length*s);let c=0,h=0;for(let o=0,d=t.length;o<d;o++){c=e.isInterleavedBufferAttribute?t[o]*e.data.stride+e.offset:t[o]*s;for(let e=0;e<s;e++)l[h++]=r[c++]}return new three_module_BufferAttribute(l,s,o)}if(null===this.index)return o.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new three_module_BufferGeometry,t=this.index.array,r=this.attributes;for(const s in r){const o=convertBufferAttribute(r[s],t);e.setAttribute(s,o)}const s=this.morphAttributes;for(const r in s){const o=[],l=s[r];for(let e=0,r=l.length;e<r;e++){const r=convertBufferAttribute(l[e],t);o.push(r)}e.morphAttributes[r]=o}e.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let t=0,r=l.length;t<r;t++){const r=l[t];e.addGroup(r.start,r.count,r.materialIndex)}return e}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),void 0!==this.parameters){const t=this.parameters;for(const r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const t in r){const s=r[t];e.data.attributes[t]=s.toJSON(e.data)}const s={};let o=!1;for(const t in this.morphAttributes){const r=this.morphAttributes[t],l=[];for(let t=0,s=r.length;t<s;t++){const s=r[t];l.push(s.toJSON(e.data))}l.length>0&&(s[t]=l,o=!0)}o&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.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 r=e.index;null!==r&&this.setIndex(r.clone(t));const s=e.attributes;for(const e in s){const r=s[e];this.setAttribute(e,r.clone(t))}const o=e.morphAttributes;for(const e in o){const r=[],s=o[e];for(let e=0,o=s.length;e<o;e++)r.push(s[e].clone(t));this.morphAttributes[e]=r}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let e=0,t=l.length;e<t;e++){const t=l[e];this.addGroup(t.start,t.count,t.materialIndex)}const c=e.boundingBox;null!==c&&(this.boundingBox=c.clone());const h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ai=new three_module_Matrix4,mi=new Ray,gi=new Sphere,fi=new three_module_Vector3,_i=new three_module_Vector3,vi=new three_module_Vector3,yi=new three_module_Vector3,xi=new three_module_Vector3,Mi=new three_module_Vector3,Ci=new Vector2,bi=new Vector2,wi=new Vector2,Ti=new three_module_Vector3,Bi=new three_module_Vector3,Ri=new three_module_Vector3,Li=new three_module_Vector3,Di=new three_module_Vector3;class three_module_Mesh extends Object3D{constructor(e=new three_module_BufferGeometry,t=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){const t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const r=this.geometry,s=r.attributes.position,o=r.morphAttributes.position,l=r.morphTargetsRelative;t.fromBufferAttribute(s,e);const c=this.morphTargetInfluences;if(o&&c){Mi.set(0,0,0);for(let r=0,s=o.length;r<s;r++){const s=c[r],h=o[r];0!==s&&(xi.fromBufferAttribute(h,e),l?Mi.addScaledVector(xi,s):Mi.addScaledVector(xi.sub(t),s))}t.add(Mi)}return t}raycast(e,t){const r=this.geometry,s=this.material,o=this.matrixWorld;if(void 0!==s){if(null===r.boundingSphere&&r.computeBoundingSphere(),gi.copy(r.boundingSphere),gi.applyMatrix4(o),mi.copy(e.ray).recast(e.near),!1===gi.containsPoint(mi.origin)){if(null===mi.intersectSphere(gi,fi))return;if(mi.origin.distanceToSquared(fi)>(e.far-e.near)**2)return}Ai.copy(o).invert(),mi.copy(e.ray).applyMatrix4(Ai),null!==r.boundingBox&&!1===mi.intersectsBox(r.boundingBox)||this._computeIntersections(e,t,mi)}}_computeIntersections(e,t,r){let s;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,d=o.attributes.uv,p=o.attributes.uv1,A=o.attributes.normal,m=o.groups,g=o.drawRange;if(null!==c)if(Array.isArray(l))for(let o=0,h=m.length;o<h;o++){const h=m[o],f=l[h.materialIndex];for(let o=Math.max(h.start,g.start),l=Math.min(c.count,Math.min(h.start+h.count,g.start+g.count));o<l;o+=3){s=checkGeometryIntersection(this,f,e,r,d,p,A,c.getX(o),c.getX(o+1),c.getX(o+2)),s&&(s.faceIndex=Math.floor(o/3),s.face.materialIndex=h.materialIndex,t.push(s))}}else{for(let o=Math.max(0,g.start),h=Math.min(c.count,g.start+g.count);o<h;o+=3){s=checkGeometryIntersection(this,l,e,r,d,p,A,c.getX(o),c.getX(o+1),c.getX(o+2)),s&&(s.faceIndex=Math.floor(o/3),t.push(s))}}else if(void 0!==h)if(Array.isArray(l))for(let o=0,c=m.length;o<c;o++){const c=m[o],f=l[c.materialIndex];for(let o=Math.max(c.start,g.start),l=Math.min(h.count,Math.min(c.start+c.count,g.start+g.count));o<l;o+=3){s=checkGeometryIntersection(this,f,e,r,d,p,A,o,o+1,o+2),s&&(s.faceIndex=Math.floor(o/3),s.face.materialIndex=c.materialIndex,t.push(s))}}else{for(let o=Math.max(0,g.start),c=Math.min(h.count,g.start+g.count);o<c;o+=3){s=checkGeometryIntersection(this,l,e,r,d,p,A,o,o+1,o+2),s&&(s.faceIndex=Math.floor(o/3),t.push(s))}}}}function checkGeometryIntersection(e,t,r,s,o,l,c,h,d,p){e.getVertexPosition(h,_i),e.getVertexPosition(d,vi),e.getVertexPosition(p,yi);const A=function checkIntersection(e,t,r,s,o,l,c,h){let d;if(d=1===t.side?s.intersectTriangle(c,l,o,!0,h):s.intersectTriangle(o,l,c,0===t.side,h),null===d)return null;Di.copy(h),Di.applyMatrix4(e.matrixWorld);const p=r.ray.origin.distanceTo(Di);return p<r.near||p>r.far?null:{distance:p,point:Di.clone(),object:e}}(e,t,r,s,_i,vi,yi,Li);if(A){o&&(Ci.fromBufferAttribute(o,h),bi.fromBufferAttribute(o,d),wi.fromBufferAttribute(o,p),A.uv=Triangle.getInterpolation(Li,_i,vi,yi,Ci,bi,wi,new Vector2)),l&&(Ci.fromBufferAttribute(l,h),bi.fromBufferAttribute(l,d),wi.fromBufferAttribute(l,p),A.uv1=Triangle.getInterpolation(Li,_i,vi,yi,Ci,bi,wi,new Vector2)),c&&(Ti.fromBufferAttribute(c,h),Bi.fromBufferAttribute(c,d),Ri.fromBufferAttribute(c,p),A.normal=Triangle.getInterpolation(Li,_i,vi,yi,Ti,Bi,Ri,new three_module_Vector3),A.normal.dot(s.direction)>0&&A.normal.multiplyScalar(-1));const e={a:h,b:d,c:p,normal:new three_module_Vector3,materialIndex:0};Triangle.getNormal(_i,vi,yi,e.normal),A.face=e}return A}class BoxGeometry extends three_module_BufferGeometry{constructor(e=1,t=1,r=1,s=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:s,heightSegments:o,depthSegments:l};const c=this;s=Math.floor(s),o=Math.floor(o),l=Math.floor(l);const h=[],d=[],p=[],A=[];let m=0,g=0;function buildPlane(e,t,r,s,o,l,f,_,y,E,x){const C=l/y,S=f/E,I=l/2,b=f/2,T=_/2,B=y+1,U=E+1;let F=0,Q=0;const O=new three_module_Vector3;for(let l=0;l<U;l++){const c=l*S-b;for(let h=0;h<B;h++){const m=h*C-I;O[e]=m*s,O[t]=c*o,O[r]=T,d.push(O.x,O.y,O.z),O[e]=0,O[t]=0,O[r]=_>0?1:-1,p.push(O.x,O.y,O.z),A.push(h/y),A.push(1-l/E),F+=1}}for(let e=0;e<E;e++)for(let t=0;t<y;t++){const r=m+t+B*e,s=m+t+B*(e+1),o=m+(t+1)+B*(e+1),l=m+(t+1)+B*e;h.push(r,s,l),h.push(s,o,l),Q+=6}c.addGroup(g,Q,x),g+=Q,m+=F}buildPlane("z","y","x",-1,-1,r,t,e,l,o,0),buildPlane("z","y","x",1,-1,r,t,-e,l,o,1),buildPlane("x","z","y",1,1,e,r,t,s,l,2),buildPlane("x","z","y",1,-1,e,r,-t,s,l,3),buildPlane("x","y","z",1,-1,e,t,r,s,o,4),buildPlane("x","y","z",-1,-1,e,t,-r,s,o,5),this.setIndex(h),this.setAttribute("position",new three_module_Float32BufferAttribute(d,3)),this.setAttribute("normal",new three_module_Float32BufferAttribute(p,3)),this.setAttribute("uv",new three_module_Float32BufferAttribute(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function cloneUniforms(e){const t={};for(const r in e){t[r]={};for(const s in e[r]){const l=e[r][s];l&&(l.isColor||l.isMatrix3||l.isMatrix4||l.isVector2||l.isVector3||l.isVector4||l.isTexture||l.isQuaternion)?l.isRenderTargetTexture?(o.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[r][s]=null):t[r][s]=l.clone():Array.isArray(l)?t[r][s]=l.slice():t[r][s]=l}}return t}function mergeUniforms(e){const t={};for(let r=0;r<e.length;r++){const s=cloneUniforms(e[r]);for(const e in s)t[e]=s[e]}return t}function getUnlitUniformColorSpace(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:He.workingColorSpace}const Ui={clone:cloneUniforms,merge:mergeUniforms};class ShaderMaterial extends Material{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cloneUniforms(e.uniforms),this.uniformsGroups=function cloneUniformsGroups(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r].clone());return t}(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 r in this.uniforms){const s=this.uniforms[r].value;s&&s.isTexture?t.uniforms[r]={type:"t",value:s.toJSON(e).uuid}:s&&s.isColor?t.uniforms[r]={type:"c",value:s.getHex()}:s&&s.isVector2?t.uniforms[r]={type:"v2",value:s.toArray()}:s&&s.isVector3?t.uniforms[r]={type:"v3",value:s.toArray()}:s&&s.isVector4?t.uniforms[r]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?t.uniforms[r]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?t.uniforms[r]={type:"m4",value:s.toArray()}:t.uniforms[r]={value:s}}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 r={};for(const e in this.extensions)!0===this.extensions[e]&&(r[e]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new three_module_Matrix4,this.projectionMatrix=new three_module_Matrix4,this.projectionMatrixInverse=new three_module_Matrix4,this.coordinateSystem=Be}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.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 Fi=new three_module_Vector3,Ni=new Vector2,Qi=new Vector2;class PerspectiveCamera extends Camera{constructor(e=50,t=1,r=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=s,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Pe*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Ue*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Pe*Math.atan(Math.tan(.5*Ue*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,r){Fi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Fi.x,Fi.y).multiplyScalar(-e/Fi.z),Fi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Fi.x,Fi.y).multiplyScalar(-e/Fi.z)}getViewSize(e,t){return this.getViewBounds(e,Ni,Qi),t.subVectors(Qi,Ni)}setViewOffset(e,t,r,s,o,l){this.aspect=e/t,null===this.view&&(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=r,this.view.offsetY=s,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Ue*this.fov)/this.zoom,r=2*t,s=this.aspect*r,o=-.5*s;const l=this.view;if(null!==this.view&&this.view.enabled){const e=l.fullWidth,c=l.fullHeight;o+=l.offsetX*s/e,t-=l.offsetY*r/c,s*=l.width/e,r*=l.height/c}const c=this.filmOffset;0!==c&&(o+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+s,t,t-r,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Oi=-90;class CubeCamera extends Object3D{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new PerspectiveCamera(Oi,1,e,t);s.layers=this.layers,this.add(s);const o=new PerspectiveCamera(Oi,1,e,t);o.layers=this.layers,this.add(o);const l=new PerspectiveCamera(Oi,1,e,t);l.layers=this.layers,this.add(l);const c=new PerspectiveCamera(Oi,1,e,t);c.layers=this.layers,this.add(c);const h=new PerspectiveCamera(Oi,1,e,t);h.layers=this.layers,this.add(h);const d=new PerspectiveCamera(Oi,1,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,s,o,l,c,h]=t;for(const e of t)this.remove(e);if(e===Be)r.up.set(0,1,0),r.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else{if(e!==Re)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);r.up.set(0,-1,0),r.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,d,p]=this.children,A=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,s),e.render(t,o),e.setRenderTarget(r,1,s),e.render(t,l),e.setRenderTarget(r,2,s),e.render(t,c),e.setRenderTarget(r,3,s),e.render(t,h),e.setRenderTarget(r,4,s),e.render(t,d),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,s),e.render(t,p),e.setRenderTarget(A,m,g),e.xr.enabled=f,r.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(e,t,r,s,o,l,c,h,d,A){super(e=void 0!==e?e:[],t=void 0!==t?t:p,r,s,o,l,c,h,d,A),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new CubeTexture(s,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=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:I}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 r={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},s=new BoxGeometry(5,5,5),o=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});o.uniforms.tEquirect.value=t;const l=new three_module_Mesh(s,o),c=t.minFilter;t.minFilter===T&&(t.minFilter=I);return new CubeCamera(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t,r,s){const o=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,s);e.setRenderTarget(o)}}const ki=new three_module_Vector3,Gi=new three_module_Vector3,Vi=new Matrix3;class Plane{constructor(e=new three_module_Vector3(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,r,s){return this.normal.set(e,t,r),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const s=ki.subVectors(r,t).cross(Gi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,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 r=e.delta(ki),s=this.normal.dot(r);if(0===s)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return o<0||o>1?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<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 r=t||Vi.getNormalMatrix(e),s=this.coplanarPoint(ki).applyMatrix4(e),o=this.normal.applyMatrix3(r).normalize();return this.constant=-s.dot(o),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 Hi=new Sphere,zi=new three_module_Vector3;class Frustum{constructor(e=new Plane,t=new Plane,r=new Plane,s=new Plane,o=new Plane,l=new Plane){this.planes=[e,t,r,s,o,l]}set(e,t,r,s,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(r),c[3].copy(s),c[4].copy(o),c[5].copy(l),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=2e3){const r=this.planes,s=e.elements,o=s[0],l=s[1],c=s[2],h=s[3],d=s[4],p=s[5],A=s[6],m=s[7],g=s[8],f=s[9],_=s[10],y=s[11],E=s[12],x=s[13],C=s[14],S=s[15];if(r[0].setComponents(h-o,m-d,y-g,S-E).normalize(),r[1].setComponents(h+o,m+d,y+g,S+E).normalize(),r[2].setComponents(h+l,m+p,y+f,S+x).normalize(),r[3].setComponents(h-l,m-p,y-f,S-x).normalize(),r[4].setComponents(h-c,m-A,y-_,S-C).normalize(),t===Be)r[5].setComponents(h+c,m+A,y+_,S+C).normalize();else{if(t!==Re)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);r[5].setComponents(c,A,_,C).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Hi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Hi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hi)}intersectsSprite(e){return Hi.center.set(0,0,0),Hi.radius=.7071067811865476,Hi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hi)}intersectsSphere(e){const t=this.planes,r=e.center,s=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(r)<s)return!1}return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const s=t[r];if(zi.x=s.normal.x>0?e.max.x:e.min.x,zi.y=s.normal.y>0?e.max.y:e.min.y,zi.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(zi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function WebGLAnimation(){let e=null,t=!1,r=null,s=null;function onAnimationFrame(t,o){r(t,o),s=e.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==t&&null!==r&&(s=e.requestAnimationFrame(onAnimationFrame),t=!0)},stop:function(){e.cancelAnimationFrame(s),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function WebGLAttributes(e){const t=new WeakMap;return{get:function get(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function remove(r){r.isInterleavedBufferAttribute&&(r=r.data);const s=t.get(r);s&&(e.deleteBuffer(s.buffer),t.delete(r))},update:function update(r,s){if(r.isGLBufferAttribute){const e=t.get(r);return void((!e||e.version<r.version)&&t.set(r,{buffer:r.buffer,type:r.type,bytesPerElement:r.elementSize,version:r.version}))}r.isInterleavedBufferAttribute&&(r=r.data);const o=t.get(r);if(void 0===o)t.set(r,function createBuffer(t,r){const s=t.array,o=t.usage,l=s.byteLength,c=e.createBuffer();let h;if(e.bindBuffer(r,c),e.bufferData(r,s,o),t.onUploadCallback(),s instanceof Float32Array)h=e.FLOAT;else if(s instanceof Uint16Array)h=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(s instanceof Int16Array)h=e.SHORT;else if(s instanceof Uint32Array)h=e.UNSIGNED_INT;else if(s instanceof Int32Array)h=e.INT;else if(s instanceof Int8Array)h=e.BYTE;else if(s instanceof Uint8Array)h=e.UNSIGNED_BYTE;else{if(!(s instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+s);h=e.UNSIGNED_BYTE}return{buffer:c,type:h,bytesPerElement:s.BYTES_PER_ELEMENT,version:t.version,size:l}}(r,s));else if(o.version<r.version){if(o.size!==r.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.");!function updateBuffer(t,r,s){const o=r.array,l=r._updateRange,c=r.updateRanges;if(e.bindBuffer(s,t),-1===l.count&&0===c.length&&e.bufferSubData(s,0,o),0!==c.length){for(let t=0,r=c.length;t<r;t++){const r=c[t];e.bufferSubData(s,r.start*o.BYTES_PER_ELEMENT,o,r.start,r.count)}r.clearUpdateRanges()}-1!==l.count&&(e.bufferSubData(s,l.offset*o.BYTES_PER_ELEMENT,o,l.offset,l.count),l.count=-1),r.onUploadCallback()}(o.buffer,r,s),o.version=r.version}}}}class PlaneGeometry extends three_module_BufferGeometry{constructor(e=1,t=1,r=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:s};const o=e/2,l=t/2,c=Math.floor(r),h=Math.floor(s),d=c+1,p=h+1,A=e/c,m=t/h,g=[],f=[],_=[],y=[];for(let e=0;e<p;e++){const t=e*m-l;for(let r=0;r<d;r++){const s=r*A-o;f.push(s,-t,0),_.push(0,0,1),y.push(r/c),y.push(1-e/h)}}for(let e=0;e<h;e++)for(let t=0;t<c;t++){const r=t+d*e,s=t+d*(e+1),o=t+1+d*(e+1),l=t+1+d*e;g.push(r,s,l),g.push(s,o,l)}this.setIndex(g),this.setAttribute("position",new three_module_Float32BufferAttribute(f,3)),this.setAttribute("normal",new three_module_Float32BufferAttribute(_,3)),this.setAttribute("uv",new three_module_Float32BufferAttribute(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)}}const Wi={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid 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 ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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 ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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 ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = 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 );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t#endif\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\t#ifndef USE_INSTANCING_MORPH\n\t\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\t#endif\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, newPeak * vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},qi={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(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 Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}}},ji={basic:{uniforms:mergeUniforms([qi.common,qi.specularmap,qi.envmap,qi.aomap,qi.lightmap,qi.fog]),vertexShader:Wi.meshbasic_vert,fragmentShader:Wi.meshbasic_frag},lambert:{uniforms:mergeUniforms([qi.common,qi.specularmap,qi.envmap,qi.aomap,qi.lightmap,qi.emissivemap,qi.bumpmap,qi.normalmap,qi.displacementmap,qi.fog,qi.lights,{emissive:{value:new Color(0)}}]),vertexShader:Wi.meshlambert_vert,fragmentShader:Wi.meshlambert_frag},phong:{uniforms:mergeUniforms([qi.common,qi.specularmap,qi.envmap,qi.aomap,qi.lightmap,qi.emissivemap,qi.bumpmap,qi.normalmap,qi.displacementmap,qi.fog,qi.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:Wi.meshphong_vert,fragmentShader:Wi.meshphong_frag},standard:{uniforms:mergeUniforms([qi.common,qi.envmap,qi.aomap,qi.lightmap,qi.emissivemap,qi.bumpmap,qi.normalmap,qi.displacementmap,qi.roughnessmap,qi.metalnessmap,qi.fog,qi.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wi.meshphysical_vert,fragmentShader:Wi.meshphysical_frag},toon:{uniforms:mergeUniforms([qi.common,qi.aomap,qi.lightmap,qi.emissivemap,qi.bumpmap,qi.normalmap,qi.displacementmap,qi.gradientmap,qi.fog,qi.lights,{emissive:{value:new Color(0)}}]),vertexShader:Wi.meshtoon_vert,fragmentShader:Wi.meshtoon_frag},matcap:{uniforms:mergeUniforms([qi.common,qi.bumpmap,qi.normalmap,qi.displacementmap,qi.fog,{matcap:{value:null}}]),vertexShader:Wi.meshmatcap_vert,fragmentShader:Wi.meshmatcap_frag},points:{uniforms:mergeUniforms([qi.points,qi.fog]),vertexShader:Wi.points_vert,fragmentShader:Wi.points_frag},dashed:{uniforms:mergeUniforms([qi.common,qi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wi.linedashed_vert,fragmentShader:Wi.linedashed_frag},depth:{uniforms:mergeUniforms([qi.common,qi.displacementmap]),vertexShader:Wi.depth_vert,fragmentShader:Wi.depth_frag},normal:{uniforms:mergeUniforms([qi.common,qi.bumpmap,qi.normalmap,qi.displacementmap,{opacity:{value:1}}]),vertexShader:Wi.meshnormal_vert,fragmentShader:Wi.meshnormal_frag},sprite:{uniforms:mergeUniforms([qi.sprite,qi.fog]),vertexShader:Wi.sprite_vert,fragmentShader:Wi.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Wi.background_vert,fragmentShader:Wi.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix3}},vertexShader:Wi.backgroundCube_vert,fragmentShader:Wi.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wi.cube_vert,fragmentShader:Wi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wi.equirect_vert,fragmentShader:Wi.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([qi.common,qi.displacementmap,{referencePosition:{value:new three_module_Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wi.distanceRGBA_vert,fragmentShader:Wi.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([qi.lights,qi.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:Wi.shadow_vert,fragmentShader:Wi.shadow_frag}};ji.physical={uniforms:mergeUniforms([ji.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Matrix3},anisotropyVector:{value:new Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix3}}]),vertexShader:Wi.meshphysical_vert,fragmentShader:Wi.meshphysical_frag};const Xi={r:0,b:0,g:0},Yi=new Euler,Ki=new three_module_Matrix4;function WebGLBackground(e,t,r,s,o,l,c){const h=new Color(0);let d,p,A=!0===l?0:1,m=null,g=0,_=null;function setClear(t,r){t.getRGB(Xi,getUnlitUniformColorSpace(e)),s.buffers.color.setClear(Xi.r,Xi.g,Xi.b,r,c)}return{getClearColor:function(){return h},setClearColor:function(e,t=1){h.set(e),A=t,setClear(h,A)},getClearAlpha:function(){return A},setClearAlpha:function(e){A=e,setClear(h,A)},render:function render(l,y){let E=!1,x=!0===y.isScene?y.background:null;if(x&&x.isTexture){x=(y.backgroundBlurriness>0?r:t).get(x)}null===x?setClear(h,A):x&&x.isColor&&(setClear(x,1),E=!0);const C=e.xr.getEnvironmentBlendMode();"additive"===C?s.buffers.color.setClear(0,0,0,1,c):"alpha-blend"===C&&s.buffers.color.setClear(0,0,0,0,c),(e.autoClear||E)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),x&&(x.isCubeTexture||x.mapping===f)?(void 0===p&&(p=new three_module_Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(ji.backgroundCube.uniforms),vertexShader:ji.backgroundCube.vertexShader,fragmentShader:ji.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),o.update(p)),Yi.copy(y.backgroundRotation),Yi.x*=-1,Yi.y*=-1,Yi.z*=-1,x.isCubeTexture&&!1===x.isRenderTargetTexture&&(Yi.y*=-1,Yi.z*=-1),p.material.uniforms.envMap.value=x,p.material.uniforms.flipEnvMap.value=x.isCubeTexture&&!1===x.isRenderTargetTexture?-1:1,p.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(Ki.makeRotationFromEuler(Yi)),p.material.toneMapped=He.getTransfer(x.colorSpace)!==Ce,m===x&&g===x.version&&_===e.toneMapping||(p.material.needsUpdate=!0,m=x,g=x.version,_=e.toneMapping),p.layers.enableAll(),l.unshift(p,p.geometry,p.material,0,0,null)):x&&x.isTexture&&(void 0===d&&(d=new three_module_Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(ji.background.uniforms),vertexShader:ji.background.vertexShader,fragmentShader:ji.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),o.update(d)),d.material.uniforms.t2D.value=x,d.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,d.material.toneMapped=He.getTransfer(x.colorSpace)!==Ce,!0===x.matrixAutoUpdate&&x.updateMatrix(),d.material.uniforms.uvTransform.value.copy(x.matrix),m===x&&g===x.version&&_===e.toneMapping||(d.material.needsUpdate=!0,m=x,g=x.version,_=e.toneMapping),d.layers.enableAll(),l.unshift(d,d.geometry,d.material,0,0,null))}}}function WebGLBindingStates(e,t){const r=e.getParameter(e.MAX_VERTEX_ATTRIBS),s={},o=createBindingState(null);let l=o,c=!1;function bindVertexArrayObject(t){return e.bindVertexArray(t)}function deleteVertexArrayObject(t){return e.deleteVertexArray(t)}function createBindingState(e){const t=[],s=[],o=[];for(let e=0;e<r;e++)t[e]=0,s[e]=0,o[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:s,attributeDivisors:o,object:e,attributes:{},index:null}}function initAttributes(){const e=l.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function enableAttribute(e){enableAttributeAndDivisor(e,0)}function enableAttributeAndDivisor(t,r){const s=l.newAttributes,o=l.enabledAttributes,c=l.attributeDivisors;s[t]=1,0===o[t]&&(e.enableVertexAttribArray(t),o[t]=1),c[t]!==r&&(e.vertexAttribDivisor(t,r),c[t]=r)}function disableUnusedAttributes(){const t=l.newAttributes,r=l.enabledAttributes;for(let s=0,o=r.length;s<o;s++)r[s]!==t[s]&&(e.disableVertexAttribArray(s),r[s]=0)}function vertexAttribPointer(t,r,s,o,l,c,h){!0===h?e.vertexAttribIPointer(t,r,s,l,c):e.vertexAttribPointer(t,r,s,o,l,c)}function reset(){resetDefaultState(),c=!0,l!==o&&(l=o,bindVertexArrayObject(l.object))}function resetDefaultState(){o.geometry=null,o.program=null,o.wireframe=!1}return{setup:function setup(r,o,h,d,p){let A=!1;const m=function getBindingState(t,r,o){const l=!0===o.wireframe;let c=s[t.id];void 0===c&&(c={},s[t.id]=c);let h=c[r.id];void 0===h&&(h={},c[r.id]=h);let d=h[l];void 0===d&&(d=createBindingState(function createVertexArrayObject(){return e.createVertexArray()}()),h[l]=d);return d}(d,h,o);l!==m&&(l=m,bindVertexArrayObject(l.object)),A=function needsUpdate(e,t,r,s){const o=l.attributes,c=t.attributes;let h=0;const d=r.getAttributes();for(const t in d){if(d[t].location>=0){const r=o[t];let s=c[t];if(void 0===s&&("instanceMatrix"===t&&e.instanceMatrix&&(s=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(s=e.instanceColor)),void 0===r)return!0;if(r.attribute!==s)return!0;if(s&&r.data!==s.data)return!0;h++}}return l.attributesNum!==h||l.index!==s}(r,d,h,p),A&&function saveCache(e,t,r,s){const o={},c=t.attributes;let h=0;const d=r.getAttributes();for(const t in d){if(d[t].location>=0){let r=c[t];void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor));const s={};s.attribute=r,r&&r.data&&(s.data=r.data),o[t]=s,h++}}l.attributes=o,l.attributesNum=h,l.index=s}(r,d,h,p),null!==p&&t.update(p,e.ELEMENT_ARRAY_BUFFER),(A||c)&&(c=!1,function setupVertexAttributes(r,s,o,l){initAttributes();const c=l.attributes,h=o.getAttributes(),d=s.defaultAttributeValues;for(const s in h){const o=h[s];if(o.location>=0){let h=c[s];if(void 0===h&&("instanceMatrix"===s&&r.instanceMatrix&&(h=r.instanceMatrix),"instanceColor"===s&&r.instanceColor&&(h=r.instanceColor)),void 0!==h){const s=h.normalized,c=h.itemSize,d=t.get(h);if(void 0===d)continue;const p=d.buffer,A=d.type,m=d.bytesPerElement,g=A===e.INT||A===e.UNSIGNED_INT||h.gpuType===U;if(h.isInterleavedBufferAttribute){const t=h.data,d=t.stride,f=h.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<o.locationSize;e++)enableAttributeAndDivisor(o.location+e,t.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===l._maxInstanceCount&&(l._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<o.locationSize;e++)enableAttribute(o.location+e);e.bindBuffer(e.ARRAY_BUFFER,p);for(let e=0;e<o.locationSize;e++)vertexAttribPointer(o.location+e,c/o.locationSize,A,s,d*m,(f+c/o.locationSize*e)*m,g)}else{if(h.isInstancedBufferAttribute){for(let e=0;e<o.locationSize;e++)enableAttributeAndDivisor(o.location+e,h.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===l._maxInstanceCount&&(l._maxInstanceCount=h.meshPerAttribute*h.count)}else for(let e=0;e<o.locationSize;e++)enableAttribute(o.location+e);e.bindBuffer(e.ARRAY_BUFFER,p);for(let e=0;e<o.locationSize;e++)vertexAttribPointer(o.location+e,c/o.locationSize,A,s,c*m,c/o.locationSize*e*m,g)}}else if(void 0!==d){const t=d[s];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(o.location,t);break;case 3:e.vertexAttrib3fv(o.location,t);break;case 4:e.vertexAttrib4fv(o.location,t);break;default:e.vertexAttrib1fv(o.location,t)}}}}disableUnusedAttributes()}(r,o,h,d),null!==p&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(p).buffer))},reset,resetDefaultState,dispose:function dispose(){reset();for(const e in s){const t=s[e];for(const e in t){const r=t[e];for(const e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete s[e]}},releaseStatesOfGeometry:function releaseStatesOfGeometry(e){if(void 0===s[e.id])return;const t=s[e.id];for(const e in t){const r=t[e];for(const e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete s[e.id]},releaseStatesOfProgram:function releaseStatesOfProgram(e){for(const t in s){const r=s[t];if(void 0===r[e.id])continue;const o=r[e.id];for(const e in o)deleteVertexArrayObject(o[e].object),delete o[e];delete r[e.id]}},initAttributes,enableAttribute,disableUnusedAttributes}}function WebGLBufferRenderer(e,t,r){let s;this.setMode=function setMode(e){s=e},this.render=function render(t,o){e.drawArrays(s,t,o),r.update(o,s,1)},this.renderInstances=function renderInstances(t,o,l){0!==l&&(e.drawArraysInstanced(s,t,o,l),r.update(o,s,l))},this.renderMultiDraw=function renderMultiDraw(e,o,l){if(0===l)return;const c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<l;t++)this.render(e[t],o[t]);else{c.multiDrawArraysWEBGL(s,e,0,o,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];r.update(t,s,1)}}}function WebGLCapabilities(e,t,r){let s;function getMaxPrecision(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=void 0!==r.precision?r.precision:"highp";const c=getMaxPrecision(l);c!==l&&(o.warn("THREE.WebGLRenderer:",l,"not supported, using",c,"instead."),l=c);const h=!0===r.logarithmicDepthBuffer,d=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),p=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function getMaxAnisotropy(){if(void 0!==s)return s;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");s=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s},getMaxPrecision,precision:l,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:p>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function WebGLClipping(e){const t=this;let r=null,s=0,o=!1,l=!1;const c=new Plane,h=new Matrix3,d={value:null,needsUpdate:!1};function projectPlanes(e,r,s,o){const l=null!==e?e.length:0;let p=null;if(0!==l){if(p=d.value,!0!==o||null===p){const t=s+4*l,o=r.matrixWorldInverse;h.getNormalMatrix(o),(null===p||p.length<t)&&(p=new Float32Array(t));for(let t=0,r=s;t!==l;++t,r+=4)c.copy(e[t]).applyMatrix4(o,h),c.normal.toArray(p,r),p[r+3]=c.constant}d.value=p,d.needsUpdate=!0}return t.numPlanes=l,t.numIntersection=0,p}this.uniform=d,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const r=0!==e.length||t||0!==s||o;return o=t,s=e.length,r},this.beginShadows=function(){l=!0,projectPlanes(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(e,t){r=projectPlanes(e,t,0)},this.setState=function(c,h,p){const A=c.clippingPlanes,m=c.clipIntersection,g=c.clipShadows,f=e.get(c);if(!o||null===A||0===A.length||l&&!g)l?projectPlanes(null):function resetGlobalState(){d.value!==r&&(d.value=r,d.needsUpdate=s>0);t.numPlanes=s,t.numIntersection=0}();else{const e=l?0:s,t=4*e;let o=f.clippingState||null;d.value=o,o=projectPlanes(A,h,t,p);for(let e=0;e!==t;++e)o[e]=r[e];f.clippingState=o,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=e}}}function WebGLCubeMaps(e){let t=new WeakMap;function mapTextureMapping(e,t){return t===m?e.mapping=p:t===g&&(e.mapping=A),e}function onTextureDispose(e){const r=e.target;r.removeEventListener("dispose",onTextureDispose);const s=t.get(r);void 0!==s&&(t.delete(r),s.dispose())}return{get:function get(r){if(r&&r.isTexture){const s=r.mapping;if(s===m||s===g){if(t.has(r)){return mapTextureMapping(t.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const o=new WebGLCubeRenderTarget(s.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",onTextureDispose),mapTextureMapping(o.texture,r.mapping)}return null}}}return r},dispose:function dispose(){t=new WeakMap}}}class OrthographicCamera extends Camera{constructor(e=-1,t=1,r=1,s=-1,o=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=s,this.near=o,this.far=l,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,r,s,o,l){null===this.view&&(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=r,this.view.offsetY=s,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let o=r-e,l=r+e,c=s+t,h=s-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=e*this.view.offsetX,l=o+e*this.view.width,c-=t*this.view.offsetY,h=c-t*this.view.height}this.projectionMatrix.makeOrthographic(o,l,c,h,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const Ji=[.125,.215,.35,.446,.526,.582],$i=20,Zi=new OrthographicCamera,en=new Color;let tn=null,nn=0,rn=0,sn=!1;const an=(1+Math.sqrt(5))/2,on=1/an,ln=[new three_module_Vector3(1,1,1),new three_module_Vector3(-1,1,1),new three_module_Vector3(1,1,-1),new three_module_Vector3(-1,1,-1),new three_module_Vector3(0,an,on),new three_module_Vector3(0,an,-on),new three_module_Vector3(on,0,an),new three_module_Vector3(-on,0,an),new three_module_Vector3(an,on,0),new three_module_Vector3(-an,on,0)];class PMREMGenerator{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,r=.1,s=100){tn=this._renderer.getRenderTarget(),nn=this._renderer.getActiveCubeFace(),rn=this._renderer.getActiveMipmapLevel(),sn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,r,s,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(tn,nn,rn),this._renderer.xr.enabled=sn,e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===p||e.mapping===A?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),tn=this._renderer.getRenderTarget(),nn=this._renderer.getActiveCubeFace(),rn=this._renderer.getActiveMipmapLevel(),sn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:I,minFilter:I,generateMipmaps:!1,type:O,format:W,colorSpace:ye,depthBuffer:!1},s=_createRenderTarget(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function _createPlanes(e){const t=[],r=[],s=[];let o=e;const l=e-4+1+Ji.length;for(let c=0;c<l;c++){const l=Math.pow(2,o);r.push(l);let h=1/l;c>e-4?h=Ji[c-e+4-1]:0===c&&(h=0),s.push(h);const d=1/(l-2),p=-d,A=1+d,m=[p,p,A,p,A,A,p,p,A,A,p,A],g=6,f=6,_=3,y=2,E=1,x=new Float32Array(_*f*g),C=new Float32Array(y*f*g),S=new Float32Array(E*f*g);for(let e=0;e<g;e++){const t=e%3*2/3-1,r=e>2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0];x.set(s,_*f*e),C.set(m,y*f*e);const o=[e,e,e,e,e,e];S.set(o,E*f*e)}const I=new three_module_BufferGeometry;I.setAttribute("position",new three_module_BufferAttribute(x,_)),I.setAttribute("uv",new three_module_BufferAttribute(C,y)),I.setAttribute("faceIndex",new three_module_BufferAttribute(S,E)),t.push(I),o>4&&o--}return{lodPlanes:t,sizeLods:r,sigmas:s}}(s)),this._blurMaterial=function _getBlurShader(e,t,r){const s=new Float32Array($i),o=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:$i,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/r,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:o}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(s,e,t)}return s}_compileMaterial(e){const t=new three_module_Mesh(this._lodPlanes[0],e);this._renderer.compile(t,Zi)}_sceneToCubeUV(e,t,r,s){const o=new PerspectiveCamera(90,1,t,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,p=h.toneMapping;h.getClearColor(en),h.toneMapping=0,h.autoClear=!1;const A=new MeshBasicMaterial({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),m=new three_module_Mesh(new BoxGeometry,A);let g=!1;const f=e.background;f?f.isColor&&(A.color.copy(f),e.background=null,g=!0):(A.color.copy(en),g=!0);for(let t=0;t<6;t++){const r=t%3;0===r?(o.up.set(0,l[t],0),o.lookAt(c[t],0,0)):1===r?(o.up.set(0,0,l[t]),o.lookAt(0,c[t],0)):(o.up.set(0,l[t],0),o.lookAt(0,0,c[t]));const d=this._cubeSize;_setViewport(s,r*d,t>2?d:0,d,d),h.setRenderTarget(s),g&&h.render(m,o),h.render(e,o)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=p,h.autoClear=d,e.background=f}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===p||e.mapping===A;s?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());const o=s?this._cubemapMaterial:this._equirectMaterial,l=new three_module_Mesh(this._lodPlanes[0],o);o.uniforms.envMap.value=e;const c=this._cubeSize;_setViewport(t,0,0,3*c,2*c),r.setRenderTarget(t),r.render(l,Zi)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){const r=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),s=ln[(t-1)%ln.length];this._blur(e,t-1,t,r,s)}t.autoClear=r}_blur(e,t,r,s,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,r,s,"latitudinal",o),this._halfBlur(l,e,r,r,s,"longitudinal",o)}_halfBlur(e,t,r,s,l,c,h){const d=this._renderer,p=this._blurMaterial;"latitudinal"!==c&&"longitudinal"!==c&&o.error("blur direction must be either latitudinal or longitudinal!");const A=new three_module_Mesh(this._lodPlanes[s],p),m=p.uniforms,g=this._sizeLods[r]-1,f=isFinite(l)?Math.PI/(2*g):2*Math.PI/39,_=l/f,y=isFinite(l)?1+Math.floor(3*_):$i;y>$i&&o.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${y} samples when the maximum is set to 20`);const E=[];let x=0;for(let e=0;e<$i;++e){const t=e/_,r=Math.exp(-t*t/2);E.push(r),0===e?x+=r:e<y&&(x+=2*r)}for(let e=0;e<E.length;e++)E[e]=E[e]/x;m.envMap.value=e.texture,m.samples.value=y,m.weights.value=E,m.latitudinal.value="latitudinal"===c,h&&(m.poleAxis.value=h);const{_lodMax:C}=this;m.dTheta.value=f,m.mipInt.value=C-r;const S=this._sizeLods[s];_setViewport(t,3*S*(s>C-4?s-C+4:0),4*(this._cubeSize-S),3*S,2*S),d.setRenderTarget(t),d.render(A,Zi)}}function _createRenderTarget(e,t,r){const s=new WebGLRenderTarget(e,t,r);return s.texture.mapping=f,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function _setViewport(e,t,r,s,o){e.viewport.set(t,r,s,o),e.scissor.set(t,r,s,o)}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function WebGLCubeUVMaps(e){let t=new WeakMap,r=null;function onTextureDispose(e){const r=e.target;r.removeEventListener("dispose",onTextureDispose);const s=t.get(r);void 0!==s&&(t.delete(r),s.dispose())}return{get:function get(s){if(s&&s.isTexture){const o=s.mapping,l=o===m||o===g,c=o===p||o===A;if(l||c){let o=t.get(s);const h=void 0!==o?o.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==h)return null===r&&(r=new PMREMGenerator(e)),o=l?r.fromEquirectangular(s,o):r.fromCubemap(s,o),o.texture.pmremVersion=s.pmremVersion,t.set(s,o),o.texture;if(void 0!==o)return o.texture;{const h=s.image;return l&&h&&h.height>0||c&&h&&function isCubeTextureComplete(e){let t=0;const r=6;for(let s=0;s<r;s++)void 0!==e[s]&&t++;return t===r}(h)?(null===r&&(r=new PMREMGenerator(e)),o=l?r.fromEquirectangular(s):r.fromCubemap(s),o.texture.pmremVersion=s.pmremVersion,t.set(s,o),s.addEventListener("dispose",onTextureDispose),o.texture):null}}}return s},dispose:function dispose(){t=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function WebGLExtensions(e){const t={};function getExtension(r){if(void 0!==t[r])return t[r];let s;switch(r){case"WEBGL_depth_texture":s=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=e.getExtension(r)}return t[r]=s,s}return{has:function(e){return null!==getExtension(e)},init:function(){getExtension("EXT_color_buffer_float"),getExtension("WEBGL_clip_cull_distance"),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture"),getExtension("WEBGL_render_shared_exponent")},get:function(e){const t=getExtension(e);return null===t&&o.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function WebGLGeometries(e,t,r,s){const o={},l=new WeakMap;function onGeometryDispose(e){const c=e.target;null!==c.index&&t.remove(c.index);for(const e in c.attributes)t.remove(c.attributes[e]);for(const e in c.morphAttributes){const r=c.morphAttributes[e];for(let e=0,s=r.length;e<s;e++)t.remove(r[e])}c.removeEventListener("dispose",onGeometryDispose),delete o[c.id];const h=l.get(c);h&&(t.remove(h),l.delete(c)),s.releaseStatesOfGeometry(c),!0===c.isInstancedBufferGeometry&&delete c._maxInstanceCount,r.memory.geometries--}function updateWireframeAttribute(e){const r=[],s=e.index,o=e.attributes.position;let c=0;if(null!==s){const e=s.array;c=s.version;for(let t=0,s=e.length;t<s;t+=3){const s=e[t+0],o=e[t+1],l=e[t+2];r.push(s,o,o,l,l,s)}}else{if(void 0===o)return;{const e=o.array;c=o.version;for(let t=0,s=e.length/3-1;t<s;t+=3){const e=t+0,s=t+1,o=t+2;r.push(e,s,s,o,o,e)}}}const h=new(arrayNeedsUint32(r)?Uint32BufferAttribute:Uint16BufferAttribute)(r,1);h.version=c;const d=l.get(e);d&&t.remove(d),l.set(e,h)}return{get:function get(e,t){return!0===o[t.id]||(t.addEventListener("dispose",onGeometryDispose),o[t.id]=!0,r.memory.geometries++),t},update:function update(r){const s=r.attributes;for(const r in s)t.update(s[r],e.ARRAY_BUFFER);const o=r.morphAttributes;for(const r in o){const s=o[r];for(let r=0,o=s.length;r<o;r++)t.update(s[r],e.ARRAY_BUFFER)}},getWireframeAttribute:function getWireframeAttribute(e){const t=l.get(e);if(t){const r=e.index;null!==r&&t.version<r.version&&updateWireframeAttribute(e)}else updateWireframeAttribute(e);return l.get(e)}}}function WebGLIndexedBufferRenderer(e,t,r){let s,o,l;this.setMode=function setMode(e){s=e},this.setIndex=function setIndex(e){o=e.type,l=e.bytesPerElement},this.render=function render(t,c){e.drawElements(s,c,o,t*l),r.update(c,s,1)},this.renderInstances=function renderInstances(t,c,h){0!==h&&(e.drawElementsInstanced(s,c,o,t*l,h),r.update(c,s,h))},this.renderMultiDraw=function renderMultiDraw(e,c,h){if(0===h)return;const d=t.get("WEBGL_multi_draw");if(null===d)for(let t=0;t<h;t++)this.render(e[t]/l,c[t]);else{d.multiDrawElementsWEBGL(s,c,0,o,e,0,h);let t=0;for(let e=0;e<h;e++)t+=c[e];r.update(t,s,1)}}}function WebGLInfo(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function reset(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function update(r,s,l){switch(t.calls++,s){case e.TRIANGLES:t.triangles+=l*(r/3);break;case e.LINES:t.lines+=l*(r/2);break;case e.LINE_STRIP:t.lines+=l*(r-1);break;case e.LINE_LOOP:t.lines+=l*r;break;case e.POINTS:t.points+=l*r;break;default:o.error("THREE.WebGLInfo: Unknown draw mode:",s)}}}}function WebGLMorphtargets(e,t,r){const s=new WeakMap,o=new Vector4;return{update:function update(l,c,h){const d=l.morphTargetInfluences,p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,A=void 0!==p?p.length:0;let m=s.get(c);if(void 0===m||m.count!==A){void 0!==m&&m.texture.dispose();const e=void 0!==c.morphAttributes.position,r=void 0!==c.morphAttributes.normal,l=void 0!==c.morphAttributes.color,h=c.morphAttributes.position||[],d=c.morphAttributes.normal||[],p=c.morphAttributes.color||[];let g=0;!0===e&&(g=1),!0===r&&(g=2),!0===l&&(g=3);let f=c.attributes.position.count*g,_=1;f>t.maxTextureSize&&(_=Math.ceil(f/t.maxTextureSize),f=t.maxTextureSize);const y=new Float32Array(f*_*4*A),E=new DataArrayTexture(y,f,_,A);E.type=Q,E.needsUpdate=!0;const x=4*g;for(let t=0;t<A;t++){const s=h[t],c=d[t],A=p[t],m=f*_*4*t;for(let t=0;t<s.count;t++){const h=t*x;!0===e&&(o.fromBufferAttribute(s,t),y[m+h+0]=o.x,y[m+h+1]=o.y,y[m+h+2]=o.z,y[m+h+3]=0),!0===r&&(o.fromBufferAttribute(c,t),y[m+h+4]=o.x,y[m+h+5]=o.y,y[m+h+6]=o.z,y[m+h+7]=0),!0===l&&(o.fromBufferAttribute(A,t),y[m+h+8]=o.x,y[m+h+9]=o.y,y[m+h+10]=o.z,y[m+h+11]=4===A.itemSize?o.w:1)}}function disposeTexture(){E.dispose(),s.delete(c),c.removeEventListener("dispose",disposeTexture)}m={count:A,texture:E,size:new Vector2(f,_)},s.set(c,m),c.addEventListener("dispose",disposeTexture)}if(!0===l.isInstancedMesh&&null!==l.morphTexture)h.getUniforms().setValue(e,"morphTexture",l.morphTexture,r);else{let t=0;for(let e=0;e<d.length;e++)t+=d[e];const r=c.morphTargetsRelative?1:1-t;h.getUniforms().setValue(e,"morphTargetBaseInfluence",r),h.getUniforms().setValue(e,"morphTargetInfluences",d)}h.getUniforms().setValue(e,"morphTargetsTexture",m.texture,r),h.getUniforms().setValue(e,"morphTargetsTextureSize",m.size)}}}function WebGLObjects(e,t,r,s){let o=new WeakMap;function onInstancedMeshDispose(e){const t=e.target;t.removeEventListener("dispose",onInstancedMeshDispose),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function update(l){const c=s.render.frame,h=l.geometry,d=t.get(l,h);if(o.get(d)!==c&&(t.update(d),o.set(d,c)),l.isInstancedMesh&&(!1===l.hasEventListener("dispose",onInstancedMeshDispose)&&l.addEventListener("dispose",onInstancedMeshDispose),o.get(l)!==c&&(r.update(l.instanceMatrix,e.ARRAY_BUFFER),null!==l.instanceColor&&r.update(l.instanceColor,e.ARRAY_BUFFER),o.set(l,c))),l.isSkinnedMesh){const e=l.skeleton;o.get(e)!==c&&(e.update(),o.set(e,c))}return d},dispose:function dispose(){o=new WeakMap}}}class DepthTexture extends Texture{constructor(e,t,r,s,o,l,c,h,d,p){if((p=void 0!==p?p:q)!==q&&p!==j)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&p===q&&(r=F),void 0===r&&p===j&&(r=G),super(null,s,o,l,c,h,p,r,d),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==c?c:x,this.minFilter=void 0!==h?h:x,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 null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const cn=new Texture,hn=new DepthTexture(1,1);hn.compareFunction=515;const un=new DataArrayTexture,dn=new Data3DTexture,pn=new CubeTexture,An=[],mn=[],gn=new Float32Array(16),fn=new Float32Array(9),_n=new Float32Array(4);function flatten(e,t,r){const s=e[0];if(s<=0||s>0)return e;const o=t*r;let l=An[o];if(void 0===l&&(l=new Float32Array(o),An[o]=l),0!==t){s.toArray(l,0);for(let s=1,o=0;s!==t;++s)o+=r,e[s].toArray(l,o)}return l}function arraysEqual(e,t){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(e[r]!==t[r])return!1;return!0}function copyArray(e,t){for(let r=0,s=t.length;r<s;r++)e[r]=t[r]}function allocTexUnits(e,t){let r=mn[t];void 0===r&&(r=new Int32Array(t),mn[t]=r);for(let s=0;s!==t;++s)r[s]=e.allocateTextureUnit();return r}function setValueV1f(e,t){const r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function setValueV2f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2fv(this.addr,t),copyArray(r,t)}}function setValueV3f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)r[0]===t.r&&r[1]===t.g&&r[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(arraysEqual(r,t))return;e.uniform3fv(this.addr,t),copyArray(r,t)}}function setValueV4f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4fv(this.addr,t),copyArray(r,t)}}function setValueM2(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;_n.set(s),e.uniformMatrix2fv(this.addr,!1,_n),copyArray(r,s)}}function setValueM3(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;fn.set(s),e.uniformMatrix3fv(this.addr,!1,fn),copyArray(r,s)}}function setValueM4(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;gn.set(s),e.uniformMatrix4fv(this.addr,!1,gn),copyArray(r,s)}}function setValueV1i(e,t){const r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function setValueV2i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2iv(this.addr,t),copyArray(r,t)}}function setValueV3i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3iv(this.addr,t),copyArray(r,t)}}function setValueV4i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4iv(this.addr,t),copyArray(r,t)}}function setValueV1ui(e,t){const r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function setValueV2ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2uiv(this.addr,t),copyArray(r,t)}}function setValueV3ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3uiv(this.addr,t),copyArray(r,t)}}function setValueV4ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4uiv(this.addr,t),copyArray(r,t)}}function setValueT1(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o);const l=this.type===e.SAMPLER_2D_SHADOW?hn:cn;r.setTexture2D(t||l,o)}function setValueT3D1(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTexture3D(t||dn,o)}function setValueT6(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTextureCube(t||pn,o)}function setValueT2DArray1(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTexture2DArray(t||un,o)}function setValueV1fArray(e,t){e.uniform1fv(this.addr,t)}function setValueV2fArray(e,t){const r=flatten(t,this.size,2);e.uniform2fv(this.addr,r)}function setValueV3fArray(e,t){const r=flatten(t,this.size,3);e.uniform3fv(this.addr,r)}function setValueV4fArray(e,t){const r=flatten(t,this.size,4);e.uniform4fv(this.addr,r)}function setValueM2Array(e,t){const r=flatten(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function setValueM3Array(e,t){const r=flatten(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function setValueM4Array(e,t){const r=flatten(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function setValueV1iArray(e,t){e.uniform1iv(this.addr,t)}function setValueV2iArray(e,t){e.uniform2iv(this.addr,t)}function setValueV3iArray(e,t){e.uniform3iv(this.addr,t)}function setValueV4iArray(e,t){e.uniform4iv(this.addr,t)}function setValueV1uiArray(e,t){e.uniform1uiv(this.addr,t)}function setValueV2uiArray(e,t){e.uniform2uiv(this.addr,t)}function setValueV3uiArray(e,t){e.uniform3uiv(this.addr,t)}function setValueV4uiArray(e,t){e.uniform4uiv(this.addr,t)}function setValueT1Array(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture2D(t[e]||cn,l[e])}function setValueT3DArray(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture3D(t[e]||dn,l[e])}function setValueT6Array(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTextureCube(t[e]||pn,l[e])}function setValueT2DArrayArray(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture2DArray(t[e]||un,l[e])}class SingleUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=function getSingularSetter(e){switch(e){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(t.type)}}class PureArrayUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function getPureArraySetter(e){switch(e){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(t.type)}}class StructuredUniform{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const s=this.seq;for(let o=0,l=s.length;o!==l;++o){const l=s[o];l.setValue(e,t[l.id],r)}}}const vn=/(\w+)(\])?(\[|\.)?/g;function addUniform(e,t){e.seq.push(t),e.map[t.id]=t}function parseUniform(e,t,r){const s=e.name,o=s.length;for(vn.lastIndex=0;;){const l=vn.exec(s),c=vn.lastIndex;let h=l[1];const d="]"===l[2],p=l[3];if(d&&(h|=0),void 0===p||"["===p&&c+2===o){addUniform(r,void 0===p?new SingleUniform(h,e,t):new PureArrayUniform(h,e,t));break}{let e=r.map[h];void 0===e&&(e=new StructuredUniform(h),addUniform(r,e)),r=e}}}class WebGLUniforms{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const r=e.getActiveUniform(t,s);parseUniform(r,e.getUniformLocation(t,r.name),this)}}setValue(e,t,r,s){const o=this.map[t];void 0!==o&&o.setValue(e,r,s)}setOptional(e,t,r){const s=t[r];void 0!==s&&this.setValue(e,r,s)}static upload(e,t,r,s){for(let o=0,l=t.length;o!==l;++o){const l=t[o],c=r[l.id];!1!==c.needsUpdate&&l.setValue(e,c.value,s)}}static seqWithValue(e,t){const r=[];for(let s=0,o=e.length;s!==o;++s){const o=e[s];o.id in t&&r.push(o)}return r}}function WebGLShader(e,t,r){const s=e.createShader(t);return e.shaderSource(s,r),e.compileShader(s),s}let yn=0;function getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),o=e.getShaderInfoLog(t).trim();if(s&&""===o)return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const s=parseInt(l[1]);return r.toUpperCase()+"\n\n"+o+"\n\n"+function handleSource(e,t){const r=e.split("\n"),s=[],o=Math.max(t-6,0),l=Math.min(t+6,r.length);for(let e=o;e<l;e++){const o=e+1;s.push(`${o===t?">":" "} ${o}: ${r[e]}`)}return s.join("\n")}(e.getShaderSource(t),s)}return o}function getTexelEncodingFunction(e,t){const r=function getEncodingComponents(e){const t=He.getPrimaries(He.workingColorSpace),r=He.getPrimaries(e);let s;switch(t===r?s="":t===Ie&&r===Se?s="LinearDisplayP3ToLinearSRGB":t===Se&&r===Ie&&(s="LinearSRGBToLinearDisplayP3"),e){case ye:case xe:return[s,"LinearTransferOETF"];case ve:case Ee:return[s,"sRGBTransferOETF"];default:return o.warn("THREE.WebGLProgram: Unsupported color space:",e),[s,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${r[0]}( ${r[1]}( value ) ); }`}function getToneMappingFunction(e,t){let r;switch(t){case 1:r="Linear";break;case 2:r="Reinhard";break;case 3:r="OptimizedCineon";break;case 4:r="ACESFilmic";break;case 6:r="AgX";break;case 7:r="Neutral";break;case 5:r="Custom";break;default:o.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),r="Linear"}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function filterEmptyLine(e){return""!==e}function replaceLightNums(e,t){const r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function replaceClippingPlaneNums(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const En=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(e){return e.replace(En,includeReplacer)}const xn=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function includeReplacer(e,t){let r=Wi[t];if(void 0===r){const e=xn.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");r=Wi[e],o.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return resolveIncludes(r)}const Mn=/#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 unrollLoops(e){return e.replace(Mn,loopReplacer)}function loopReplacer(e,t,r,s){let o="";for(let e=parseInt(t);e<parseInt(r);e++)o+=s.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return o}function generatePrecision(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function WebGLProgram(e,t,r,s){const l=e.getContext(),c=r.defines;let h=r.vertexShader,d=r.fragmentShader;const m=function generateShadowMapTypeDefine(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(r),g=function generateEnvMapTypeDefine(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case p:case A:t="ENVMAP_TYPE_CUBE";break;case f:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),_=function generateEnvMapModeDefine(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===A&&(t="ENVMAP_MODE_REFRACTION");return t}(r),y=function generateEnvMapBlendingDefine(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(r),E=function generateCubeUVSize(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const r=Math.log2(t)-2,s=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,r),112)),texelHeight:s,maxMip:r}}(r),x=function generateVertexExtensions(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(filterEmptyLine).join("\n")}(r),C=function generateDefines(e){const t=[];for(const r in e){const s=e[r];!1!==s&&t.push("#define "+r+" "+s)}return t.join("\n")}(c),S=l.createProgram();let I,b,T=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?(I=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,C].filter(filterEmptyLine).join("\n"),I.length>0&&(I+="\n"),b=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,C].filter(filterEmptyLine).join("\n"),b.length>0&&(b+="\n")):(I=[generatePrecision(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,C,r.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",r.batching?"#define USE_BATCHING":"",r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.instancingMorph?"#define USE_INSTANCING_MORPH":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+_:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+r.anisotropyMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",r.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+m:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),b=[generatePrecision(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,C,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.envMap?"#define "+_:"",r.envMap?"#define "+y:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescence?"#define USE_IRIDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+m:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==r.toneMapping?"#define TONE_MAPPING":"",0!==r.toneMapping?Wi.tonemapping_pars_fragment:"",0!==r.toneMapping?getToneMappingFunction("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",Wi.colorspace_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",r.outputColorSpace),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),h=resolveIncludes(h),h=replaceLightNums(h,r),h=replaceClippingPlaneNums(h,r),d=resolveIncludes(d),d=replaceLightNums(d,r),d=replaceClippingPlaneNums(d,r),h=unrollLoops(h),d=unrollLoops(d),!0!==r.isRawShaderMaterial&&(T="#version 300 es\n",I=[x,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+I,b=["#define varying in",r.glslVersion===Te?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===Te?"":"#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("\n")+"\n"+b);const B=T+I+h,U=T+b+d,F=WebGLShader(l,l.VERTEX_SHADER,B),Q=WebGLShader(l,l.FRAGMENT_SHADER,U);function onFirstUse(t){if(e.debug.checkShaderErrors){const r=l.getProgramInfoLog(S).trim(),s=l.getShaderInfoLog(F).trim(),c=l.getShaderInfoLog(Q).trim();let h=!0,d=!0;if(!1===l.getProgramParameter(S,l.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(l,S,F,Q);else{const e=getShaderErrors(l,F,"vertex"),s=getShaderErrors(l,Q,"fragment");o.error("THREE.WebGLProgram: Shader Error "+l.getError()+" - VALIDATE_STATUS "+l.getProgramParameter(S,l.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+r+"\n"+e+"\n"+s)}else""!==r?o.warn("THREE.WebGLProgram: Program Info Log:",r):""!==s&&""!==c||(d=!1);d&&(t.diagnostics={runnable:h,programLog:r,vertexShader:{log:s,prefix:I},fragmentShader:{log:c,prefix:b}})}l.deleteShader(F),l.deleteShader(Q),O=new WebGLUniforms(l,S),G=function fetchAttributeLocations(e,t){const r={},s=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let o=0;o<s;o++){const s=e.getActiveAttrib(t,o),l=s.name;let c=1;s.type===e.FLOAT_MAT2&&(c=2),s.type===e.FLOAT_MAT3&&(c=3),s.type===e.FLOAT_MAT4&&(c=4),r[l]={type:s.type,location:e.getAttribLocation(t,l),locationSize:c}}return r}(l,S)}let O,G;l.attachShader(S,F),l.attachShader(S,Q),void 0!==r.index0AttributeName?l.bindAttribLocation(S,0,r.index0AttributeName):!0===r.morphTargets&&l.bindAttribLocation(S,0,"position"),l.linkProgram(S),this.getUniforms=function(){return void 0===O&&onFirstUse(this),O},this.getAttributes=function(){return void 0===G&&onFirstUse(this),G};let W=!1===r.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===W&&(W=l.getProgramParameter(S,37297)),W},this.destroy=function(){s.releaseStatesOfProgram(this),l.deleteProgram(S),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=yn++,this.cacheKey=t,this.usedTimes=1,this.program=S,this.vertexShader=F,this.fragmentShader=Q,this}let Cn=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,s=this._getShaderStage(t),o=this._getShaderStage(r),l=this._getShaderCacheForMaterial(e);return!1===l.has(s)&&(l.add(s),s.usedTimes++),!1===l.has(o)&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.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 r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return void 0===r&&(r=new WebGLShaderStage(e),t.set(e,r)),r}}class WebGLShaderStage{constructor(e){this.id=Cn++,this.code=e,this.usedTimes=0}}function WebGLPrograms(e,t,r,s,l,c,h){const d=new Layers,p=new WebGLShaderCache,A=new Set,m=[],g=l.logarithmicDepthBuffer,_=l.vertexTextures;let y=l.precision;const E={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 getChannel(e){return A.add(e),0===e?"uv":`uv${e}`}return{getParameters:function getParameters(c,d,m,x,C){const S=x.fog,I=C.geometry,b=c.isMeshStandardMaterial?x.environment:null,T=(c.isMeshStandardMaterial?r:t).get(c.envMap||b),B=T&&T.mapping===f?T.image.height:null,U=E[c.type];null!==c.precision&&(y=l.getMaxPrecision(c.precision),y!==c.precision&&o.warn("THREE.WebGLProgram.getParameters:",c.precision,"not supported, using",y,"instead."));const F=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,Q=void 0!==F?F.length:0;let O,G,W,q,j=0;if(void 0!==I.morphAttributes.position&&(j=1),void 0!==I.morphAttributes.normal&&(j=2),void 0!==I.morphAttributes.color&&(j=3),U){const e=ji[U];O=e.vertexShader,G=e.fragmentShader}else O=c.vertexShader,G=c.fragmentShader,p.update(c),W=p.getVertexShaderID(c),q=p.getFragmentShaderID(c);const X=e.getRenderTarget(),Y=!0===C.isInstancedMesh,K=!0===C.isBatchedMesh,J=!!c.map,$=!!c.matcap,ee=!!T,te=!!c.aoMap,ie=!!c.lightMap,ne=!!c.bumpMap,re=!!c.normalMap,se=!!c.displacementMap,ae=!!c.emissiveMap,oe=!!c.metalnessMap,le=!!c.roughnessMap,ce=c.anisotropy>0,he=c.clearcoat>0,ue=c.iridescence>0,de=c.sheen>0,pe=c.transmission>0,Ae=ce&&!!c.anisotropyMap,me=he&&!!c.clearcoatMap,ge=he&&!!c.clearcoatNormalMap,fe=he&&!!c.clearcoatRoughnessMap,_e=ue&&!!c.iridescenceMap,ve=ue&&!!c.iridescenceThicknessMap,Ee=de&&!!c.sheenColorMap,xe=de&&!!c.sheenRoughnessMap,Me=!!c.specularMap,Se=!!c.specularColorMap,Ie=!!c.specularIntensityMap,be=pe&&!!c.transmissionMap,we=pe&&!!c.thicknessMap,Te=!!c.gradientMap,Be=!!c.alphaMap,Re=c.alphaTest>0,Le=!!c.alphaHash,De=!!c.extensions;let Ue=0;c.toneMapped&&(null!==X&&!0!==X.isXRRenderTarget||(Ue=e.toneMapping));const Pe={shaderID:U,shaderType:c.type,shaderName:c.name,vertexShader:O,fragmentShader:G,defines:c.defines,customVertexShaderID:W,customFragmentShaderID:q,isRawShaderMaterial:!0===c.isRawShaderMaterial,glslVersion:c.glslVersion,precision:y,batching:K,instancing:Y,instancingColor:Y&&null!==C.instanceColor,instancingMorph:Y&&null!==C.morphTexture,supportsVertexTextures:_,outputColorSpace:null===X?e.outputColorSpace:!0===X.isXRRenderTarget?X.texture.colorSpace:ye,alphaToCoverage:!!c.alphaToCoverage,map:J,matcap:$,envMap:ee,envMapMode:ee&&T.mapping,envMapCubeUVHeight:B,aoMap:te,lightMap:ie,bumpMap:ne,normalMap:re,displacementMap:_&&se,emissiveMap:ae,normalMapObjectSpace:re&&1===c.normalMapType,normalMapTangentSpace:re&&0===c.normalMapType,metalnessMap:oe,roughnessMap:le,anisotropy:ce,anisotropyMap:Ae,clearcoat:he,clearcoatMap:me,clearcoatNormalMap:ge,clearcoatRoughnessMap:fe,iridescence:ue,iridescenceMap:_e,iridescenceThicknessMap:ve,sheen:de,sheenColorMap:Ee,sheenRoughnessMap:xe,specularMap:Me,specularColorMap:Se,specularIntensityMap:Ie,transmission:pe,transmissionMap:be,thicknessMap:we,gradientMap:Te,opaque:!1===c.transparent&&1===c.blending&&!1===c.alphaToCoverage,alphaMap:Be,alphaTest:Re,alphaHash:Le,combine:c.combine,mapUv:J&&getChannel(c.map.channel),aoMapUv:te&&getChannel(c.aoMap.channel),lightMapUv:ie&&getChannel(c.lightMap.channel),bumpMapUv:ne&&getChannel(c.bumpMap.channel),normalMapUv:re&&getChannel(c.normalMap.channel),displacementMapUv:se&&getChannel(c.displacementMap.channel),emissiveMapUv:ae&&getChannel(c.emissiveMap.channel),metalnessMapUv:oe&&getChannel(c.metalnessMap.channel),roughnessMapUv:le&&getChannel(c.roughnessMap.channel),anisotropyMapUv:Ae&&getChannel(c.anisotropyMap.channel),clearcoatMapUv:me&&getChannel(c.clearcoatMap.channel),clearcoatNormalMapUv:ge&&getChannel(c.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:fe&&getChannel(c.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&getChannel(c.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&getChannel(c.iridescenceThicknessMap.channel),sheenColorMapUv:Ee&&getChannel(c.sheenColorMap.channel),sheenRoughnessMapUv:xe&&getChannel(c.sheenRoughnessMap.channel),specularMapUv:Me&&getChannel(c.specularMap.channel),specularColorMapUv:Se&&getChannel(c.specularColorMap.channel),specularIntensityMapUv:Ie&&getChannel(c.specularIntensityMap.channel),transmissionMapUv:be&&getChannel(c.transmissionMap.channel),thicknessMapUv:we&&getChannel(c.thicknessMap.channel),alphaMapUv:Be&&getChannel(c.alphaMap.channel),vertexTangents:!!I.attributes.tangent&&(re||ce),vertexColors:c.vertexColors,vertexAlphas:!0===c.vertexColors&&!!I.attributes.color&&4===I.attributes.color.itemSize,pointsUvs:!0===C.isPoints&&!!I.attributes.uv&&(J||Be),fog:!!S,useFog:!0===c.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===c.flatShading,sizeAttenuation:!0===c.sizeAttenuation,logarithmicDepthBuffer:g,skinning:!0===C.isSkinnedMesh,morphTargets:void 0!==I.morphAttributes.position,morphNormals:void 0!==I.morphAttributes.normal,morphColors:void 0!==I.morphAttributes.color,morphTargetsCount:Q,morphTextureStride:j,numDirLights:d.directional.length,numPointLights:d.point.length,numSpotLights:d.spot.length,numSpotLightMaps:d.spotLightMap.length,numRectAreaLights:d.rectArea.length,numHemiLights:d.hemi.length,numDirLightShadows:d.directionalShadowMap.length,numPointLightShadows:d.pointShadowMap.length,numSpotLightShadows:d.spotShadowMap.length,numSpotLightShadowsWithMaps:d.numSpotLightShadowsWithMaps,numLightProbes:d.numLightProbes,numClippingPlanes:h.numPlanes,numClipIntersection:h.numIntersection,dithering:c.dithering,shadowMapEnabled:e.shadowMap.enabled&&m.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ue,useLegacyLights:e._useLegacyLights,decodeVideoTexture:J&&!0===c.map.isVideoTexture&&He.getTransfer(c.map.colorSpace)===Ce,premultipliedAlpha:c.premultipliedAlpha,doubleSided:2===c.side,flipSided:1===c.side,useDepthPacking:c.depthPacking>=0,depthPacking:c.depthPacking||0,index0AttributeName:c.index0AttributeName,extensionClipCullDistance:De&&!0===c.extensions.clipCullDistance&&s.has("WEBGL_clip_cull_distance"),extensionMultiDraw:De&&!0===c.extensions.multiDraw&&s.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:s.has("KHR_parallel_shader_compile"),customProgramCacheKey:c.customProgramCacheKey()};return Pe.vertexUv1s=A.has(1),Pe.vertexUv2s=A.has(2),Pe.vertexUv3s=A.has(3),A.clear(),Pe},getProgramCacheKey:function getProgramCacheKey(t){const r=[];if(t.shaderID?r.push(t.shaderID):(r.push(t.customVertexShaderID),r.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)r.push(e),r.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function getProgramCacheKeyParameters(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(r,t),function getProgramCacheKeyBooleans(e,t){d.disableAll(),t.supportsVertexTextures&&d.enable(0);t.instancing&&d.enable(1);t.instancingColor&&d.enable(2);t.instancingMorph&&d.enable(3);t.matcap&&d.enable(4);t.envMap&&d.enable(5);t.normalMapObjectSpace&&d.enable(6);t.normalMapTangentSpace&&d.enable(7);t.clearcoat&&d.enable(8);t.iridescence&&d.enable(9);t.alphaTest&&d.enable(10);t.vertexColors&&d.enable(11);t.vertexAlphas&&d.enable(12);t.vertexUv1s&&d.enable(13);t.vertexUv2s&&d.enable(14);t.vertexUv3s&&d.enable(15);t.vertexTangents&&d.enable(16);t.anisotropy&&d.enable(17);t.alphaHash&&d.enable(18);t.batching&&d.enable(19);e.push(d.mask),d.disableAll(),t.fog&&d.enable(0);t.useFog&&d.enable(1);t.flatShading&&d.enable(2);t.logarithmicDepthBuffer&&d.enable(3);t.skinning&&d.enable(4);t.morphTargets&&d.enable(5);t.morphNormals&&d.enable(6);t.morphColors&&d.enable(7);t.premultipliedAlpha&&d.enable(8);t.shadowMapEnabled&&d.enable(9);t.useLegacyLights&&d.enable(10);t.doubleSided&&d.enable(11);t.flipSided&&d.enable(12);t.useDepthPacking&&d.enable(13);t.dithering&&d.enable(14);t.transmission&&d.enable(15);t.sheen&&d.enable(16);t.opaque&&d.enable(17);t.pointsUvs&&d.enable(18);t.decodeVideoTexture&&d.enable(19);t.alphaToCoverage&&d.enable(20);e.push(d.mask)}(r,t),r.push(e.outputColorSpace)),r.push(t.customProgramCacheKey),r.join()},getUniforms:function getUniforms(e){const t=E[e.type];let r;if(t){const e=ji[t];r=Ui.clone(e.uniforms)}else r=e.uniforms;return r},acquireProgram:function acquireProgram(t,r){let s;for(let e=0,t=m.length;e<t;e++){const t=m[e];if(t.cacheKey===r){s=t,++s.usedTimes;break}}return void 0===s&&(s=new WebGLProgram(e,r,t,c),m.push(s)),s},releaseProgram:function releaseProgram(e){if(0==--e.usedTimes){const t=m.indexOf(e);m[t]=m[m.length-1],m.pop(),e.destroy()}},releaseShaderCache:function releaseShaderCache(e){p.remove(e)},programs:m,dispose:function dispose(){p.dispose()}}}function WebGLProperties(){let e=new WeakMap;return{get:function get(t){let r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function remove(t){e.delete(t)},update:function update(t,r,s){e.get(t)[r]=s},dispose:function dispose(){e=new WeakMap}}}function painterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function reversePainterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function WebGLRenderList(){const e=[];let t=0;const r=[],s=[],o=[];function getNextRenderItem(r,s,o,l,c,h){let d=e[t];return void 0===d?(d={id:r.id,object:r,geometry:s,material:o,groupOrder:l,renderOrder:r.renderOrder,z:c,group:h},e[t]=d):(d.id=r.id,d.object=r,d.geometry=s,d.material=o,d.groupOrder=l,d.renderOrder=r.renderOrder,d.z=c,d.group=h),t++,d}return{opaque:r,transmissive:s,transparent:o,init:function init(){t=0,r.length=0,s.length=0,o.length=0},push:function push(e,t,l,c,h,d){const p=getNextRenderItem(e,t,l,c,h,d);l.transmission>0?s.push(p):!0===l.transparent?o.push(p):r.push(p)},unshift:function unshift(e,t,l,c,h,d){const p=getNextRenderItem(e,t,l,c,h,d);l.transmission>0?s.unshift(p):!0===l.transparent?o.unshift(p):r.unshift(p)},finish:function finish(){for(let r=t,s=e.length;r<s;r++){const t=e[r];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function sort(e,t){r.length>1&&r.sort(e||painterSortStable),s.length>1&&s.sort(t||reversePainterSortStable),o.length>1&&o.sort(t||reversePainterSortStable)}}}function WebGLRenderLists(){let e=new WeakMap;return{get:function get(t,r){const s=e.get(t);let o;return void 0===s?(o=new WebGLRenderList,e.set(t,[o])):r>=s.length?(o=new WebGLRenderList,s.push(o)):o=s[r],o},dispose:function dispose(){e=new WeakMap}}}function UniformsCache(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new three_module_Vector3,color:new Color};break;case"SpotLight":r={position:new three_module_Vector3,direction:new three_module_Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new three_module_Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":r={direction:new three_module_Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":r={color:new Color,position:new three_module_Vector3,halfWidth:new three_module_Vector3,halfHeight:new three_module_Vector3}}return e[t.id]=r,r}}}let Sn=0;function shadowCastingAndTexturingLightsFirst(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function WebGLLights(e){const t=new UniformsCache,r=function ShadowUniformsCache(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),s={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 e=0;e<9;e++)s.probe.push(new three_module_Vector3);const o=new three_module_Vector3,l=new three_module_Matrix4,c=new three_module_Matrix4;return{setup:function setup(o,l){let c=0,h=0,d=0;for(let e=0;e<9;e++)s.probe[e].set(0,0,0);let p=0,A=0,m=0,g=0,f=0,_=0,y=0,E=0,x=0,C=0,S=0;o.sort(shadowCastingAndTexturingLightsFirst);const I=!0===l?Math.PI:1;for(let e=0,l=o.length;e<l;e++){const l=o[e],b=l.color,T=l.intensity,B=l.distance,U=l.shadow&&l.shadow.map?l.shadow.map.texture:null;if(l.isAmbientLight)c+=b.r*T*I,h+=b.g*T*I,d+=b.b*T*I;else if(l.isLightProbe){for(let e=0;e<9;e++)s.probe[e].addScaledVector(l.sh.coefficients[e],T);S++}else if(l.isDirectionalLight){const e=t.get(l);if(e.color.copy(l.color).multiplyScalar(l.intensity*I),l.castShadow){const e=l.shadow,t=r.get(l);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,s.directionalShadow[p]=t,s.directionalShadowMap[p]=U,s.directionalShadowMatrix[p]=l.shadow.matrix,_++}s.directional[p]=e,p++}else if(l.isSpotLight){const e=t.get(l);e.position.setFromMatrixPosition(l.matrixWorld),e.color.copy(b).multiplyScalar(T*I),e.distance=B,e.coneCos=Math.cos(l.angle),e.penumbraCos=Math.cos(l.angle*(1-l.penumbra)),e.decay=l.decay,s.spot[m]=e;const o=l.shadow;if(l.map&&(s.spotLightMap[x]=l.map,x++,o.updateMatrices(l),l.castShadow&&C++),s.spotLightMatrix[m]=o.matrix,l.castShadow){const e=r.get(l);e.shadowBias=o.bias,e.shadowNormalBias=o.normalBias,e.shadowRadius=o.radius,e.shadowMapSize=o.mapSize,s.spotShadow[m]=e,s.spotShadowMap[m]=U,E++}m++}else if(l.isRectAreaLight){const e=t.get(l);e.color.copy(b).multiplyScalar(T),e.halfWidth.set(.5*l.width,0,0),e.halfHeight.set(0,.5*l.height,0),s.rectArea[g]=e,g++}else if(l.isPointLight){const e=t.get(l);if(e.color.copy(l.color).multiplyScalar(l.intensity*I),e.distance=l.distance,e.decay=l.decay,l.castShadow){const e=l.shadow,t=r.get(l);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,s.pointShadow[A]=t,s.pointShadowMap[A]=U,s.pointShadowMatrix[A]=l.shadow.matrix,y++}s.point[A]=e,A++}else if(l.isHemisphereLight){const e=t.get(l);e.skyColor.copy(l.color).multiplyScalar(T*I),e.groundColor.copy(l.groundColor).multiplyScalar(T*I),s.hemi[f]=e,f++}}g>0&&(!0===e.has("OES_texture_float_linear")?(s.rectAreaLTC1=qi.LTC_FLOAT_1,s.rectAreaLTC2=qi.LTC_FLOAT_2):(s.rectAreaLTC1=qi.LTC_HALF_1,s.rectAreaLTC2=qi.LTC_HALF_2)),s.ambient[0]=c,s.ambient[1]=h,s.ambient[2]=d;const b=s.hash;b.directionalLength===p&&b.pointLength===A&&b.spotLength===m&&b.rectAreaLength===g&&b.hemiLength===f&&b.numDirectionalShadows===_&&b.numPointShadows===y&&b.numSpotShadows===E&&b.numSpotMaps===x&&b.numLightProbes===S||(s.directional.length=p,s.spot.length=m,s.rectArea.length=g,s.point.length=A,s.hemi.length=f,s.directionalShadow.length=_,s.directionalShadowMap.length=_,s.pointShadow.length=y,s.pointShadowMap.length=y,s.spotShadow.length=E,s.spotShadowMap.length=E,s.directionalShadowMatrix.length=_,s.pointShadowMatrix.length=y,s.spotLightMatrix.length=E+x-C,s.spotLightMap.length=x,s.numSpotLightShadowsWithMaps=C,s.numLightProbes=S,b.directionalLength=p,b.pointLength=A,b.spotLength=m,b.rectAreaLength=g,b.hemiLength=f,b.numDirectionalShadows=_,b.numPointShadows=y,b.numSpotShadows=E,b.numSpotMaps=x,b.numLightProbes=S,s.version=Sn++)},setupView:function setupView(e,t){let r=0,h=0,d=0,p=0,A=0;const m=t.matrixWorldInverse;for(let t=0,g=e.length;t<g;t++){const g=e[t];if(g.isDirectionalLight){const e=s.directional[r];e.direction.setFromMatrixPosition(g.matrixWorld),o.setFromMatrixPosition(g.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(m),r++}else if(g.isSpotLight){const e=s.spot[d];e.position.setFromMatrixPosition(g.matrixWorld),e.position.applyMatrix4(m),e.direction.setFromMatrixPosition(g.matrixWorld),o.setFromMatrixPosition(g.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(m),d++}else if(g.isRectAreaLight){const e=s.rectArea[p];e.position.setFromMatrixPosition(g.matrixWorld),e.position.applyMatrix4(m),c.identity(),l.copy(g.matrixWorld),l.premultiply(m),c.extractRotation(l),e.halfWidth.set(.5*g.width,0,0),e.halfHeight.set(0,.5*g.height,0),e.halfWidth.applyMatrix4(c),e.halfHeight.applyMatrix4(c),p++}else if(g.isPointLight){const e=s.point[h];e.position.setFromMatrixPosition(g.matrixWorld),e.position.applyMatrix4(m),h++}else if(g.isHemisphereLight){const e=s.hemi[A];e.direction.setFromMatrixPosition(g.matrixWorld),e.direction.transformDirection(m),A++}}},state:s}}function WebGLRenderState(e){const t=new WebGLLights(e),r=[],s=[];return{init:function init(){r.length=0,s.length=0},state:{lightsArray:r,shadowsArray:s,lights:t,transmissionRenderTarget:null},setupLights:function setupLights(e){t.setup(r,e)},setupLightsView:function setupLightsView(e){t.setupView(r,e)},pushLight:function pushLight(e){r.push(e)},pushShadow:function pushShadow(e){s.push(e)}}}function WebGLRenderStates(e){let t=new WeakMap;return{get:function get(r,s=0){const o=t.get(r);let l;return void 0===o?(l=new WebGLRenderState(e),t.set(r,[l])):s>=o.length?(l=new WebGLRenderState(e),o.push(l)):l=o[s],l},dispose:function dispose(){t=new WeakMap}}}class MeshDepthMaterial extends Material{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 MeshDistanceMaterial extends Material{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}}function WebGLShadowMap(e,t,r){let s=new Frustum;const l=new Vector2,c=new Vector2,h=new Vector4,d=new MeshDepthMaterial({depthPacking:3201}),p=new MeshDistanceMaterial,A={},m=r.maxTextureSize,g={0:1,1:0,2:2},f=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),_=f.clone();_.defines.HORIZONTAL_PASS=1;const y=new three_module_BufferGeometry;y.setAttribute("position",new three_module_BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new three_module_Mesh(y,f),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let S=this.type;function VSMPass(r,s){const o=t.update(E);f.defines.VSM_SAMPLES!==r.blurSamples&&(f.defines.VSM_SAMPLES=r.blurSamples,_.defines.VSM_SAMPLES=r.blurSamples,f.needsUpdate=!0,_.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new WebGLRenderTarget(l.x,l.y)),f.uniforms.shadow_pass.value=r.map.texture,f.uniforms.resolution.value=r.mapSize,f.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(s,null,o,f,E,null),_.uniforms.shadow_pass.value=r.mapPass.texture,_.uniforms.resolution.value=r.mapSize,_.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(s,null,o,_,E,null)}function getDepthMaterial(t,r,s,o){let l=null;const c=!0===s.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==c)l=c;else if(l=!0===s.isPointLight?p:d,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0){const e=l.uuid,t=r.uuid;let s=A[e];void 0===s&&(s={},A[e]=s);let o=s[t];void 0===o&&(o=l.clone(),s[t]=o,r.addEventListener("dispose",onMaterialDispose)),l=o}if(l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===o?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:g[r.side],l.alphaMap=r.alphaMap,l.alphaTest=r.alphaTest,l.map=r.map,l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.displacementMap=r.displacementMap,l.displacementScale=r.displacementScale,l.displacementBias=r.displacementBias,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===s.isPointLight&&!0===l.isMeshDistanceMaterial){e.properties.get(l).light=s}return l}function renderObject(r,o,l,c,h){if(!1===r.visible)return;if(r.layers.test(o.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===h)&&(!r.frustumCulled||s.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,r.matrixWorld);const s=t.update(r),d=r.material;if(Array.isArray(d)){const t=s.groups;for(let p=0,A=t.length;p<A;p++){const A=t[p],m=d[A.materialIndex];if(m&&m.visible){const t=getDepthMaterial(r,m,c,h);r.onBeforeShadow(e,r,o,l,s,t,A),e.renderBufferDirect(l,null,s,t,r,A),r.onAfterShadow(e,r,o,l,s,t,A)}}}else if(d.visible){const t=getDepthMaterial(r,d,c,h);r.onBeforeShadow(e,r,o,l,s,t,null),e.renderBufferDirect(l,null,s,t,r,null),r.onAfterShadow(e,r,o,l,s,t,null)}}const d=r.children;for(let e=0,t=d.length;e<t;e++)renderObject(d[e],o,l,c,h)}function onMaterialDispose(e){e.target.removeEventListener("dispose",onMaterialDispose);for(const t in A){const r=A[t],s=e.target.uuid;if(s in r){r[s].dispose(),delete r[s]}}}this.render=function(t,r,d){if(!1===C.enabled)return;if(!1===C.autoUpdate&&!1===C.needsUpdate)return;if(0===t.length)return;const p=e.getRenderTarget(),A=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);const _=3!==S&&3===this.type,y=3===S&&3!==this.type;for(let p=0,A=t.length;p<A;p++){const A=t[p],g=A.shadow;if(void 0===g){o.warn("THREE.WebGLShadowMap:",A,"has no shadow.");continue}if(!1===g.autoUpdate&&!1===g.needsUpdate)continue;l.copy(g.mapSize);const E=g.getFrameExtents();if(l.multiply(E),c.copy(g.mapSize),(l.x>m||l.y>m)&&(l.x>m&&(c.x=Math.floor(m/E.x),l.x=c.x*E.x,g.mapSize.x=c.x),l.y>m&&(c.y=Math.floor(m/E.y),l.y=c.y*E.y,g.mapSize.y=c.y)),null===g.map||!0===_||!0===y){const e=3!==this.type?{minFilter:x,magFilter:x}:{};null!==g.map&&g.map.dispose(),g.map=new WebGLRenderTarget(l.x,l.y,e),g.map.texture.name=A.name+".shadowMap",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();const C=g.getViewportCount();for(let e=0;e<C;e++){const t=g.getViewport(e);h.set(c.x*t.x,c.y*t.y,c.x*t.z,c.y*t.w),f.viewport(h),g.updateMatrices(A,e),s=g.getFrustum(),renderObject(r,d,g.camera,A,this.type)}!0!==g.isPointLightShadow&&3===this.type&&VSMPass(g,d),g.needsUpdate=!1}S=this.type,C.needsUpdate=!1,e.setRenderTarget(p,A,g)}}function WebGLState(e){const t=new function ColorBuffer(){let t=!1;const r=new Vector4;let s=null;const o=new Vector4(0,0,0,0);return{setMask:function(r){s===r||t||(e.colorMask(r,r,r,r),s=r)},setLocked:function(e){t=e},setClear:function(t,s,l,c,h){!0===h&&(t*=c,s*=c,l*=c),r.set(t,s,l,c),!1===o.equals(r)&&(e.clearColor(t,s,l,c),o.copy(r))},reset:function(){t=!1,s=null,o.set(-1,0,0,0)}}},r=new function DepthBuffer(){let t=!1,r=null,s=null,o=null;return{setTest:function(t){t?enable(e.DEPTH_TEST):disable(e.DEPTH_TEST)},setMask:function(s){r===s||t||(e.depthMask(s),r=s)},setFunc:function(t){if(s!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}s=t}},setLocked:function(e){t=e},setClear:function(t){o!==t&&(e.clearDepth(t),o=t)},reset:function(){t=!1,r=null,s=null,o=null}}},s=new function StencilBuffer(){let t=!1,r=null,s=null,o=null,l=null,c=null,h=null,d=null,p=null;return{setTest:function(r){t||(r?enable(e.STENCIL_TEST):disable(e.STENCIL_TEST))},setMask:function(s){r===s||t||(e.stencilMask(s),r=s)},setFunc:function(t,r,c){s===t&&o===r&&l===c||(e.stencilFunc(t,r,c),s=t,o=r,l=c)},setOp:function(t,r,s){c===t&&h===r&&d===s||(e.stencilOp(t,r,s),c=t,h=r,d=s)},setLocked:function(e){t=e},setClear:function(t){p!==t&&(e.clearStencil(t),p=t)},reset:function(){t=!1,r=null,s=null,o=null,l=null,c=null,h=null,d=null,p=null}}},l=new WeakMap,h=new WeakMap;let d={},p={},A=new WeakMap,m=[],g=null,f=!1,_=null,y=null,E=null,x=null,C=null,S=null,I=null,b=new Color(0,0,0),T=0,B=!1,U=null,F=null,Q=null,O=null,G=null;const W=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,j=0;const X=e.getParameter(e.VERSION);-1!==X.indexOf("WebGL")?(j=parseFloat(/^WebGL (\d)/.exec(X)[1]),q=j>=1):-1!==X.indexOf("OpenGL ES")&&(j=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),q=j>=2);let Y=null,K={};const J=e.getParameter(e.SCISSOR_BOX),$=e.getParameter(e.VIEWPORT),ee=(new Vector4).fromArray(J),te=(new Vector4).fromArray($);function createTexture(t,r,s,o){const l=new Uint8Array(4),c=e.createTexture();e.bindTexture(t,c),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let c=0;c<s;c++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(r,0,e.RGBA,1,1,o,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(r+c,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,l);return c}const ie={};function enable(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function disable(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}ie[e.TEXTURE_2D]=createTexture(e.TEXTURE_2D,e.TEXTURE_2D,1),ie[e.TEXTURE_CUBE_MAP]=createTexture(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[e.TEXTURE_2D_ARRAY]=createTexture(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ie[e.TEXTURE_3D]=createTexture(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),r.setClear(1),s.setClear(0),enable(e.DEPTH_TEST),r.setFunc(3),setFlipSided(!1),setCullFace(1),enable(e.CULL_FACE),setBlending(0);const ne={[c]:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};ne[103]=e.MIN,ne[104]=e.MAX;const re={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function setBlending(t,r,s,l,h,d,p,A,m,g){if(0!==t){if(!1===f&&(enable(e.BLEND),f=!0),5===t)h=h||r,d=d||s,p=p||l,r===y&&h===C||(e.blendEquationSeparate(ne[r],ne[h]),y=r,C=h),s===E&&l===x&&d===S&&p===I||(e.blendFuncSeparate(re[s],re[l],re[d],re[p]),E=s,x=l,S=d,I=p),!1!==A.equals(b)&&m===T||(e.blendColor(A.r,A.g,A.b,m),b.copy(A),T=m),_=t,B=!1;else if(t!==_||g!==B){if(y===c&&C===c||(e.blendEquation(e.FUNC_ADD),y=c,C=c),g)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:o.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:o.error("THREE.WebGLState: Invalid blending: ",t)}E=null,x=null,S=null,I=null,b.set(0,0,0),T=0,_=t,B=g}}else!0===f&&(disable(e.BLEND),f=!1)}function setFlipSided(t){U!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),U=t)}function setCullFace(t){0!==t?(enable(e.CULL_FACE),t!==F&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):disable(e.CULL_FACE),F=t}function setPolygonOffset(t,r,s){t?(enable(e.POLYGON_OFFSET_FILL),O===r&&G===s||(e.polygonOffset(r,s),O=r,G=s)):disable(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:r,stencil:s},enable,disable,bindFramebuffer:function bindFramebuffer(t,r){return p[t]!==r&&(e.bindFramebuffer(t,r),p[t]=r,t===e.DRAW_FRAMEBUFFER&&(p[e.FRAMEBUFFER]=r),t===e.FRAMEBUFFER&&(p[e.DRAW_FRAMEBUFFER]=r),!0)},drawBuffers:function drawBuffers(t,r){let s=m,o=!1;if(t){s=A.get(r),void 0===s&&(s=[],A.set(r,s));const l=t.textures;if(s.length!==l.length||s[0]!==e.COLOR_ATTACHMENT0){for(let t=0,r=l.length;t<r;t++)s[t]=e.COLOR_ATTACHMENT0+t;s.length=l.length,o=!0}}else s[0]!==e.BACK&&(s[0]=e.BACK,o=!0);o&&e.drawBuffers(s)},useProgram:function useProgram(t){return g!==t&&(e.useProgram(t),g=t,!0)},setBlending,setMaterial:function setMaterial(o,l){2===o.side?disable(e.CULL_FACE):enable(e.CULL_FACE);let c=1===o.side;l&&(c=!c),setFlipSided(c),1===o.blending&&!1===o.transparent?setBlending(0):setBlending(o.blending,o.blendEquation,o.blendSrc,o.blendDst,o.blendEquationAlpha,o.blendSrcAlpha,o.blendDstAlpha,o.blendColor,o.blendAlpha,o.premultipliedAlpha),r.setFunc(o.depthFunc),r.setTest(o.depthTest),r.setMask(o.depthWrite),t.setMask(o.colorWrite);const h=o.stencilWrite;s.setTest(h),h&&(s.setMask(o.stencilWriteMask),s.setFunc(o.stencilFunc,o.stencilRef,o.stencilFuncMask),s.setOp(o.stencilFail,o.stencilZFail,o.stencilZPass)),setPolygonOffset(o.polygonOffset,o.polygonOffsetFactor,o.polygonOffsetUnits),!0===o.alphaToCoverage?enable(e.SAMPLE_ALPHA_TO_COVERAGE):disable(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided,setCullFace,setLineWidth:function setLineWidth(t){t!==Q&&(q&&e.lineWidth(t),Q=t)},setPolygonOffset,setScissorTest:function setScissorTest(t){t?enable(e.SCISSOR_TEST):disable(e.SCISSOR_TEST)},activeTexture:function activeTexture(t){void 0===t&&(t=e.TEXTURE0+W-1),Y!==t&&(e.activeTexture(t),Y=t)},bindTexture:function bindTexture(t,r,s){void 0===s&&(s=null===Y?e.TEXTURE0+W-1:Y);let o=K[s];void 0===o&&(o={type:void 0,texture:void 0},K[s]=o),o.type===t&&o.texture===r||(Y!==s&&(e.activeTexture(s),Y=s),e.bindTexture(t,r||ie[t]),o.type=t,o.texture=r)},unbindTexture:function unbindTexture(){const t=K[Y];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function compressedTexImage2D(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},compressedTexImage3D:function compressedTexImage3D(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},texImage2D:function texImage2D(){try{e.texImage2D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},texImage3D:function texImage3D(){try{e.texImage3D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},updateUBOMapping:function updateUBOMapping(t,r){let s=h.get(r);void 0===s&&(s=new WeakMap,h.set(r,s));let o=s.get(t);void 0===o&&(o=e.getUniformBlockIndex(r,t.name),s.set(t,o))},uniformBlockBinding:function uniformBlockBinding(t,r){const s=h.get(r).get(t);l.get(r)!==s&&(e.uniformBlockBinding(r,s,t.__bindingPointIndex),l.set(r,s))},texStorage2D:function texStorage2D(){try{e.texStorage2D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},texStorage3D:function texStorage3D(){try{e.texStorage3D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},texSubImage2D:function texSubImage2D(){try{e.texSubImage2D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},texSubImage3D:function texSubImage3D(){try{e.texSubImage3D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function compressedTexSubImage2D(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function compressedTexSubImage3D(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){o.error("THREE.WebGLState:",e)}},scissor:function scissor(t){!1===ee.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ee.copy(t))},viewport:function viewport(t){!1===te.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),te.copy(t))},reset:function reset(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},Y=null,K={},p={},A=new WeakMap,m=[],g=null,f=!1,_=null,y=null,E=null,x=null,C=null,S=null,I=null,b=new Color(0,0,0),T=0,B=!1,U=null,F=null,Q=null,O=null,G=null,ee.set(0,0,e.canvas.width,e.canvas.height),te.set(0,0,e.canvas.width,e.canvas.height),t.reset(),r.reset(),s.reset()}}}function WebGLTextures(e,t,r,s,l,c,h){const d=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,p="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),A=new Vector2,m=new WeakMap;let g;const f=new WeakMap;let U=!1;try{U="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function createCanvas(e,t){return U?new OffscreenCanvas(e,t):createElementNS("canvas")}function resizeImage(e,t,r){let s=1;const l=getDimensions(e);if((l.width>r||l.height>r)&&(s=r/Math.max(l.width,l.height)),s<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const r=Math.floor(s*l.width),c=Math.floor(s*l.height);void 0===g&&(g=createCanvas(r,c));const h=t?createCanvas(r,c):g;h.width=r,h.height=c;return h.getContext("2d").drawImage(e,0,0,r,c),o.warn("THREE.WebGLRenderer: Texture has been resized from ("+l.width+"x"+l.height+") to ("+r+"x"+c+")."),h}return"data"in e&&o.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+l.width+"x"+l.height+")."),e}return e}function textureNeedsGenerateMipmaps(e){return e.generateMipmaps&&e.minFilter!==x&&e.minFilter!==I}function generateMipmap(t){e.generateMipmap(t)}function getInternalFormat(r,s,l,c,h=!1){if(null!==r){if(void 0!==e[r])return e[r];o.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}let d=s;if(s===e.RED&&(l===e.FLOAT&&(d=e.R32F),l===e.HALF_FLOAT&&(d=e.R16F),l===e.UNSIGNED_BYTE&&(d=e.R8)),s===e.RED_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.R8UI),l===e.UNSIGNED_SHORT&&(d=e.R16UI),l===e.UNSIGNED_INT&&(d=e.R32UI),l===e.BYTE&&(d=e.R8I),l===e.SHORT&&(d=e.R16I),l===e.INT&&(d=e.R32I)),s===e.RG&&(l===e.FLOAT&&(d=e.RG32F),l===e.HALF_FLOAT&&(d=e.RG16F),l===e.UNSIGNED_BYTE&&(d=e.RG8)),s===e.RG_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.RG8UI),l===e.UNSIGNED_SHORT&&(d=e.RG16UI),l===e.UNSIGNED_INT&&(d=e.RG32UI),l===e.BYTE&&(d=e.RG8I),l===e.SHORT&&(d=e.RG16I),l===e.INT&&(d=e.RG32I)),s===e.RGB&&l===e.UNSIGNED_INT_5_9_9_9_REV&&(d=e.RGB9_E5),s===e.RGBA){const t=h?Me:He.getTransfer(c);l===e.FLOAT&&(d=e.RGBA32F),l===e.HALF_FLOAT&&(d=e.RGBA16F),l===e.UNSIGNED_BYTE&&(d=t===Ce?e.SRGB8_ALPHA8:e.RGBA8),l===e.UNSIGNED_SHORT_4_4_4_4&&(d=e.RGBA4),l===e.UNSIGNED_SHORT_5_5_5_1&&(d=e.RGB5_A1)}return d!==e.R16F&&d!==e.R32F&&d!==e.RG16F&&d!==e.RG32F&&d!==e.RGBA16F&&d!==e.RGBA32F||t.get("EXT_color_buffer_float"),d}function getMipLevels(e,t){return!0===textureNeedsGenerateMipmaps(e)||e.isFramebufferTexture&&e.minFilter!==x&&e.minFilter!==I?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function onTextureDispose(e){const t=e.target;t.removeEventListener("dispose",onTextureDispose),function deallocateTexture(e){const t=s.get(e);if(void 0===t.__webglInit)return;const r=e.source,o=f.get(r);if(o){const s=o[t.__cacheKey];s.usedTimes--,0===s.usedTimes&&deleteTexture(e),0===Object.keys(o).length&&f.delete(r)}s.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function onRenderTargetDispose(t){const r=t.target;r.removeEventListener("dispose",onRenderTargetDispose),function deallocateRenderTarget(t){const r=s.get(t);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(r.__webglFramebuffer[t]))for(let s=0;s<r.__webglFramebuffer[t].length;s++)e.deleteFramebuffer(r.__webglFramebuffer[t][s]);else e.deleteFramebuffer(r.__webglFramebuffer[t]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t])}else{if(Array.isArray(r.__webglFramebuffer))for(let t=0;t<r.__webglFramebuffer.length;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let t=0;t<r.__webglColorRenderbuffer.length;t++)r.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[t]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}const o=t.textures;for(let t=0,r=o.length;t<r;t++){const r=s.get(o[t]);r.__webglTexture&&(e.deleteTexture(r.__webglTexture),h.memory.textures--),s.remove(o[t])}s.remove(t)}(r)}function deleteTexture(t){const r=s.get(t);e.deleteTexture(r.__webglTexture);const o=t.source;delete f.get(o)[r.__cacheKey],h.memory.textures--}let O=0;function setTexture2D(t,l){const c=s.get(t);if(t.isVideoTexture&&function updateVideoTexture(e){const t=h.render.frame;m.get(e)!==t&&(m.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&c.__version!==t.version){const e=t.image;if(null===e)o.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void uploadTexture(c,t,l);o.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}r.bindTexture(e.TEXTURE_2D,c.__webglTexture,e.TEXTURE0+l)}const X={[_]:e.REPEAT,[y]:e.CLAMP_TO_EDGE,[E]:e.MIRRORED_REPEAT},Y={[x]:e.NEAREST,[C]:e.NEAREST_MIPMAP_NEAREST,[S]:e.NEAREST_MIPMAP_LINEAR,[I]:e.LINEAR,[b]:e.LINEAR_MIPMAP_NEAREST,[T]:e.LINEAR_MIPMAP_LINEAR},K={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function setTextureParameters(r,c){if(c.type!==Q||!1!==t.has("OES_texture_float_linear")||c.magFilter!==I&&c.magFilter!==b&&c.magFilter!==S&&c.magFilter!==T&&c.minFilter!==I&&c.minFilter!==b&&c.minFilter!==S&&c.minFilter!==T||o.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(r,e.TEXTURE_WRAP_S,X[c.wrapS]),e.texParameteri(r,e.TEXTURE_WRAP_T,X[c.wrapT]),r!==e.TEXTURE_3D&&r!==e.TEXTURE_2D_ARRAY||e.texParameteri(r,e.TEXTURE_WRAP_R,X[c.wrapR]),e.texParameteri(r,e.TEXTURE_MAG_FILTER,Y[c.magFilter]),e.texParameteri(r,e.TEXTURE_MIN_FILTER,Y[c.minFilter]),c.compareFunction&&(e.texParameteri(r,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(r,e.TEXTURE_COMPARE_FUNC,K[c.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(c.magFilter===x)return;if(c.minFilter!==S&&c.minFilter!==T)return;if(c.type===Q&&!1===t.has("OES_texture_float_linear"))return;if(c.anisotropy>1||s.get(c).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(r,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(c.anisotropy,l.getMaxAnisotropy())),s.get(c).__currentAnisotropy=c.anisotropy}}}function initTexture(t,r){let s=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",onTextureDispose));const o=r.source;let l=f.get(o);void 0===l&&(l={},f.set(o,l));const c=function getTextureCacheKey(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(r);if(c!==t.__cacheKey){void 0===l[c]&&(l[c]={texture:e.createTexture(),usedTimes:0},h.memory.textures++,s=!0),l[c].usedTimes++;const o=l[t.__cacheKey];void 0!==o&&(l[t.__cacheKey].usedTimes--,0===o.usedTimes&&deleteTexture(r)),t.__cacheKey=c,t.__webglTexture=l[c].texture}return s}function uploadTexture(t,h,d){let p=e.TEXTURE_2D;(h.isDataArrayTexture||h.isCompressedArrayTexture)&&(p=e.TEXTURE_2D_ARRAY),h.isData3DTexture&&(p=e.TEXTURE_3D);const A=initTexture(t,h),m=h.source;r.bindTexture(p,t.__webglTexture,e.TEXTURE0+d);const g=s.get(m);if(m.version!==g.__version||!0===A){r.activeTexture(e.TEXTURE0+d);const t=He.getPrimaries(He.workingColorSpace),s=h.colorSpace===_e?null:He.getPrimaries(h.colorSpace),f=h.colorSpace===_e||t===s?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,h.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,h.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let _=resizeImage(h.image,!1,l.maxTextureSize);_=verifyColorSpace(h,_);const y=c.convert(h.format,h.colorSpace),E=c.convert(h.type);let x,C=getInternalFormat(h.internalFormat,y,E,h.colorSpace,h.isVideoTexture);setTextureParameters(p,h);const S=h.mipmaps,I=!0!==h.isVideoTexture&&C!==ne,b=void 0===g.__version||!0===A,T=m.dataReady,B=getMipLevels(h,_);if(h.isDepthTexture)C=e.DEPTH_COMPONENT16,h.type===Q?C=e.DEPTH_COMPONENT32F:h.type===F?C=e.DEPTH_COMPONENT24:h.type===G&&(C=e.DEPTH24_STENCIL8),b&&(I?r.texStorage2D(e.TEXTURE_2D,1,C,_.width,_.height):r.texImage2D(e.TEXTURE_2D,0,C,_.width,_.height,0,y,E,null));else if(h.isDataTexture)if(S.length>0){I&&b&&r.texStorage2D(e.TEXTURE_2D,B,C,S[0].width,S[0].height);for(let t=0,s=S.length;t<s;t++)x=S[t],I?T&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,x.width,x.height,y,E,x.data):r.texImage2D(e.TEXTURE_2D,t,C,x.width,x.height,0,y,E,x.data);h.generateMipmaps=!1}else I?(b&&r.texStorage2D(e.TEXTURE_2D,B,C,_.width,_.height),T&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,_.width,_.height,y,E,_.data)):r.texImage2D(e.TEXTURE_2D,0,C,_.width,_.height,0,y,E,_.data);else if(h.isCompressedTexture)if(h.isCompressedArrayTexture){I&&b&&r.texStorage3D(e.TEXTURE_2D_ARRAY,B,C,S[0].width,S[0].height,_.depth);for(let t=0,s=S.length;t<s;t++)x=S[t],h.format!==W?null!==y?I?T&&r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,x.width,x.height,_.depth,y,x.data,0,0):r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,C,x.width,x.height,_.depth,0,x.data,0,0):o.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?T&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,x.width,x.height,_.depth,y,E,x.data):r.texImage3D(e.TEXTURE_2D_ARRAY,t,C,x.width,x.height,_.depth,0,y,E,x.data)}else{I&&b&&r.texStorage2D(e.TEXTURE_2D,B,C,S[0].width,S[0].height);for(let t=0,s=S.length;t<s;t++)x=S[t],h.format!==W?null!==y?I?T&&r.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,x.width,x.height,y,x.data):r.compressedTexImage2D(e.TEXTURE_2D,t,C,x.width,x.height,0,x.data):o.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?T&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,x.width,x.height,y,E,x.data):r.texImage2D(e.TEXTURE_2D,t,C,x.width,x.height,0,y,E,x.data)}else if(h.isDataArrayTexture)I?(b&&r.texStorage3D(e.TEXTURE_2D_ARRAY,B,C,_.width,_.height,_.depth),T&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,_.width,_.height,_.depth,y,E,_.data)):r.texImage3D(e.TEXTURE_2D_ARRAY,0,C,_.width,_.height,_.depth,0,y,E,_.data);else if(h.isData3DTexture)I?(b&&r.texStorage3D(e.TEXTURE_3D,B,C,_.width,_.height,_.depth),T&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,_.width,_.height,_.depth,y,E,_.data)):r.texImage3D(e.TEXTURE_3D,0,C,_.width,_.height,_.depth,0,y,E,_.data);else if(h.isFramebufferTexture){if(b)if(I)r.texStorage2D(e.TEXTURE_2D,B,C,_.width,_.height);else{let t=_.width,s=_.height;for(let o=0;o<B;o++)r.texImage2D(e.TEXTURE_2D,o,C,t,s,0,y,E,null),t>>=1,s>>=1}}else if(S.length>0){if(I&&b){const t=getDimensions(S[0]);r.texStorage2D(e.TEXTURE_2D,B,C,t.width,t.height)}for(let t=0,s=S.length;t<s;t++)x=S[t],I?T&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,y,E,x):r.texImage2D(e.TEXTURE_2D,t,C,y,E,x);h.generateMipmaps=!1}else if(I){if(b){const t=getDimensions(_);r.texStorage2D(e.TEXTURE_2D,B,C,t.width,t.height)}T&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,y,E,_)}else r.texImage2D(e.TEXTURE_2D,0,C,y,E,_);textureNeedsGenerateMipmaps(h)&&generateMipmap(p),g.__version=m.version,h.onUpdate&&h.onUpdate(h)}t.__version=h.version}function setupFrameBufferTexture(t,o,l,h,p,A){const m=c.convert(l.format,l.colorSpace),g=c.convert(l.type),f=getInternalFormat(l.internalFormat,m,g,l.colorSpace);if(!s.get(o).__hasExternalTextures){const t=Math.max(1,o.width>>A),s=Math.max(1,o.height>>A);p===e.TEXTURE_3D||p===e.TEXTURE_2D_ARRAY?r.texImage3D(p,A,f,t,s,o.depth,0,m,g,null):r.texImage2D(p,A,f,t,s,0,m,g,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),useMultisampledRTT(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,h,p,s.get(l).__webglTexture,0,getRenderTargetSamples(o)):(p===e.TEXTURE_2D||p>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&p<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,h,p,s.get(l).__webglTexture,A),r.bindFramebuffer(e.FRAMEBUFFER,null)}function setupRenderBufferStorage(t,r,s){if(e.bindRenderbuffer(e.RENDERBUFFER,t),r.depthBuffer&&!r.stencilBuffer){let o=e.DEPTH_COMPONENT24;if(s||useMultisampledRTT(r)){const t=r.depthTexture;t&&t.isDepthTexture&&(t.type===Q?o=e.DEPTH_COMPONENT32F:t.type===F&&(o=e.DEPTH_COMPONENT24));const s=getRenderTargetSamples(r);useMultisampledRTT(r)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,o,r.width,r.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,o,r.width,r.height)}else e.renderbufferStorage(e.RENDERBUFFER,o,r.width,r.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(r.depthBuffer&&r.stencilBuffer){const o=getRenderTargetSamples(r);s&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(e.RENDERBUFFER,o,e.DEPTH24_STENCIL8,r.width,r.height):useMultisampledRTT(r)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,o,e.DEPTH24_STENCIL8,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,r.width,r.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{const t=r.textures;for(let o=0;o<t.length;o++){const l=t[o],h=c.convert(l.format,l.colorSpace),p=c.convert(l.type),A=getInternalFormat(l.internalFormat,h,p,l.colorSpace),m=getRenderTargetSamples(r);s&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(e.RENDERBUFFER,m,A,r.width,r.height):useMultisampledRTT(r)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,m,A,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,A,r.width,r.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function setupDepthRenderbuffer(t){const o=s.get(t),l=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!o.__autoAllocateDepthBuffer){if(l)throw new Error("target.depthTexture not supported in Cube render targets");!function setupDepthTexture(t,o){if(o&&o.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(e.FRAMEBUFFER,t),!o.depthTexture||!o.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");s.get(o.depthTexture).__webglTexture&&o.depthTexture.image.width===o.width&&o.depthTexture.image.height===o.height||(o.depthTexture.image.width=o.width,o.depthTexture.image.height=o.height,o.depthTexture.needsUpdate=!0),setTexture2D(o.depthTexture,0);const l=s.get(o.depthTexture).__webglTexture,c=getRenderTargetSamples(o);if(o.depthTexture.format===q)useMultisampledRTT(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,l,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,l,0);else{if(o.depthTexture.format!==j)throw new Error("Unknown depthTexture format");useMultisampledRTT(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,l,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,l,0)}}(o.__webglFramebuffer,t)}else if(l){o.__webglDepthbuffer=[];for(let s=0;s<6;s++)r.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[s]),o.__webglDepthbuffer[s]=e.createRenderbuffer(),setupRenderBufferStorage(o.__webglDepthbuffer[s],t,!1)}else r.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer),o.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(o.__webglDepthbuffer,t,!1);r.bindFramebuffer(e.FRAMEBUFFER,null)}function getRenderTargetSamples(e){return Math.min(l.maxSamples,e.samples)}function useMultisampledRTT(e){const r=s.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function verifyColorSpace(e,t){const r=e.colorSpace,s=e.format,l=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||r!==ye&&r!==_e&&(He.getTransfer(r)===Ce?s===W&&l===B||o.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):o.error("THREE.WebGLTextures: Unsupported texture color space:",r)),t}function getDimensions(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(A.width=e.naturalWidth||e.width,A.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(A.width=e.displayWidth,A.height=e.displayHeight):(A.width=e.width,A.height=e.height),A}this.allocateTextureUnit=function allocateTextureUnit(){const e=O;return e>=l.maxTextures&&o.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l.maxTextures),O+=1,e},this.resetTextureUnits=function resetTextureUnits(){O=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function setTexture2DArray(t,o){const l=s.get(t);t.version>0&&l.__version!==t.version?uploadTexture(l,t,o):r.bindTexture(e.TEXTURE_2D_ARRAY,l.__webglTexture,e.TEXTURE0+o)},this.setTexture3D=function setTexture3D(t,o){const l=s.get(t);t.version>0&&l.__version!==t.version?uploadTexture(l,t,o):r.bindTexture(e.TEXTURE_3D,l.__webglTexture,e.TEXTURE0+o)},this.setTextureCube=function setTextureCube(t,h){const d=s.get(t);t.version>0&&d.__version!==t.version?function uploadCubeTexture(t,h,d){if(6!==h.image.length)return;const p=initTexture(t,h),A=h.source;r.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+d);const m=s.get(A);if(A.version!==m.__version||!0===p){r.activeTexture(e.TEXTURE0+d);const t=He.getPrimaries(He.workingColorSpace),s=h.colorSpace===_e?null:He.getPrimaries(h.colorSpace),g=h.colorSpace===_e||t===s?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,h.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,h.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,g);const f=h.isCompressedTexture||h.image[0].isCompressedTexture,_=h.image[0]&&h.image[0].isDataTexture,y=[];for(let e=0;e<6;e++)y[e]=f||_?_?h.image[e].image:h.image[e]:resizeImage(h.image[e],!0,l.maxCubemapSize),y[e]=verifyColorSpace(h,y[e]);const E=y[0],x=c.convert(h.format,h.colorSpace),C=c.convert(h.type),S=getInternalFormat(h.internalFormat,x,C,h.colorSpace),I=!0!==h.isVideoTexture,b=void 0===m.__version||!0===p,T=A.dataReady;let B,U=getMipLevels(h,E);if(setTextureParameters(e.TEXTURE_CUBE_MAP,h),f){I&&b&&r.texStorage2D(e.TEXTURE_CUBE_MAP,U,S,E.width,E.height);for(let t=0;t<6;t++){B=y[t].mipmaps;for(let s=0;s<B.length;s++){const l=B[s];h.format!==W?null!==x?I?T&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,0,0,l.width,l.height,x,l.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,S,l.width,l.height,0,l.data):o.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):I?T&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,0,0,l.width,l.height,x,C,l.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,S,l.width,l.height,0,x,C,l.data)}}}else{if(B=h.mipmaps,I&&b){B.length>0&&U++;const t=getDimensions(y[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,U,S,t.width,t.height)}for(let t=0;t<6;t++)if(_){I?T&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,y[t].width,y[t].height,x,C,y[t].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,y[t].width,y[t].height,0,x,C,y[t].data);for(let s=0;s<B.length;s++){const o=B[s].image[t].image;I?T&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,0,0,o.width,o.height,x,C,o.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,S,o.width,o.height,0,x,C,o.data)}}else{I?T&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,x,C,y[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,x,C,y[t]);for(let s=0;s<B.length;s++){const o=B[s];I?T&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,0,0,x,C,o.image[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,S,x,C,o.image[t])}}}textureNeedsGenerateMipmaps(h)&&generateMipmap(e.TEXTURE_CUBE_MAP),m.__version=A.version,h.onUpdate&&h.onUpdate(h)}t.__version=h.version}(d,t,h):r.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture,e.TEXTURE0+h)},this.rebindTextures=function rebindTextures(t,r,o){const l=s.get(t);void 0!==r&&setupFrameBufferTexture(l.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==o&&setupDepthRenderbuffer(t)},this.setupRenderTarget=function setupRenderTarget(t){const o=t.texture,l=s.get(t),d=s.get(o);t.addEventListener("dispose",onRenderTargetDispose);const p=t.textures,A=!0===t.isWebGLCubeRenderTarget,m=p.length>1;if(m||(void 0===d.__webglTexture&&(d.__webglTexture=e.createTexture()),d.__version=o.version,h.memory.textures++),A){l.__webglFramebuffer=[];for(let t=0;t<6;t++)if(o.mipmaps&&o.mipmaps.length>0){l.__webglFramebuffer[t]=[];for(let r=0;r<o.mipmaps.length;r++)l.__webglFramebuffer[t][r]=e.createFramebuffer()}else l.__webglFramebuffer[t]=e.createFramebuffer()}else{if(o.mipmaps&&o.mipmaps.length>0){l.__webglFramebuffer=[];for(let t=0;t<o.mipmaps.length;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else l.__webglFramebuffer=e.createFramebuffer();if(m)for(let t=0,r=p.length;t<r;t++){const r=s.get(p[t]);void 0===r.__webglTexture&&(r.__webglTexture=e.createTexture(),h.memory.textures++)}if(t.samples>0&&!1===useMultisampledRTT(t)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let r=0;r<p.length;r++){const s=p[r];l.__webglColorRenderbuffer[r]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,l.__webglColorRenderbuffer[r]);const o=c.convert(s.format,s.colorSpace),h=c.convert(s.type),d=getInternalFormat(s.internalFormat,o,h,s.colorSpace,!0===t.isXRRenderTarget),A=getRenderTargetSamples(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,A,d,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+r,e.RENDERBUFFER,l.__webglColorRenderbuffer[r])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),setupRenderBufferStorage(l.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(A){r.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture),setTextureParameters(e.TEXTURE_CUBE_MAP,o);for(let r=0;r<6;r++)if(o.mipmaps&&o.mipmaps.length>0)for(let s=0;s<o.mipmaps.length;s++)setupFrameBufferTexture(l.__webglFramebuffer[r][s],t,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,s);else setupFrameBufferTexture(l.__webglFramebuffer[r],t,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0);textureNeedsGenerateMipmaps(o)&&generateMipmap(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(m){for(let o=0,c=p.length;o<c;o++){const c=p[o],h=s.get(c);r.bindTexture(e.TEXTURE_2D,h.__webglTexture),setTextureParameters(e.TEXTURE_2D,c),setupFrameBufferTexture(l.__webglFramebuffer,t,c,e.COLOR_ATTACHMENT0+o,e.TEXTURE_2D,0),textureNeedsGenerateMipmaps(c)&&generateMipmap(e.TEXTURE_2D)}r.unbindTexture()}else{let s=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(s=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(s,d.__webglTexture),setTextureParameters(s,o),o.mipmaps&&o.mipmaps.length>0)for(let r=0;r<o.mipmaps.length;r++)setupFrameBufferTexture(l.__webglFramebuffer[r],t,o,e.COLOR_ATTACHMENT0,s,r);else setupFrameBufferTexture(l.__webglFramebuffer,t,o,e.COLOR_ATTACHMENT0,s,0);textureNeedsGenerateMipmaps(o)&&generateMipmap(s),r.unbindTexture()}t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function updateRenderTargetMipmap(t){const o=t.textures;for(let l=0,c=o.length;l<c;l++){const c=o[l];if(textureNeedsGenerateMipmaps(c)){const o=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,l=s.get(c).__webglTexture;r.bindTexture(o,l),generateMipmap(o),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function updateMultisampleRenderTarget(t){if(t.samples>0&&!1===useMultisampledRTT(t)){const o=t.textures,l=t.width,c=t.height;let h=e.COLOR_BUFFER_BIT;const d=[],A=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,m=s.get(t),g=o.length>1;if(g)for(let t=0;t<o.length;t++)r.bindFramebuffer(e.FRAMEBUFFER,m.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,m.__webglMultisampledFramebuffer),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let r=0;r<o.length;r++){d.push(e.COLOR_ATTACHMENT0+r),t.depthBuffer&&d.push(A);const f=void 0!==m.__ignoreDepthValues&&m.__ignoreDepthValues;if(!1===f&&(t.depthBuffer&&(h|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&!0!==m.__isTransmissionRenderTarget&&(h|=e.STENCIL_BUFFER_BIT)),g&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,m.__webglColorRenderbuffer[r]),!0===f&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[A]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[A])),g){const t=s.get(o[r]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,l,c,0,0,l,c,h,e.NEAREST),p&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,d)}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),g)for(let t=0;t<o.length;t++){r.bindFramebuffer(e.FRAMEBUFFER,m.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,m.__webglColorRenderbuffer[t]);const l=s.get(o[t]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,l,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,m.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(e,t){return{convert:function convert(r,s=""){let o;const l=He.getTransfer(s);if(r===B)return e.UNSIGNED_BYTE;if(1017===r)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===r)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===r)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===r)return e.BYTE;if(1011===r)return e.SHORT;if(1012===r)return e.UNSIGNED_SHORT;if(r===U)return e.INT;if(r===F)return e.UNSIGNED_INT;if(r===Q)return e.FLOAT;if(r===O)return e.HALF_FLOAT;if(1021===r)return e.ALPHA;if(1022===r)return e.RGB;if(r===W)return e.RGBA;if(1024===r)return e.LUMINANCE;if(1025===r)return e.LUMINANCE_ALPHA;if(r===q)return e.DEPTH_COMPONENT;if(r===j)return e.DEPTH_STENCIL;if(r===X)return e.RED;if(1029===r)return e.RED_INTEGER;if(r===Y)return e.RG;if(1031===r)return e.RG_INTEGER;if(1033===r)return e.RGBA_INTEGER;if(r===K||r===J||r===$||r===ee)if(l===Ce){if(o=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===o)return null;if(r===K)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===J)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===$)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ee)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(o=t.get("WEBGL_compressed_texture_s3tc"),null===o)return null;if(r===K)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===J)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===$)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ee)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(r===te||35841===r||r===ie||35843===r){if(o=t.get("WEBGL_compressed_texture_pvrtc"),null===o)return null;if(r===te)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===r)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===ie)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===r)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(r===ne)return o=t.get("WEBGL_compressed_texture_etc1"),null!==o?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===re||r===se){if(o=t.get("WEBGL_compressed_texture_etc"),null===o)return null;if(r===re)return l===Ce?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(r===se)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}if(r===ae||37809===r||37810===r||37811===r||r===oe||37813===r||37814===r||37815===r||37816===r||37817===r||37818===r||37819===r||37820===r||37821===r){if(o=t.get("WEBGL_compressed_texture_astc"),null===o)return null;if(r===ae)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===oe)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===r)return l===Ce?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}if(r===le||36494===r||36495===r){if(o=t.get("EXT_texture_compression_bptc"),null===o)return null;if(r===le)return l===Ce?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===r)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===r)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===r||36284===r||36285===r||36286===r){if(o=t.get("EXT_texture_compression_rgtc"),null===o)return null;if(r===le)return o.COMPRESSED_RED_RGTC1_EXT;if(36284===r)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===r)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===r)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return r===G?e.UNSIGNED_INT_24_8:void 0!==e[r]?e[r]:null}}}class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class three_module_Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}}const In={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new three_module_Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new three_module_Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new three_module_Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new three_module_Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new three_module_Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new three_module_Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new three_module_Vector3),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,r){let s=null,o=null,l=null;const c=this._targetRay,h=this._grip,d=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(d&&e.hand){l=!0;for(const s of e.hand.values()){const e=t.getJointPose(s,r),o=this._getHandJoint(d,s);null!==e&&(o.matrix.fromArray(e.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,o.jointRadius=e.radius),o.visible=null!==e}const s=d.joints["index-finger-tip"],o=d.joints["thumb-tip"],c=s.position.distanceTo(o.position),h=.02,p=.005;d.inputState.pinching&&c>h+p?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&c<=h-p&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==h&&e.gripSpace&&(o=t.getPose(e.gripSpace,r),null!==o&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));null!==c&&(s=t.getPose(e.targetRaySpace,r),null===s&&null!==o&&(s=o),null!==s&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(In)))}return null!==c&&(c.visible=null!==s),null!==h&&(h.visible=null!==o),null!==d&&(d.visible=null!==l),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const r=new three_module_Group;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,r){if(null===this.texture){const s=new Texture;e.properties.get(s).__webglTexture=t.texture,t.depthNear==r.depthNear&&t.depthFar==r.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}render(e,t){if(null!==this.texture){if(null===this.mesh){const e=t.cameras[0].viewport,r=new ShaderMaterial({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new three_module_Mesh(new PlaneGeometry(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class WebXRManager extends EventDispatcher{constructor(e,t){super();const r=this;let s=null,l=1,c=null,h="local-floor",d=1,p=null,A=null,m=null,g=null,f=null,_=null;const y=new WebXRDepthSensing,E=t.getContextAttributes();let x=null,C=null;const S=[],I=[],b=new Vector2;let T=null;const U=new PerspectiveCamera;U.layers.enable(1),U.viewport=new Vector4;const Q=new PerspectiveCamera;Q.layers.enable(2),Q.viewport=new Vector4;const O=[U,Q],X=new ArrayCamera;X.layers.enable(1),X.layers.enable(2);let Y=null,K=null;function onSessionEvent(e){const t=I.indexOf(e.inputSource);if(-1===t)return;const r=S[t];void 0!==r&&(r.update(e.inputSource,e.frame,p||c),r.dispatchEvent({type:e.type,data:e.inputSource}))}function onSessionEnd(){s.removeEventListener("select",onSessionEvent),s.removeEventListener("selectstart",onSessionEvent),s.removeEventListener("selectend",onSessionEvent),s.removeEventListener("squeeze",onSessionEvent),s.removeEventListener("squeezestart",onSessionEvent),s.removeEventListener("squeezeend",onSessionEvent),s.removeEventListener("end",onSessionEnd),s.removeEventListener("inputsourceschange",onInputSourcesChange);for(let e=0;e<S.length;e++){const t=I[e];null!==t&&(I[e]=null,S[e].disconnect(t))}Y=null,K=null,y.reset(),e.setRenderTarget(x),f=null,g=null,m=null,s=null,C=null,te.stop(),r.isPresenting=!1,e.setPixelRatio(T),e.setSize(b.width,b.height,!1),r.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(e){for(let t=0;t<e.removed.length;t++){const r=e.removed[t],s=I.indexOf(r);s>=0&&(I[s]=null,S[s].disconnect(r))}for(let t=0;t<e.added.length;t++){const r=e.added[t];let s=I.indexOf(r);if(-1===s){for(let e=0;e<S.length;e++){if(e>=I.length){I.push(r),s=e;break}if(null===I[e]){I[e]=r,s=e;break}}if(-1===s)break}const o=S[s];o&&o.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=S[e];return void 0===t&&(t=new WebXRController,S[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=S[e];return void 0===t&&(t=new WebXRController,S[e]=t),t.getGripSpace()},this.getHand=function(e){let t=S[e];return void 0===t&&(t=new WebXRController,S[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){l=e,!0===r.isPresenting&&o.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){h=e,!0===r.isPresenting&&o.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p||c},this.setReferenceSpace=function(e){p=e},this.getBaseLayer=function(){return null!==g?g:f},this.getBinding=function(){return m},this.getFrame=function(){return _},this.getSession=function(){return s},this.setSession=async function(o){if(s=o,null!==s){if(x=e.getRenderTarget(),s.addEventListener("select",onSessionEvent),s.addEventListener("selectstart",onSessionEvent),s.addEventListener("selectend",onSessionEvent),s.addEventListener("squeeze",onSessionEvent),s.addEventListener("squeezestart",onSessionEvent),s.addEventListener("squeezeend",onSessionEvent),s.addEventListener("end",onSessionEnd),s.addEventListener("inputsourceschange",onInputSourcesChange),!0!==E.xrCompatible&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(b),void 0===s.renderState.layers){const r={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:l};f=new XRWebGLLayer(s,t,r),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),C=new WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:W,type:B,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil})}else{let r=null,o=null,c=null;E.depth&&(c=E.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,r=E.stencil?j:q,o=E.stencil?G:F);const h={colorFormat:t.RGBA8,depthFormat:c,scaleFactor:l};m=new XRWebGLBinding(s,t),g=m.createProjectionLayer(h),s.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),C=new WebGLRenderTarget(g.textureWidth,g.textureHeight,{format:W,type:B,depthTexture:new DepthTexture(g.textureWidth,g.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,r),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0});e.properties.get(C).__ignoreDepthValues=g.ignoreDepthValues}C.isXRRenderTarget=!0,this.setFoveation(d),p=null,c=await s.requestReferenceSpace(h),te.setContext(s),te.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode};const J=new three_module_Vector3,$=new three_module_Vector3;function updateCamera(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===s)return;null!==y.texture&&(e.near=y.depthNear,e.far=y.depthFar),X.near=Q.near=U.near=e.near,X.far=Q.far=U.far=e.far,Y===X.near&&K===X.far||(s.updateRenderState({depthNear:X.near,depthFar:X.far}),Y=X.near,K=X.far,U.near=Y,U.far=K,Q.near=Y,Q.far=K,U.updateProjectionMatrix(),Q.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,r=X.cameras;updateCamera(X,t);for(let e=0;e<r.length;e++)updateCamera(r[e],t);2===r.length?function setProjectionFromUnion(e,t,r){J.setFromMatrixPosition(t.matrixWorld),$.setFromMatrixPosition(r.matrixWorld);const s=J.distanceTo($),o=t.projectionMatrix.elements,l=r.projectionMatrix.elements,c=o[14]/(o[10]-1),h=o[14]/(o[10]+1),d=(o[9]+1)/o[5],p=(o[9]-1)/o[5],A=(o[8]-1)/o[0],m=(l[8]+1)/l[0],g=c*A,f=c*m,_=s/(-A+m),y=_*-A;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(y),e.translateZ(_),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const E=c+_,x=h+_,C=g-y,S=f+(s-y),I=d*h/x*E,b=p*h/x*E;e.projectionMatrix.makePerspective(C,S,I,b,E,x),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(X,U,Q):X.projectionMatrix.copy(U.projectionMatrix),function updateUserCamera(e,t,r){null===r?e.matrix.copy(t.matrixWorld):(e.matrix.copy(r.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*Pe*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,X,t)},this.getCamera=function(){return X},this.getFoveation=function(){if(null!==g||null!==f)return d},this.setFoveation=function(e){d=e,null!==g&&(g.fixedFoveation=e),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==y.texture};let ee=null;const te=new WebGLAnimation;te.setAnimationLoop((function onAnimationFrame(t,o){if(A=o.getViewerPose(p||c),_=o,null!==A){const t=A.views;null!==f&&(e.setRenderTargetFramebuffer(C,f.framebuffer),e.setRenderTarget(C));let r=!1;t.length!==X.cameras.length&&(X.cameras.length=0,r=!0);for(let s=0;s<t.length;s++){const o=t[s];let l=null;if(null!==f)l=f.getViewport(o);else{const t=m.getViewSubImage(g,o);l=t.viewport,0===s&&(e.setRenderTargetTextures(C,t.colorTexture,g.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(C))}let c=O[s];void 0===c&&(c=new PerspectiveCamera,c.layers.enable(s),c.viewport=new Vector4,O[s]=c),c.matrix.fromArray(o.transform.matrix),c.matrix.decompose(c.position,c.quaternion,c.scale),c.projectionMatrix.fromArray(o.projectionMatrix),c.projectionMatrixInverse.copy(c.projectionMatrix).invert(),c.viewport.set(l.x,l.y,l.width,l.height),0===s&&(X.matrix.copy(c.matrix),X.matrix.decompose(X.position,X.quaternion,X.scale)),!0===r&&X.cameras.push(c)}const o=s.enabledFeatures;if(o&&o.includes("depth-sensing")){const r=m.getDepthInformation(t[0]);r&&r.isValid&&r.texture&&y.init(e,r,s.renderState)}}for(let e=0;e<S.length;e++){const t=I[e],r=S[e];null!==t&&void 0!==r&&r.update(t,o,p||c)}y.render(e,X),ee&&ee(t,o),o.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:o}),_=null})),this.setAnimationLoop=function(e){ee=e},this.dispose=function(){}}}const bn=new Euler,wn=new three_module_Matrix4;function WebGLMaterials(e,t){function refreshTransformUniform(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function refreshUniformsCommon(r,s){r.opacity.value=s.opacity,s.color&&r.diffuse.value.copy(s.color),s.emissive&&r.emissive.value.copy(s.emissive).multiplyScalar(s.emissiveIntensity),s.map&&(r.map.value=s.map,refreshTransformUniform(s.map,r.mapTransform)),s.alphaMap&&(r.alphaMap.value=s.alphaMap,refreshTransformUniform(s.alphaMap,r.alphaMapTransform)),s.bumpMap&&(r.bumpMap.value=s.bumpMap,refreshTransformUniform(s.bumpMap,r.bumpMapTransform),r.bumpScale.value=s.bumpScale,1===s.side&&(r.bumpScale.value*=-1)),s.normalMap&&(r.normalMap.value=s.normalMap,refreshTransformUniform(s.normalMap,r.normalMapTransform),r.normalScale.value.copy(s.normalScale),1===s.side&&r.normalScale.value.negate()),s.displacementMap&&(r.displacementMap.value=s.displacementMap,refreshTransformUniform(s.displacementMap,r.displacementMapTransform),r.displacementScale.value=s.displacementScale,r.displacementBias.value=s.displacementBias),s.emissiveMap&&(r.emissiveMap.value=s.emissiveMap,refreshTransformUniform(s.emissiveMap,r.emissiveMapTransform)),s.specularMap&&(r.specularMap.value=s.specularMap,refreshTransformUniform(s.specularMap,r.specularMapTransform)),s.alphaTest>0&&(r.alphaTest.value=s.alphaTest);const o=t.get(s),l=o.envMap,c=o.envMapRotation;if(l&&(r.envMap.value=l,bn.copy(c),bn.x*=-1,bn.y*=-1,bn.z*=-1,l.isCubeTexture&&!1===l.isRenderTargetTexture&&(bn.y*=-1,bn.z*=-1),r.envMapRotation.value.setFromMatrix4(wn.makeRotationFromEuler(bn)),r.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1,r.reflectivity.value=s.reflectivity,r.ior.value=s.ior,r.refractionRatio.value=s.refractionRatio),s.lightMap){r.lightMap.value=s.lightMap;const t=!0===e._useLegacyLights?Math.PI:1;r.lightMapIntensity.value=s.lightMapIntensity*t,refreshTransformUniform(s.lightMap,r.lightMapTransform)}s.aoMap&&(r.aoMap.value=s.aoMap,r.aoMapIntensity.value=s.aoMapIntensity,refreshTransformUniform(s.aoMap,r.aoMapTransform))}return{refreshFogUniforms:function refreshFogUniforms(t,r){r.color.getRGB(t.fogColor.value,getUnlitUniformColorSpace(e)),r.isFog?(t.fogNear.value=r.near,t.fogFar.value=r.far):r.isFogExp2&&(t.fogDensity.value=r.density)},refreshMaterialUniforms:function refreshMaterialUniforms(e,r,s,o,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?refreshUniformsCommon(e,r):r.isMeshToonMaterial?(refreshUniformsCommon(e,r),function refreshUniformsToon(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(refreshUniformsCommon(e,r),function refreshUniformsPhong(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(refreshUniformsCommon(e,r),function refreshUniformsStandard(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,refreshTransformUniform(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,refreshTransformUniform(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function refreshUniformsPhysical(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,refreshTransformUniform(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,refreshTransformUniform(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,refreshTransformUniform(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,refreshTransformUniform(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,refreshTransformUniform(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate()));t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,refreshTransformUniform(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,refreshTransformUniform(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,refreshTransformUniform(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,refreshTransformUniform(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,refreshTransformUniform(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,refreshTransformUniform(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,refreshTransformUniform(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,l)):r.isMeshMatcapMaterial?(refreshUniformsCommon(e,r),function refreshUniformsMatcap(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?refreshUniformsCommon(e,r):r.isMeshDistanceMaterial?(refreshUniformsCommon(e,r),function refreshUniformsDistance(e,r){const s=t.get(r).light;e.referencePosition.value.setFromMatrixPosition(s.matrixWorld),e.nearDistance.value=s.shadow.camera.near,e.farDistance.value=s.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?refreshUniformsCommon(e,r):r.isLineBasicMaterial?(!function refreshUniformsLine(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function refreshUniformsDash(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function refreshUniformsPoints(e,t,r,s){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*s,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,refreshTransformUniform(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,o):r.isSpriteMaterial?function refreshUniformsSprites(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,refreshTransformUniform(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(e,t,r,s){let l={},c={},h=[];const d=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function hasUniformChanged(e,t,r,s){const o=e.value,l=t+"_"+r;if(void 0===s[l])return s[l]="number"==typeof o||"boolean"==typeof o?o:o.clone(),!0;{const e=s[l];if("number"==typeof o||"boolean"==typeof o){if(e!==o)return s[l]=o,!0}else if(!1===e.equals(o))return e.copy(o),!0}return!1}function getUniformSize(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?o.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):o.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function onUniformsGroupsDispose(t){const r=t.target;r.removeEventListener("dispose",onUniformsGroupsDispose);const s=h.indexOf(r.__bindingPointIndex);h.splice(s,1),e.deleteBuffer(l[r.id]),delete l[r.id],delete c[r.id]}return{bind:function bind(e,t){const r=t.program;s.uniformBlockBinding(e,r)},update:function update(r,p){let A=l[r.id];void 0===A&&(!function prepareUniformsGroup(e){const t=e.uniforms;let r=0;const s=16;for(let e=0,o=t.length;e<o;e++){const o=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=o.length;e<t;e++){const t=o[e],l=Array.isArray(t.value)?t.value:[t.value];for(let e=0,o=l.length;e<o;e++){const o=getUniformSize(l[e]),c=r%s;0!==c&&s-c<o.boundary&&(r+=s-c),t.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=r,r+=o.storage}}}const o=r%s;o>0&&(r+=s-o);return e.__size=r,e.__cache={},this}(r),A=function createBuffer(t){const r=function allocateBindingPointIndex(){for(let e=0;e<d;e++)if(-1===h.indexOf(e))return h.push(e),e;return o.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=r;const s=e.createBuffer(),l=t.__size,c=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,s),e.bufferData(e.UNIFORM_BUFFER,l,c),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,r,s),s}(r),l[r.id]=A,r.addEventListener("dispose",onUniformsGroupsDispose));const m=p.program;s.updateUBOMapping(r,m);const g=t.render.frame;c[r.id]!==g&&(!function updateBufferData(t){const r=l[t.id],s=t.uniforms,o=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,r);for(let t=0,r=s.length;t<r;t++){const r=Array.isArray(s[t])?s[t]:[s[t]];for(let s=0,l=r.length;s<l;s++){const l=r[s];if(!0===hasUniformChanged(l,t,s,o)){const t=l.__offset,r=Array.isArray(l.value)?l.value:[l.value];let s=0;for(let o=0;o<r.length;o++){const c=r[o],h=getUniformSize(c);"number"==typeof c||"boolean"==typeof c?(l.__data[0]=c,e.bufferSubData(e.UNIFORM_BUFFER,t+s,l.__data)):c.isMatrix3?(l.__data[0]=c.elements[0],l.__data[1]=c.elements[1],l.__data[2]=c.elements[2],l.__data[3]=0,l.__data[4]=c.elements[3],l.__data[5]=c.elements[4],l.__data[6]=c.elements[5],l.__data[7]=0,l.__data[8]=c.elements[6],l.__data[9]=c.elements[7],l.__data[10]=c.elements[8],l.__data[11]=0):(c.toArray(l.__data,s),s+=h.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,l.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(r),c[r.id]=g)},dispose:function dispose(){for(const t in l)e.deleteBuffer(l[t]);h=[],l={},c={}}}}class WebGLRenderer{constructor(e={}){const{canvas:t=createCanvasElement(),context:r=null,depth:s=!0,stencil:l=!1,alpha:c=!1,antialias:h=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:p=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:m=!1}=e;let g;if(this.isWebGLRenderer=!0,null!==r){if("undefined"!=typeof WebGLRenderingContext&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=r.getContextAttributes().alpha}else g=c;const f=new Uint32Array(4),_=new Int32Array(4);let y=null,E=null;const x=[],C=[];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=ve,this._useLegacyLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const S=this;let I=!1,b=0,U=0,q=null,j=-1,X=null;const Y=new Vector4,K=new Vector4;let J=null;const $=new Color(0);let ee=0,te=t.width,ie=t.height,ne=1,re=null,se=null;const ae=new Vector4(0,0,te,ie),oe=new Vector4(0,0,te,ie);let le=!1;const ce=new Frustum;let he=!1,ue=!1;const de=new three_module_Matrix4,pe=new Vector2,Ae=new three_module_Vector3,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){return null===q?ne:1}let ge,fe,_e,Ee,xe,Me,Ce,Se,Ie,be,we,Te,Be,Re,Le,De,Ue,Pe,Fe,Ne,Qe,Oe,ke,Ge,Ve=r;function getContext(e,r){const s=t.getContext(e,r);return null!==s?s:null}try{const e={alpha:!0,depth:s,stencil:l,antialias:h,premultipliedAlpha:d,preserveDrawingBuffer:p,powerPreference:A,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r163"),t.addEventListener("webglcontextlost",onContextLost,!1),t.addEventListener("webglcontextrestored",onContextRestore,!1),t.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===Ve){const t="webgl2";if(Ve=getContext(t,e),null===Ve)throw getContext(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw o.error("THREE.WebGLRenderer: "+e.message),e}function initGLContext(){ge=new WebGLExtensions(Ve),ge.init(),fe=new WebGLCapabilities(Ve,ge,e),Oe=new WebGLUtils(Ve,ge),_e=new WebGLState(Ve),Ee=new WebGLInfo(Ve),xe=new WebGLProperties,Me=new WebGLTextures(Ve,ge,_e,xe,fe,Oe,Ee),Ce=new WebGLCubeMaps(S),Se=new WebGLCubeUVMaps(S),Ie=new WebGLAttributes(Ve),ke=new WebGLBindingStates(Ve,Ie),be=new WebGLGeometries(Ve,Ie,Ee,ke),we=new WebGLObjects(Ve,be,Ie,Ee),Fe=new WebGLMorphtargets(Ve,fe,Me),De=new WebGLClipping(xe),Te=new WebGLPrograms(S,Ce,Se,ge,fe,ke,De),Be=new WebGLMaterials(S,xe),Re=new WebGLRenderLists,Le=new WebGLRenderStates(ge),Pe=new WebGLBackground(S,Ce,Se,_e,we,g,d),Ue=new WebGLShadowMap(S,we,fe),Ge=new WebGLUniformsGroups(Ve,Ee,fe,_e),Ne=new WebGLBufferRenderer(Ve,ge,Ee),Qe=new WebGLIndexedBufferRenderer(Ve,ge,Ee),Ee.programs=Te.programs,S.capabilities=fe,S.extensions=ge,S.properties=xe,S.renderLists=Re,S.shadowMap=Ue,S.state=_e,S.info=Ee}initGLContext();const He=new WebXRManager(S,Ve);function onContextLost(e){e.preventDefault(),o.log("THREE.WebGLRenderer: Context Lost."),I=!0}function onContextRestore(){o.log("THREE.WebGLRenderer: Context Restored."),I=!1;const e=Ee.autoReset,t=Ue.enabled,r=Ue.autoUpdate,s=Ue.needsUpdate,l=Ue.type;initGLContext(),Ee.autoReset=e,Ue.enabled=t,Ue.autoUpdate=r,Ue.needsUpdate=s,Ue.type=l}function onContextCreationError(e){o.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function onMaterialDispose(e){const t=e.target;t.removeEventListener("dispose",onMaterialDispose),function deallocateMaterial(e){(function releaseMaterialProgramReferences(e){const t=xe.get(e).programs;void 0!==t&&(t.forEach((function(e){Te.releaseProgram(e)})),e.isShaderMaterial&&Te.releaseShaderCache(e))})(e),xe.remove(e)}(t)}function prepareMaterial(e,t,r){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,getProgram(e,t,r),e.side=0,e.needsUpdate=!0,getProgram(e,t,r),e.side=2):getProgram(e,t,r)}this.xr=He,this.getContext=function(){return Ve},this.getContextAttributes=function(){return Ve.getContextAttributes()},this.forceContextLoss=function(){const e=ge.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=ge.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(e){void 0!==e&&(ne=e,this.setSize(te,ie,!1))},this.getSize=function(e){return e.set(te,ie)},this.setSize=function(e,r,s=!0){He.isPresenting?o.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(te=e,ie=r,t.width=Math.floor(e*ne),t.height=Math.floor(r*ne),!0===s&&(t.style.width=e+"px",t.style.height=r+"px"),this.setViewport(0,0,e,r))},this.getDrawingBufferSize=function(e){return e.set(te*ne,ie*ne).floor()},this.setDrawingBufferSize=function(e,r,s){te=e,ie=r,ne=s,t.width=Math.floor(e*s),t.height=Math.floor(r*s),this.setViewport(0,0,e,r)},this.getCurrentViewport=function(e){return e.copy(Y)},this.getViewport=function(e){return e.copy(ae)},this.setViewport=function(e,t,r,s){e.isVector4?ae.set(e.x,e.y,e.z,e.w):ae.set(e,t,r,s),_e.viewport(Y.copy(ae).multiplyScalar(ne).round())},this.getScissor=function(e){return e.copy(oe)},this.setScissor=function(e,t,r,s){e.isVector4?oe.set(e.x,e.y,e.z,e.w):oe.set(e,t,r,s),_e.scissor(K.copy(oe).multiplyScalar(ne).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(e){_e.setScissorTest(le=e)},this.setOpaqueSort=function(e){re=e},this.setTransparentSort=function(e){se=e},this.getClearColor=function(e){return e.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor.apply(Pe,arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha.apply(Pe,arguments)},this.clear=function(e=!0,t=!0,r=!0){let s=0;if(e){let e=!1;if(null!==q){const t=q.texture.format;e=1033===t||1031===t||1029===t}if(e){const e=q.texture.type,t=e===B||e===F||1012===e||e===G||1017===e||1018===e,r=Pe.getClearColor(),s=Pe.getClearAlpha(),o=r.r,l=r.g,c=r.b;t?(f[0]=o,f[1]=l,f[2]=c,f[3]=s,Ve.clearBufferuiv(Ve.COLOR,0,f)):(_[0]=o,_[1]=l,_[2]=c,_[3]=s,Ve.clearBufferiv(Ve.COLOR,0,_))}else s|=Ve.COLOR_BUFFER_BIT}t&&(s|=Ve.DEPTH_BUFFER_BIT),r&&(s|=Ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ve.clear(s)},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",onContextLost,!1),t.removeEventListener("webglcontextrestored",onContextRestore,!1),t.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),Re.dispose(),Le.dispose(),xe.dispose(),Ce.dispose(),Se.dispose(),we.dispose(),ke.dispose(),Ge.dispose(),Te.dispose(),He.dispose(),He.removeEventListener("sessionstart",onXRSessionStart),He.removeEventListener("sessionend",onXRSessionEnd),We.stop()},this.renderBufferDirect=function(e,t,r,s,o,l){null===t&&(t=me);const c=o.isMesh&&o.matrixWorld.determinant()<0,h=function setProgram(e,t,r,s,o){!0!==t.isScene&&(t=me);Me.resetTextureUnits();const l=t.fog,c=s.isMeshStandardMaterial?t.environment:null,h=null===q?S.outputColorSpace:!0===q.isXRRenderTarget?q.texture.colorSpace:ye,d=(s.isMeshStandardMaterial?Se:Ce).get(s.envMap||c),p=!0===s.vertexColors&&!!r.attributes.color&&4===r.attributes.color.itemSize,A=!!r.attributes.tangent&&(!!s.normalMap||s.anisotropy>0),m=!!r.morphAttributes.position,g=!!r.morphAttributes.normal,f=!!r.morphAttributes.color;let _=0;s.toneMapped&&(null!==q&&!0!==q.isXRRenderTarget||(_=S.toneMapping));const y=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,x=void 0!==y?y.length:0,C=xe.get(s),I=E.state.lights;if(!0===he&&(!0===ue||e!==X)){const t=e===X&&s.id===j;De.setState(s,e,t)}let b=!1;s.version===C.__version?C.needsLights&&C.lightsStateVersion!==I.state.version||C.outputColorSpace!==h||o.isBatchedMesh&&!1===C.batching?b=!0:o.isBatchedMesh||!0!==C.batching?o.isInstancedMesh&&!1===C.instancing?b=!0:o.isInstancedMesh||!0!==C.instancing?o.isSkinnedMesh&&!1===C.skinning?b=!0:o.isSkinnedMesh||!0!==C.skinning?o.isInstancedMesh&&!0===C.instancingColor&&null===o.instanceColor||o.isInstancedMesh&&!1===C.instancingColor&&null!==o.instanceColor||o.isInstancedMesh&&!0===C.instancingMorph&&null===o.morphTexture||o.isInstancedMesh&&!1===C.instancingMorph&&null!==o.morphTexture||C.envMap!==d||!0===s.fog&&C.fog!==l?b=!0:void 0===C.numClippingPlanes||C.numClippingPlanes===De.numPlanes&&C.numIntersection===De.numIntersection?(C.vertexAlphas!==p||C.vertexTangents!==A||C.morphTargets!==m||C.morphNormals!==g||C.morphColors!==f||C.toneMapping!==_||C.morphTargetsCount!==x)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,C.__version=s.version);let T=C.currentProgram;!0===b&&(T=getProgram(s,t,o));let B=!1,U=!1,F=!1;const Q=T.getUniforms(),O=C.uniforms;_e.useProgram(T.program)&&(B=!0,U=!0,F=!0);s.id!==j&&(j=s.id,U=!0);if(B||X!==e){Q.setValue(Ve,"projectionMatrix",e.projectionMatrix),Q.setValue(Ve,"viewMatrix",e.matrixWorldInverse);const t=Q.map.cameraPosition;void 0!==t&&t.setValue(Ve,Ae.setFromMatrixPosition(e.matrixWorld)),fe.logarithmicDepthBuffer&&Q.setValue(Ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshLambertMaterial||s.isMeshBasicMaterial||s.isMeshStandardMaterial||s.isShaderMaterial)&&Q.setValue(Ve,"isOrthographic",!0===e.isOrthographicCamera),X!==e&&(X=e,U=!0,F=!0)}if(o.isSkinnedMesh){Q.setOptional(Ve,o,"bindMatrix"),Q.setOptional(Ve,o,"bindMatrixInverse");const e=o.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),Q.setValue(Ve,"boneTexture",e.boneTexture,Me))}o.isBatchedMesh&&(Q.setOptional(Ve,o,"batchingTexture"),Q.setValue(Ve,"batchingTexture",o._matricesTexture,Me));const G=r.morphAttributes;void 0===G.position&&void 0===G.normal&&void 0===G.color||Fe.update(o,r,T);(U||C.receiveShadow!==o.receiveShadow)&&(C.receiveShadow=o.receiveShadow,Q.setValue(Ve,"receiveShadow",o.receiveShadow));s.isMeshGouraudMaterial&&null!==s.envMap&&(O.envMap.value=d,O.flipEnvMap.value=d.isCubeTexture&&!1===d.isRenderTargetTexture?-1:1);s.isMeshStandardMaterial&&null===s.envMap&&null!==t.environment&&(O.envMapIntensity.value=t.environmentIntensity);U&&(Q.setValue(Ve,"toneMappingExposure",S.toneMappingExposure),C.needsLights&&function markUniformsLightsNeedsUpdate(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(O,F),l&&!0===s.fog&&Be.refreshFogUniforms(O,l),Be.refreshMaterialUniforms(O,s,ne,ie,E.state.transmissionRenderTarget),WebGLUniforms.upload(Ve,getUniformList(C),O,Me));s.isShaderMaterial&&!0===s.uniformsNeedUpdate&&(WebGLUniforms.upload(Ve,getUniformList(C),O,Me),s.uniformsNeedUpdate=!1);s.isSpriteMaterial&&Q.setValue(Ve,"center",o.center);if(Q.setValue(Ve,"modelViewMatrix",o.modelViewMatrix),Q.setValue(Ve,"normalMatrix",o.normalMatrix),Q.setValue(Ve,"modelMatrix",o.matrixWorld),s.isShaderMaterial||s.isRawShaderMaterial){const e=s.uniformsGroups;for(let t=0,r=e.length;t<r;t++){const r=e[t];Ge.update(r,T),Ge.bind(r,T)}}return T}(e,t,r,s,o);_e.setMaterial(s,c);let d=r.index,p=1;if(!0===s.wireframe){if(d=be.getWireframeAttribute(r),void 0===d)return;p=2}const A=r.drawRange,m=r.attributes.position;let g=A.start*p,f=(A.start+A.count)*p;null!==l&&(g=Math.max(g,l.start*p),f=Math.min(f,(l.start+l.count)*p)),null!==d?(g=Math.max(g,0),f=Math.min(f,d.count)):null!=m&&(g=Math.max(g,0),f=Math.min(f,m.count));const _=f-g;if(_<0||_===1/0)return;let y;ke.setup(o,s,h,r,d);let x=Ne;if(null!==d&&(y=Ie.get(d),x=Qe,x.setIndex(y)),o.isMesh)!0===s.wireframe?(_e.setLineWidth(s.wireframeLinewidth*getTargetPixelRatio()),x.setMode(Ve.LINES)):x.setMode(Ve.TRIANGLES);else if(o.isLine){let e=s.linewidth;void 0===e&&(e=1),_e.setLineWidth(e*getTargetPixelRatio()),o.isLineSegments?x.setMode(Ve.LINES):o.isLineLoop?x.setMode(Ve.LINE_LOOP):x.setMode(Ve.LINE_STRIP)}else o.isPoints?x.setMode(Ve.POINTS):o.isSprite&&x.setMode(Ve.TRIANGLES);if(o.isBatchedMesh)x.renderMultiDraw(o._multiDrawStarts,o._multiDrawCounts,o._multiDrawCount);else if(o.isInstancedMesh)x.renderInstances(g,_,o.count);else if(r.isInstancedBufferGeometry){const e=void 0!==r._maxInstanceCount?r._maxInstanceCount:1/0,t=Math.min(r.instanceCount,e);x.renderInstances(g,_,t)}else x.render(g,_)},this.compile=function(e,t,r=null){null===r&&(r=e),E=Le.get(r),E.init(),C.push(E),r.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(E.pushLight(e),e.castShadow&&E.pushShadow(e))})),e!==r&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(E.pushLight(e),e.castShadow&&E.pushShadow(e))})),E.setupLights(S._useLegacyLights);const s=new Set;return e.traverse((function(e){const t=e.material;if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++){const l=t[o];prepareMaterial(l,r,e),s.add(l)}else prepareMaterial(t,r,e),s.add(t)})),C.pop(),E=null,s},this.compileAsync=function(e,t,r=null){const s=this.compile(e,t,r);return new Promise((t=>{function checkMaterialsReady(){s.forEach((function(e){xe.get(e).currentProgram.isReady()&&s.delete(e)})),0!==s.size?setTimeout(checkMaterialsReady,10):t(e)}null!==ge.get("KHR_parallel_shader_compile")?checkMaterialsReady():setTimeout(checkMaterialsReady,10)}))};let ze=null;function onXRSessionStart(){We.stop()}function onXRSessionEnd(){We.start()}const We=new WebGLAnimation;function projectObject(e,t,r,s){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)E.pushLight(e),e.castShadow&&E.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ce.intersectsSprite(e)){s&&Ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(de);const t=we.update(e),o=e.material;o.visible&&y.push(e,t,o,r,Ae.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ce.intersectsObject(e))){const t=we.update(e),o=e.material;if(s&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),Ae.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),Ae.copy(t.boundingSphere.center)),Ae.applyMatrix4(e.matrixWorld).applyMatrix4(de)),Array.isArray(o)){const s=t.groups;for(let l=0,c=s.length;l<c;l++){const c=s[l],h=o[c.materialIndex];h&&h.visible&&y.push(e,t,h,r,Ae.z,c)}}else o.visible&&y.push(e,t,o,r,Ae.z,null)}const o=e.children;for(let e=0,l=o.length;e<l;e++)projectObject(o[e],t,r,s)}function renderScene(e,t,r,s){const o=e.opaque,c=e.transmissive,h=e.transparent;E.setupLightsView(r),!0===he&&De.setGlobalState(S.clippingPlanes,r),c.length>0&&function renderTransmissionPass(e,t,r,s){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;if(null===E.state.transmissionRenderTarget){E.state.transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")||ge.has("EXT_color_buffer_float")?O:B,minFilter:T,samples:4,stencilBuffer:l});xe.get(E.state.transmissionRenderTarget).__isTransmissionRenderTarget=!0}const o=E.state.transmissionRenderTarget;S.getDrawingBufferSize(pe),o.setSize(pe.x,pe.y);const c=S.getRenderTarget();S.setRenderTarget(o),S.getClearColor($),ee=S.getClearAlpha(),ee<1&&S.setClearColor(16777215,.5);S.clear();const h=S.toneMapping;S.toneMapping=0,renderObjects(e,r,s),Me.updateMultisampleRenderTarget(o),Me.updateRenderTargetMipmap(o);let d=!1;for(let e=0,o=t.length;e<o;e++){const o=t[e],l=o.object,c=o.geometry,h=o.material,p=o.group;if(2===h.side&&l.layers.test(s.layers)){const e=h.side;h.side=1,h.needsUpdate=!0,renderObject(l,r,s,c,h,p),h.side=e,h.needsUpdate=!0,d=!0}}!0===d&&(Me.updateMultisampleRenderTarget(o),Me.updateRenderTargetMipmap(o));S.setRenderTarget(c),S.setClearColor($,ee),S.toneMapping=h}(o,c,t,r),s&&_e.viewport(Y.copy(s)),o.length>0&&renderObjects(o,t,r),c.length>0&&renderObjects(c,t,r),h.length>0&&renderObjects(h,t,r),_e.buffers.depth.setTest(!0),_e.buffers.depth.setMask(!0),_e.buffers.color.setMask(!0),_e.setPolygonOffset(!1)}function renderObjects(e,t,r){const s=!0===t.isScene?t.overrideMaterial:null;for(let o=0,l=e.length;o<l;o++){const l=e[o],c=l.object,h=l.geometry,d=null===s?l.material:s,p=l.group;c.layers.test(r.layers)&&renderObject(c,t,r,h,d,p)}}function renderObject(e,t,r,s,o,l){e.onBeforeRender(S,t,r,s,o,l),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),o.onBeforeRender(S,t,r,s,e,l),!0===o.transparent&&2===o.side&&!1===o.forceSinglePass?(o.side=1,o.needsUpdate=!0,S.renderBufferDirect(r,t,s,o,e,l),o.side=0,o.needsUpdate=!0,S.renderBufferDirect(r,t,s,o,e,l),o.side=2):S.renderBufferDirect(r,t,s,o,e,l),e.onAfterRender(S,t,r,s,o,l)}function getProgram(e,t,r){!0!==t.isScene&&(t=me);const s=xe.get(e),o=E.state.lights,l=E.state.shadowsArray,c=o.state.version,h=Te.getParameters(e,o.state,l,t,r),d=Te.getProgramCacheKey(h);let p=s.programs;s.environment=e.isMeshStandardMaterial?t.environment:null,s.fog=t.fog,s.envMap=(e.isMeshStandardMaterial?Se:Ce).get(e.envMap||s.environment),s.envMapRotation=null!==s.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",onMaterialDispose),p=new Map,s.programs=p);let A=p.get(d);if(void 0!==A){if(s.currentProgram===A&&s.lightsStateVersion===c)return updateCommonMaterialProperties(e,h),A}else h.uniforms=Te.getUniforms(e),e.onBuild(r,h,S),e.onBeforeCompile(h,S),A=Te.acquireProgram(h,d),p.set(d,A),s.uniforms=h.uniforms;const m=s.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=De.uniform),updateCommonMaterialProperties(e,h),s.needsLights=function materialNeedsLights(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),s.lightsStateVersion=c,s.needsLights&&(m.ambientLightColor.value=o.state.ambient,m.lightProbe.value=o.state.probe,m.directionalLights.value=o.state.directional,m.directionalLightShadows.value=o.state.directionalShadow,m.spotLights.value=o.state.spot,m.spotLightShadows.value=o.state.spotShadow,m.rectAreaLights.value=o.state.rectArea,m.ltc_1.value=o.state.rectAreaLTC1,m.ltc_2.value=o.state.rectAreaLTC2,m.pointLights.value=o.state.point,m.pointLightShadows.value=o.state.pointShadow,m.hemisphereLights.value=o.state.hemi,m.directionalShadowMap.value=o.state.directionalShadowMap,m.directionalShadowMatrix.value=o.state.directionalShadowMatrix,m.spotShadowMap.value=o.state.spotShadowMap,m.spotLightMatrix.value=o.state.spotLightMatrix,m.spotLightMap.value=o.state.spotLightMap,m.pointShadowMap.value=o.state.pointShadowMap,m.pointShadowMatrix.value=o.state.pointShadowMatrix),s.currentProgram=A,s.uniformsList=null,A}function getUniformList(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=WebGLUniforms.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function updateCommonMaterialProperties(e,t){const r=xe.get(e);r.outputColorSpace=t.outputColorSpace,r.batching=t.batching,r.instancing=t.instancing,r.instancingColor=t.instancingColor,r.instancingMorph=t.instancingMorph,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}We.setAnimationLoop((function onAnimationFrame(e){ze&&ze(e)})),"undefined"!=typeof self&&We.setContext(self),this.setAnimationLoop=function(e){ze=e,He.setAnimationLoop(e),null===e?We.stop():We.start()},He.addEventListener("sessionstart",onXRSessionStart),He.addEventListener("sessionend",onXRSessionEnd),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void o.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===I)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===He.enabled&&!0===He.isPresenting&&(!0===He.cameraAutoUpdate&&He.updateCamera(t),t=He.getCamera()),!0===e.isScene&&e.onBeforeRender(S,e,t,q),E=Le.get(e,C.length),E.init(),C.push(E),de.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ce.setFromProjectionMatrix(de),ue=this.localClippingEnabled,he=De.init(this.clippingPlanes,ue),y=Re.get(e,x.length),y.init(),x.push(y),projectObject(e,t,0,S.sortObjects),y.finish(),!0===S.sortObjects&&y.sort(re,se),this.info.render.frame++,!0===he&&De.beginShadows();const r=E.state.shadowsArray;if(Ue.render(r,e,t),!0===he&&De.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1!==He.enabled&&!1!==He.isPresenting&&!1!==He.hasDepthSensing()||Pe.render(y,e),E.setupLights(S._useLegacyLights),t.isArrayCamera){const r=t.cameras;for(let t=0,s=r.length;t<s;t++){const s=r[t];renderScene(y,e,s,s.viewport)}}else renderScene(y,e,t);null!==q&&(Me.updateMultisampleRenderTarget(q),Me.updateRenderTargetMipmap(q)),!0===e.isScene&&e.onAfterRender(S,e,t),ke.resetDefaultState(),j=-1,X=null,C.pop(),E=C.length>0?C[C.length-1]:null,x.pop(),y=x.length>0?x[x.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(e,t,r){xe.get(e.texture).__webglTexture=t,xe.get(e.depthTexture).__webglTexture=r;const s=xe.get(e);s.__hasExternalTextures=!0,s.__autoAllocateDepthBuffer=void 0===r,s.__autoAllocateDepthBuffer||!0===ge.has("WEBGL_multisampled_render_to_texture")&&(o.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),s.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const r=xe.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,r=0){q=e,b=t,U=r;let s=!0,o=null,l=!1,c=!1;if(e){const h=xe.get(e);void 0!==h.__useDefaultFramebuffer?(_e.bindFramebuffer(Ve.FRAMEBUFFER,null),s=!1):void 0===h.__webglFramebuffer?Me.setupRenderTarget(e):h.__hasExternalTextures&&Me.rebindTextures(e,xe.get(e.texture).__webglTexture,xe.get(e.depthTexture).__webglTexture);const d=e.texture;(d.isData3DTexture||d.isDataArrayTexture||d.isCompressedArrayTexture)&&(c=!0);const p=xe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(o=Array.isArray(p[t])?p[t][r]:p[t],l=!0):o=e.samples>0&&!1===Me.useMultisampledRTT(e)?xe.get(e).__webglMultisampledFramebuffer:Array.isArray(p)?p[r]:p,Y.copy(e.viewport),K.copy(e.scissor),J=e.scissorTest}else Y.copy(ae).multiplyScalar(ne).floor(),K.copy(oe).multiplyScalar(ne).floor(),J=le;if(_e.bindFramebuffer(Ve.FRAMEBUFFER,o)&&s&&_e.drawBuffers(e,o),_e.viewport(Y),_e.scissor(K),_e.setScissorTest(J),l){const s=xe.get(e.texture);Ve.framebufferTexture2D(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,Ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,s.__webglTexture,r)}else if(c){const s=xe.get(e.texture),o=t||0;Ve.framebufferTextureLayer(Ve.FRAMEBUFFER,Ve.COLOR_ATTACHMENT0,s.__webglTexture,r||0,o)}j=-1},this.readRenderTargetPixels=function(e,t,r,s,l,c,h){if(!e||!e.isWebGLRenderTarget)return void o.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=xe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(d=d[h]),d){_e.bindFramebuffer(Ve.FRAMEBUFFER,d);try{const h=e.texture,d=h.format,p=h.type;if(d!==W&&Oe.convert(d)!==Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_FORMAT))return void o.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const A=p===O&&(ge.has("EXT_color_buffer_half_float")||ge.has("EXT_color_buffer_float"));if(p!==B&&Oe.convert(p)!==Ve.getParameter(Ve.IMPLEMENTATION_COLOR_READ_TYPE)&&p!==Q&&!A)return void o.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-s&&r>=0&&r<=e.height-l&&Ve.readPixels(t,r,s,l,Oe.convert(d),Oe.convert(p),c)}finally{const e=null!==q?xe.get(q).__webglFramebuffer:null;_e.bindFramebuffer(Ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,r=0){const s=Math.pow(2,-r),o=Math.floor(t.image.width*s),l=Math.floor(t.image.height*s);Me.setTexture2D(t,0),Ve.copyTexSubImage2D(Ve.TEXTURE_2D,r,0,0,e.x,e.y,o,l),_e.unbindTexture()},this.copyTextureToTexture=function(e,t,r,s=0){const o=t.image.width,l=t.image.height,c=Oe.convert(r.format),h=Oe.convert(r.type);Me.setTexture2D(r,0),Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,r.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,r.unpackAlignment),t.isDataTexture?Ve.texSubImage2D(Ve.TEXTURE_2D,s,e.x,e.y,o,l,c,h,t.image.data):t.isCompressedTexture?Ve.compressedTexSubImage2D(Ve.TEXTURE_2D,s,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,c,t.mipmaps[0].data):Ve.texSubImage2D(Ve.TEXTURE_2D,s,e.x,e.y,c,h,t.image),0===s&&r.generateMipmaps&&Ve.generateMipmap(Ve.TEXTURE_2D),_e.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,s,l=0){const c=Math.round(e.max.x-e.min.x),h=Math.round(e.max.y-e.min.y),d=e.max.z-e.min.z+1,p=Oe.convert(s.format),A=Oe.convert(s.type);let m;if(s.isData3DTexture)Me.setTexture3D(s,0),m=Ve.TEXTURE_3D;else{if(!s.isDataArrayTexture&&!s.isCompressedArrayTexture)return void o.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Me.setTexture2DArray(s,0),m=Ve.TEXTURE_2D_ARRAY}Ve.pixelStorei(Ve.UNPACK_FLIP_Y_WEBGL,s.flipY),Ve.pixelStorei(Ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),Ve.pixelStorei(Ve.UNPACK_ALIGNMENT,s.unpackAlignment);const g=Ve.getParameter(Ve.UNPACK_ROW_LENGTH),f=Ve.getParameter(Ve.UNPACK_IMAGE_HEIGHT),_=Ve.getParameter(Ve.UNPACK_SKIP_PIXELS),y=Ve.getParameter(Ve.UNPACK_SKIP_ROWS),E=Ve.getParameter(Ve.UNPACK_SKIP_IMAGES),x=r.isCompressedTexture?r.mipmaps[l]:r.image;Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,x.width),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,x.height),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,e.min.x),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,e.min.y),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,e.min.z),r.isDataTexture||r.isData3DTexture?Ve.texSubImage3D(m,l,t.x,t.y,t.z,c,h,d,p,A,x.data):s.isCompressedArrayTexture?Ve.compressedTexSubImage3D(m,l,t.x,t.y,t.z,c,h,d,p,x.data):Ve.texSubImage3D(m,l,t.x,t.y,t.z,c,h,d,p,A,x),Ve.pixelStorei(Ve.UNPACK_ROW_LENGTH,g),Ve.pixelStorei(Ve.UNPACK_IMAGE_HEIGHT,f),Ve.pixelStorei(Ve.UNPACK_SKIP_PIXELS,_),Ve.pixelStorei(Ve.UNPACK_SKIP_ROWS,y),Ve.pixelStorei(Ve.UNPACK_SKIP_IMAGES,E),0===l&&s.generateMipmaps&&Ve.generateMipmap(m),_e.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?Me.setTextureCube(e,0):e.isData3DTexture?Me.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Me.setTexture2DArray(e,0):Me.setTexture2D(e,0),_e.unbindTexture()},this.resetState=function(){b=0,U=0,q=null,_e.reset(),ke.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Be}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ee?"display-p3":"srgb",t.unpackColorSpace=He.workingColorSpace===xe?"display-p3":"srgb"}get useLegacyLights(){return o.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){o.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 Scene extends Object3D{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 Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class three_module_InterleavedBuffer{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=we,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return warnOnce("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,r){e*=this.stride,r*=t.stride;for(let s=0,o=this.stride;s<o;s++)this.array[e+s]=t.array[r+s];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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 Tn=new three_module_Vector3;class three_module_InterleavedBufferAttribute{constructor(e,t,r,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)Tn.fromBufferAttribute(this,t),Tn.applyMatrix4(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Tn.fromBufferAttribute(this,t),Tn.applyNormalMatrix(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Tn.fromBufferAttribute(this,t),Tn.transformDirection(e),this.setXYZ(t,Tn.x,Tn.y,Tn.z);return this}getComponent(e,t){let r=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(r=denormalize(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=normalize(r,this.array)),this.data.array[e*this.data.stride+this.offset+t]=r,this}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=normalize(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=denormalize(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=denormalize(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=denormalize(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=denormalize(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),s=normalize(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=s,this}setXYZW(e,t,r,s,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),s=normalize(s,this.array),o=normalize(o,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=s,this.data.array[e+3]=o,this}clone(e){if(void 0===e){o.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return new three_module_BufferAttribute(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new three_module_InterleavedBufferAttribute(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){o.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(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 Bn=new three_module_Vector3,Rn=new Vector4,Ln=new Vector4,Dn=new three_module_Vector3,Un=new three_module_Matrix4,Pn=new three_module_Vector3,Fn=new Sphere,Nn=new three_module_Matrix4,Qn=new Ray;class SkinnedMesh extends three_module_Mesh{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=h,this.bindMatrix=new three_module_Matrix4,this.bindMatrixInverse=new three_module_Matrix4,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Pn),this.boundingBox.expandByPoint(Pn)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Pn),this.boundingSphere.expandByPoint(Pn)}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,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const r=this.material,s=this.matrixWorld;void 0!==r&&(null===this.boundingSphere&&this.computeBoundingSphere(),Fn.copy(this.boundingSphere),Fn.applyMatrix4(s),!1!==e.ray.intersectsSphere(Fn)&&(Nn.copy(s).invert(),Qn.copy(e.ray).applyMatrix4(Nn),null!==this.boundingBox&&!1===Qn.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,Qn)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(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 Vector4,t=this.geometry.attributes.skinWeight;for(let r=0,s=t.count;r<s;r++){e.fromBufferAttribute(t,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===h?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():o.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const r=this.skeleton,s=this.geometry;Rn.fromBufferAttribute(s.attributes.skinIndex,e),Ln.fromBufferAttribute(s.attributes.skinWeight,e),Bn.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const s=Ln.getComponent(e);if(0!==s){const o=Rn.getComponent(e);Un.multiplyMatrices(r.bones[o].matrixWorld,r.boneInverses[o]),t.addScaledVector(Dn.copy(Bn).applyMatrix4(Un),s)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(e=null,t=1,r=1,s,o,l,c,h,d=x,p=x,A,m){super(null,l,c,h,d,p,s,o,A,m),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const On=new three_module_Matrix4,kn=new three_module_Matrix4;class Skeleton{constructor(e=[],t=[]){this.uuid=generateUUID(),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(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){o.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new three_module_Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new three_module_Matrix4;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,r=this.boneMatrices,s=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const o=e[s]?e[s].matrixWorld:kn;On.multiplyMatrices(o,t[s]),On.toArray(r,16*s)}null!==s&&(s.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const r=new DataTexture(t,e,e,W,Q);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,s=e.bones.length;r<s;r++){const s=e.bones[r];let l=t[s];void 0===l&&(o.warn("THREE.Skeleton: No bone found with UUID:",s),l=new Bone),this.bones.push(l),this.boneInverses.push((new three_module_Matrix4).fromArray(e.boneInverses[r]))}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,r=this.boneInverses;for(let s=0,o=t.length;s<o;s++){const o=t[s];e.bones.push(o.uuid);const l=r[s];e.boneInverses.push(l.toArray())}return e}}class three_module_InstancedBufferAttribute extends three_module_BufferAttribute{constructor(e,t,r,s=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}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 Gn=new three_module_Matrix4,Vn=new three_module_Matrix4,Hn=[],zn=new Box3,Wn=new three_module_Matrix4,qn=new three_module_Mesh,jn=new Sphere;class InstancedMesh extends three_module_Mesh{constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new three_module_InstancedBufferAttribute(new Float32Array(16*r),16),this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<r;e++)this.setMatrixAt(e,Wn)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Box3),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<t;r++)this.getMatrixAt(r,Gn),zn.copy(e.boundingBox).applyMatrix4(Gn),this.boundingBox.union(zn)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Sphere),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<t;r++)this.getMatrixAt(r,Gn),jn.copy(e.boundingSphere).applyMatrix4(Gn),this.boundingSphere.union(jn)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const r=t.morphTargetInfluences,s=this.morphTexture.source.data.data,o=e*(r.length+1)+1;for(let e=0;e<r.length;e++)r[e]=s[o+e]}raycast(e,t){const r=this.matrixWorld,s=this.count;if(qn.geometry=this.geometry,qn.material=this.material,void 0!==qn.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),jn.copy(this.boundingSphere),jn.applyMatrix4(r),!1!==e.ray.intersectsSphere(jn)))for(let o=0;o<s;o++){this.getMatrixAt(o,Gn),Vn.multiplyMatrices(r,Gn),qn.matrixWorld=Vn,qn.raycast(e,Hn);for(let e=0,r=Hn.length;e<r;e++){const r=Hn[e];r.instanceId=o,r.object=this,t.push(r)}Hn.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new three_module_InstancedBufferAttribute(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const r=t.morphTargetInfluences,s=r.length+1;null===this.morphTexture&&(this.morphTexture=new DataTexture(new Float32Array(s*this.count),s,this.count,X,Q));const o=this.morphTexture.source.data.data;let l=0;for(let e=0;e<r.length;e++)l+=r[e];const c=this.geometry.morphTargetsRelative?1:1-l,h=s*e;o[h]=c,o.set(r,h+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class LineBasicMaterial extends Material{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(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 Xn=new three_module_Vector3,Yn=new three_module_Vector3,Kn=new three_module_Matrix4,Jn=new Ray,$n=new Sphere;class Line extends Object3D{constructor(e=new three_module_BufferGeometry,t=new LineBasicMaterial){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(null===e.index){const t=e.attributes.position,r=[0];for(let e=1,s=t.count;e<s;e++)Xn.fromBufferAttribute(t,e-1),Yn.fromBufferAttribute(t,e),r[e]=r[e-1],r[e]+=Xn.distanceTo(Yn);e.setAttribute("lineDistance",new three_module_Float32BufferAttribute(r,1))}else o.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,s=this.matrixWorld,o=e.params.Line.threshold,l=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),$n.copy(r.boundingSphere),$n.applyMatrix4(s),$n.radius+=o,!1===e.ray.intersectsSphere($n))return;Kn.copy(s).invert(),Jn.copy(e.ray).applyMatrix4(Kn);const c=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,d=new three_module_Vector3,p=new three_module_Vector3,A=new three_module_Vector3,m=new three_module_Vector3,g=this.isLineSegments?2:1,f=r.index,_=r.attributes.position;if(null!==f){for(let r=Math.max(0,l.start),s=Math.min(f.count,l.start+l.count)-1;r<s;r+=g){const s=f.getX(r),o=f.getX(r+1);d.fromBufferAttribute(_,s),p.fromBufferAttribute(_,o);if(Jn.distanceSqToSegment(d,p,m,A)>h)continue;m.applyMatrix4(this.matrixWorld);const l=e.ray.origin.distanceTo(m);l<e.near||l>e.far||t.push({distance:l,point:A.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else{for(let r=Math.max(0,l.start),s=Math.min(_.count,l.start+l.count)-1;r<s;r+=g){d.fromBufferAttribute(_,r),p.fromBufferAttribute(_,r+1);if(Jn.distanceSqToSegment(d,p,m,A)>h)continue;m.applyMatrix4(this.matrixWorld);const s=e.ray.origin.distanceTo(m);s<e.near||s>e.far||t.push({distance:s,point:A.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){const t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}const Zn=new three_module_Vector3,er=new three_module_Vector3;class LineSegments extends Line{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,r=[];for(let e=0,s=t.count;e<s;e+=2)Zn.fromBufferAttribute(t,e),er.fromBufferAttribute(t,e+1),r[e]=0===e?0:r[e-1],r[e+1]=r[e]+Zn.distanceTo(er);e.setAttribute("lineDistance",new three_module_Float32BufferAttribute(r,1))}else o.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color(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 tr=new three_module_Matrix4,ir=new Ray,nr=new Sphere,rr=new three_module_Vector3;class Points extends Object3D{constructor(e=new three_module_BufferGeometry,t=new PointsMaterial){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 r=this.geometry,s=this.matrixWorld,o=e.params.Points.threshold,l=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),nr.copy(r.boundingSphere),nr.applyMatrix4(s),nr.radius+=o,!1===e.ray.intersectsSphere(nr))return;tr.copy(s).invert(),ir.copy(e.ray).applyMatrix4(tr);const c=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,d=r.index,p=r.attributes.position;if(null!==d){for(let r=Math.max(0,l.start),o=Math.min(d.count,l.start+l.count);r<o;r++){const o=d.getX(r);rr.fromBufferAttribute(p,o),testPoint(rr,o,h,s,e,t,this)}}else{for(let r=Math.max(0,l.start),o=Math.min(p.count,l.start+l.count);r<o;r++)rr.fromBufferAttribute(p,r),testPoint(rr,r,h,s,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){const t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function testPoint(e,t,r,s,o,l,c){const h=ir.distanceSqToPoint(e);if(h<r){const r=new three_module_Vector3;ir.closestPointToPoint(e,r),r.applyMatrix4(s);const d=o.ray.origin.distanceTo(r);if(d<o.near||d>o.far)return;l.push({distance:d,distanceToRay:Math.sqrt(h),point:r,index:t,face:null,object:c})}}class VideoTexture extends Texture{constructor(e,t,r,s,o,l,c,h,d){super(e,t,r,s,o,l,c,h,d),this.isVideoTexture=!0,this.minFilter=void 0!==l?l:I,this.magFilter=void 0!==o?o:I,this.generateMipmaps=!1;const p=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function updateVideo(){p.needsUpdate=!0,e.requestVideoFrameCallback(updateVideo)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class CompressedTexture extends Texture{constructor(e,t,r,s,o,l,c,h,d,p,A,m){super(null,l,c,h,d,p,s,o,A,m),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(e,t,r,s,o,l){super(e,t,r,o,l),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=y}}class CompressedCubeTexture extends CompressedTexture{constructor(e,t,r){super(void 0,e[0].width,e[0].height,t,r,p),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class CanvasTexture extends Texture{constructor(e,t,r,s,o,l,c,h,d){super(e,t,r,s,o,l,c,h,d),this.isCanvasTexture=!0,this.needsUpdate=!0}}class SphereGeometry extends three_module_BufferGeometry{constructor(e=1,t=32,r=16,s=0,o=2*Math.PI,l=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:s,phiLength:o,thetaStart:l,thetaLength:c},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));const h=Math.min(l+c,Math.PI);let d=0;const p=[],A=new three_module_Vector3,m=new three_module_Vector3,g=[],f=[],_=[],y=[];for(let g=0;g<=r;g++){const E=[],x=g/r;let C=0;0===g&&0===l?C=.5/t:g===r&&h===Math.PI&&(C=-.5/t);for(let r=0;r<=t;r++){const h=r/t;A.x=-e*Math.cos(s+h*o)*Math.sin(l+x*c),A.y=e*Math.cos(l+x*c),A.z=e*Math.sin(s+h*o)*Math.sin(l+x*c),f.push(A.x,A.y,A.z),m.copy(A).normalize(),_.push(m.x,m.y,m.z),y.push(h+C,1-x),E.push(d++)}p.push(E)}for(let e=0;e<r;e++)for(let s=0;s<t;s++){const t=p[e][s+1],o=p[e][s],c=p[e+1][s],d=p[e+1][s+1];(0!==e||l>0)&&g.push(t,o,d),(e!==r-1||h<Math.PI)&&g.push(o,c,d)}this.setIndex(g),this.setAttribute("position",new three_module_Float32BufferAttribute(f,3)),this.setAttribute("normal",new three_module_Float32BufferAttribute(_,3)),this.setAttribute("uv",new three_module_Float32BufferAttribute(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class MeshStandardMaterial extends Material{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(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 Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Vector2(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 Euler,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 MeshPhysicalMaterial extends MeshStandardMaterial{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 Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color(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 Color(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color(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 convertArray(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function getKeyframeOrder(e){const t=e.length,r=new Array(t);for(let e=0;e!==t;++e)r[e]=e;return r.sort((function compareTime(t,r){return e[t]-e[r]})),r}function sortedArray(e,t,r){const s=e.length,o=new e.constructor(s);for(let l=0,c=0;c!==s;++l){const s=r[l]*t;for(let r=0;r!==t;++r)o[c++]=e[s+r]}return o}function flattenJSON(e,t,r,s){let o=1,l=e[0];for(;void 0!==l&&void 0===l[s];)l=e[o++];if(void 0===l)return;let c=l[s];if(void 0!==c)if(Array.isArray(c))do{c=l[s],void 0!==c&&(t.push(l.time),r.push.apply(r,c)),l=e[o++]}while(void 0!==l);else if(void 0!==c.toArray)do{c=l[s],void 0!==c&&(t.push(l.time),c.toArray(r,r.length)),l=e[o++]}while(void 0!==l);else do{c=l[s],void 0!==c&&(t.push(l.time),r.push(c)),l=e[o++]}while(void 0!==l)}class Interpolant{constructor(e,t,r,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==s?s:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,s=t[r],o=t[r-1];e:{t:{let l;i:{n:if(!(e<s)){for(let l=r+2;;){if(void 0===s){if(e<o)break n;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===l)break;if(o=s,s=t[++r],e<s)break t}l=t.length;break i}if(e>=o)break e;{const c=t[1];e<c&&(r=2,o=c);for(let l=r-2;;){if(void 0===o)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(s=o,o=t[--r-1],e>=o)break t}l=r,r=0}}for(;r<l;){const s=r+l>>>1;e<t[s]?l=s:r=s+1}if(s=t[r],o=t[r-1],void 0===o)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===s)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,o,s)}return this.interpolate_(r,o,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s;for(let e=0;e!==s;++e)t[e]=r[o+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ae,endingEnd:Ae}}intervalChanged_(e,t,r){const s=this.parameterPositions;let o=e-2,l=e+1,c=s[o],h=s[l];if(void 0===c)switch(this.getSettings_().endingStart){case me:o=e,c=2*t-r;break;case ge:o=s.length-2,c=t+s[o]-s[o+1];break;default:o=e,c=r}if(void 0===h)switch(this.getSettings_().endingEnd){case me:l=e,h=2*r-t;break;case ge:l=1,h=r+s[1]-s[0];break;default:l=e-1,h=t}const d=.5*(r-t),p=this.valueSize;this._weightPrev=d/(t-c),this._weightNext=d/(h-r),this._offsetPrev=o*p,this._offsetNext=l*p}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,d=h-c,p=this._offsetPrev,A=this._offsetNext,m=this._weightPrev,g=this._weightNext,f=(r-t)/(s-t),_=f*f,y=_*f,E=-m*y+2*m*_-m*f,x=(1+m)*y+(-1.5-2*m)*_+(-.5+m)*f+1,C=(-1-g)*y+(1.5+g)*_+.5*f,S=g*y-g*_;for(let e=0;e!==c;++e)o[e]=E*l[p+e]+x*l[d+e]+C*l[h+e]+S*l[A+e];return o}}class LinearInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,d=h-c,p=(r-t)/(s-t),A=1-p;for(let e=0;e!==c;++e)o[e]=l[d+e]*A+l[h+e]*p;return o}}class DiscreteInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class KeyframeTrack{constructor(e,t,r,s){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=convertArray(t,this.TimeBufferType),this.values=convertArray(r,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:convertArray(e.times,Array),values:convertArray(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(r.interpolation=t)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ue:t=this.InterpolantFactoryMethodDiscrete;break;case de:t=this.InterpolantFactoryMethodLinear;break;case pe:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return o.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ue;case this.InterpolantFactoryMethodLinear:return de;case this.InterpolantFactoryMethodSmooth:return pe}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let r=0,s=t.length;r!==s;++r)t[r]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let r=0,s=t.length;r!==s;++r)t[r]*=e}return this}trim(e,t){const r=this.times,s=r.length;let o=0,l=s-1;for(;o!==s&&r[o]<e;)++o;for(;-1!==l&&r[l]>t;)--l;if(++l,0!==o||l!==s){o>=l&&(l=Math.max(l,1),o=l-1);const e=this.getValueSize();this.times=r.slice(o,l),this.values=this.values.slice(o*e,l*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(o.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,s=this.values,l=r.length;0===l&&(o.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let c=null;for(let t=0;t!==l;t++){const s=r[t];if("number"==typeof s&&isNaN(s)){o.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,s),e=!1;break}if(null!==c&&c>s){o.error("THREE.KeyframeTrack: Out of order keys.",this,t,s,c),e=!1;break}c=s}if(void 0!==s&&isTypedArray(s))for(let t=0,r=s.length;t!==r;++t){const r=s[t];if(isNaN(r)){o.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,r),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),s=this.getInterpolation()===pe,o=e.length-1;let l=1;for(let c=1;c<o;++c){let o=!1;const h=e[c];if(h!==e[c+1]&&(1!==c||h!==e[0]))if(s)o=!0;else{const e=c*r,s=e-r,l=e+r;for(let c=0;c!==r;++c){const r=t[e+c];if(r!==t[s+c]||r!==t[l+c]){o=!0;break}}}if(o){if(c!==l){e[l]=e[c];const s=c*r,o=l*r;for(let e=0;e!==r;++e)t[o+e]=t[s+e]}++l}}if(o>0){e[l]=e[o];for(let e=o*r,s=l*r,c=0;c!==r;++c)t[s+c]=t[e+c];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=new(0,this.constructor)(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=de;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=ue,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(r-t)/(s-t);let d=e*c;for(let e=d+c;d!==e;d+=4)three_module_Quaternion.slerpFlat(o,0,l,d-c,l,d,h);return o}}class three_module_QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}}three_module_QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",three_module_QuaternionKeyframeTrack.prototype.DefaultInterpolation=de,three_module_QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=ue,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class three_module_VectorKeyframeTrack extends KeyframeTrack{}three_module_VectorKeyframeTrack.prototype.ValueTypeName="vector";class three_module_AnimationClip{constructor(e="",t=-1,r=[],s=2500){this.name=e,this.tracks=r,this.duration=t,this.blendMode=s,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,s=1/(e.fps||1);for(let e=0,o=r.length;e!==o;++e)t.push(parseKeyframeTrack(r[e]).scale(s));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){const t=[],r=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,s=r.length;e!==s;++e)t.push(KeyframeTrack.toJSON(r[e]));return s}static CreateFromMorphTargetSequence(e,t,r,s){const o=t.length,l=[];for(let e=0;e<o;e++){let c=[],h=[];c.push((e+o-1)%o,e,(e+1)%o),h.push(0,1,0);const d=getKeyframeOrder(c);c=sortedArray(c,1,d),h=sortedArray(h,1,d),s||0!==c[0]||(c.push(o),h.push(h[0])),l.push(new NumberKeyframeTrack(".morphTargetInfluences["+t[e].name+"]",c,h).scale(1/r))}return new this(e,-1,l)}static findByName(e,t){let r=e;if(!Array.isArray(e)){const t=e;r=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<r.length;e++)if(r[e].name===t)return r[e];return null}static CreateClipsFromMorphTargetSequences(e,t,r){const s={},o=/^([\w-]*?)([\d]+)$/;for(let t=0,r=e.length;t<r;t++){const r=e[t],l=r.name.match(o);if(l&&l.length>1){const e=l[1];let t=s[e];t||(s[e]=t=[]),t.push(r)}}const l=[];for(const e in s)l.push(this.CreateFromMorphTargetSequence(e,s[e],t,r));return l}static parseAnimation(e,t){if(!e)return o.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const addNonemptyTrack=function(e,t,r,s,o){if(0!==r.length){const l=[],c=[];flattenJSON(r,l,c,s),0!==l.length&&o.push(new e(t,l,c))}},r=[],s=e.name||"default",l=e.fps||30,c=e.blendMode;let h=e.length||-1;const d=e.hierarchy||[];for(let e=0;e<d.length;e++){const s=d[e].keys;if(s&&0!==s.length)if(s[0].morphTargets){const e={};let t;for(t=0;t<s.length;t++)if(s[t].morphTargets)for(let r=0;r<s[t].morphTargets.length;r++)e[s[t].morphTargets[r]]=-1;for(const o in e){const e=[],l=[];for(let r=0;r!==s[t].morphTargets.length;++r){const r=s[t];e.push(r.time),l.push(r.morphTarget===o?1:0)}r.push(new NumberKeyframeTrack(".morphTargetInfluence["+o+"]",e,l))}h=e.length*l}else{const o=".bones["+t[e].name+"]";addNonemptyTrack(three_module_VectorKeyframeTrack,o+".position",s,"pos",r),addNonemptyTrack(three_module_QuaternionKeyframeTrack,o+".quaternion",s,"rot",r),addNonemptyTrack(three_module_VectorKeyframeTrack,o+".scale",s,"scl",r)}}if(0===r.length)return null;return new this(s,h,r,c)}resetDuration(){let e=0;for(let t=0,r=this.tracks.length;t!==r;++t){const r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,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 parseKeyframeTrack(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function getTrackTypeForValueTypeName(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return three_module_VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return three_module_QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],r=[];flattenJSON(e.keys,t,r,"value"),e.times=t,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const sr={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class LoadingManager{constructor(e,t,r){const s=this;let o,l=!1,c=0,h=0;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){h++,!1===l&&void 0!==s.onStart&&s.onStart(e,c,h),l=!0},this.itemEnd=function(e){c++,void 0!==s.onProgress&&s.onProgress(e,c,h),c===h&&(l=!1,void 0!==s.onLoad&&s.onLoad())},this.itemError=function(e){void 0!==s.onError&&s.onError(e)},this.resolveURL=function(e){return o?o(e):e},this.setURLModifier=function(e){return o=e,this},this.addHandler=function(e,t){return d.push(e,t),this},this.removeHandler=function(e){const t=d.indexOf(e);return-1!==t&&d.splice(t,2),this},this.getHandler=function(e){for(let t=0,r=d.length;t<r;t+=2){const r=d[t],s=d[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return s}return null}}}const ar=new LoadingManager;class Loader{constructor(e){this.manager=void 0!==e?e:ar,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const r=this;return new Promise((function(s,o){r.load(e,s,t,o)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";const or={};class HttpError extends Error{constructor(e,t){super(e),this.response=t}}class three_module_FileLoader extends Loader{constructor(e){super(e)}load(e,t,r,s){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const l=sr.get(e);if(void 0!==l)return this.manager.itemStart(e),setTimeout((()=>{t&&t(l),this.manager.itemEnd(e)}),0),l;if(void 0!==or[e])return void or[e].push({onLoad:t,onProgress:r,onError:s});or[e]=[],or[e].push({onLoad:t,onProgress:r,onError:s});const c=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),h=this.mimeType,d=this.responseType;fetch(c).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&o.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const r=or[e],s=t.body.getReader(),l=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),c=l?parseInt(l):0,h=0!==c;let d=0;const p=new ReadableStream({start(e){!function readData(){s.read().then((({done:t,value:s})=>{if(t)e.close();else{d+=s.byteLength;const t=new ProgressEvent("progress",{lengthComputable:h,loaded:d,total:c});for(let e=0,s=r.length;e<s;e++){const s=r[e];s.onProgress&&s.onProgress(t)}e.enqueue(s),readData()}}))}()}});return new Response(p)}throw new HttpError(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(d){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,h)));case"json":return e.json();default:if(void 0===h)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(h),r=t&&t[1]?t[1].toLowerCase():void 0,s=new TextDecoder(r);return e.arrayBuffer().then((e=>s.decode(e)))}}})).then((t=>{sr.add(e,t);const r=or[e];delete or[e];for(let e=0,s=r.length;e<s;e++){const s=r[e];s.onLoad&&s.onLoad(t)}})).catch((t=>{const r=or[e];if(void 0===r)throw this.manager.itemError(e),t;delete or[e];for(let e=0,s=r.length;e<s;e++){const s=r[e];s.onError&&s.onError(t)}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 ImageLoader extends Loader{constructor(e){super(e)}load(e,t,r,s){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=sr.get(e);if(void 0!==l)return o.manager.itemStart(e),setTimeout((function(){t&&t(l),o.manager.itemEnd(e)}),0),l;const c=createElementNS("img");function onImageLoad(){removeEventListeners(),sr.add(e,this),t&&t(this),o.manager.itemEnd(e)}function onImageError(t){removeEventListeners(),s&&s(t),o.manager.itemError(e),o.manager.itemEnd(e)}function removeEventListeners(){c.removeEventListener("load",onImageLoad,!1),c.removeEventListener("error",onImageError,!1)}return c.addEventListener("load",onImageLoad,!1),c.addEventListener("error",onImageError,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(c.crossOrigin=this.crossOrigin),o.manager.itemStart(e),c.src=e,c}}class DataTextureLoader extends Loader{constructor(e){super(e)}load(e,t,r,s){const l=this,c=new DataTexture,h=new three_module_FileLoader(this.manager);return h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setPath(this.path),h.setWithCredentials(l.withCredentials),h.load(e,(function(e){let r;try{r=l.parse(e)}catch(e){if(void 0===s)return void o.error(e);s(e)}void 0!==r.image?c.image=r.image:void 0!==r.data&&(c.image.width=r.width,c.image.height=r.height,c.image.data=r.data),c.wrapS=void 0!==r.wrapS?r.wrapS:y,c.wrapT=void 0!==r.wrapT?r.wrapT:y,c.magFilter=void 0!==r.magFilter?r.magFilter:I,c.minFilter=void 0!==r.minFilter?r.minFilter:I,c.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.colorSpace&&(c.colorSpace=r.colorSpace),void 0!==r.flipY&&(c.flipY=r.flipY),void 0!==r.format&&(c.format=r.format),void 0!==r.type&&(c.type=r.type),void 0!==r.mipmaps&&(c.mipmaps=r.mipmaps,c.minFilter=T),1===r.mipmapCount&&(c.minFilter=I),void 0!==r.generateMipmaps&&(c.generateMipmaps=r.generateMipmaps),c.needsUpdate=!0,t&&t(c,r)}),r,s),c}}class TextureLoader extends Loader{constructor(e){super(e)}load(e,t,r,s){const o=new Texture,l=new ImageLoader(this.manager);return l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,(function(e){o.image=e,o.needsUpdate=!0,void 0!==t&&t(o)}),r,s),o}}class Light extends Object3D{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Color(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,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}const lr=new three_module_Matrix4,cr=new three_module_Vector3,hr=new three_module_Vector3;class LightShadow{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new three_module_Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;cr.setFromMatrixPosition(e.matrixWorld),t.position.copy(cr),hr.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(hr),t.updateMatrixWorld(),lr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lr),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(lr)}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 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=2*Pe*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;r===t.fov&&s===t.aspect&&o===t.far||(t.fov=r,t.aspect=s,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class SpotLight extends Light{constructor(e,t,r=0,s=Math.PI/3,o=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=r,this.angle=s,this.penumbra=o,this.decay=l,this.map=null,this.shadow=new SpotLightShadow}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 ur=new three_module_Matrix4,dr=new three_module_Vector3,pr=new three_module_Vector3;class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new three_module_Vector3(1,0,0),new three_module_Vector3(-1,0,0),new three_module_Vector3(0,0,1),new three_module_Vector3(0,0,-1),new three_module_Vector3(0,1,0),new three_module_Vector3(0,-1,0)],this._cubeUps=[new three_module_Vector3(0,1,0),new three_module_Vector3(0,1,0),new three_module_Vector3(0,1,0),new three_module_Vector3(0,1,0),new three_module_Vector3(0,0,1),new three_module_Vector3(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,s=this.matrix,o=e.distance||r.far;o!==r.far&&(r.far=o,r.updateProjectionMatrix()),dr.setFromMatrixPosition(e.matrixWorld),r.position.copy(dr),pr.copy(r.position),pr.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(pr),r.updateMatrixWorld(),s.makeTranslation(-dr.x,-dr.y,-dr.z),ur.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ur)}}class PointLight extends Light{constructor(e,t,r=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=s,this.shadow=new PointLightShadow}get power(){return 4*this.intensity*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 DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DirectionalLight extends Light{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new three_module_Vector3)}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 r=e.x,s=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*s),t.addScaledVector(l[2],.488603*o),t.addScaledVector(l[3],.488603*r),t.addScaledVector(l[4],r*s*1.092548),t.addScaledVector(l[5],s*o*1.092548),t.addScaledVector(l[6],.315392*(3*o*o-1)),t.addScaledVector(l[7],r*o*1.092548),t.addScaledVector(l[8],.546274*(r*r-s*s)),t}getIrradianceAt(e,t){const r=e.x,s=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],1.023328*s),t.addScaledVector(l[2],1.023328*o),t.addScaledVector(l[3],1.023328*r),t.addScaledVector(l[4],.858086*r*s),t.addScaledVector(l[5],.858086*s*o),t.addScaledVector(l[6],.743125*o*o-.247708),t.addScaledVector(l[7],.858086*r*o),t.addScaledVector(l[8],.429043*(r*r-s*s)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],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 r=this.coefficients;for(let s=0;s<9;s++)r[s].fromArray(e,t+3*s);return this}toArray(e=[],t=0){const r=this.coefficients;for(let s=0;s<9;s++)r[s].toArray(e,t+3*s);return e}static getBasisAt(e,t){const r=e.x,s=e.y,o=e.z;t[0]=.282095,t[1]=.488603*s,t[2]=.488603*o,t[3]=.488603*r,t[4]=1.092548*r*s,t[5]=1.092548*s*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*r*o,t[8]=.546274*(r*r-s*s)}}class LightProbe extends Light{constructor(e=new SphericalHarmonics3,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 LoaderUtils{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let r=0,s=e.length;r<s;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===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 ImageBitmapLoader extends Loader{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&o.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&o.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,s){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=sr.get(e);if(void 0!==l)return o.manager.itemStart(e),l.then?void l.then((r=>{t&&t(r),o.manager.itemEnd(e)})).catch((e=>{s&&s(e)})):(setTimeout((function(){t&&t(l),o.manager.itemEnd(e)}),0),l);const c={};c.credentials="anonymous"===this.crossOrigin?"same-origin":"include",c.headers=this.requestHeader;const h=fetch(e,c).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(o.options,{colorSpaceConversion:"none"}))})).then((function(r){return sr.add(e,r),t&&t(r),o.manager.itemEnd(e),r})).catch((function(t){s&&s(t),sr.remove(e),o.manager.itemError(e),o.manager.itemEnd(e)}));sr.add(e,h),o.manager.itemStart(e)}}class PropertyMixer{constructor(e,t,r){let s,o,l;switch(this.binding=e,this.valueSize=r,t){case"quaternion":s=this._slerp,o=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":s=this._select,o=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:s=this._lerp,o=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=o,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,s=this.valueSize,o=e*s+s;let l=this.cumulativeWeight;if(0===l){for(let e=0;e!==s;++e)r[o+e]=r[e];l=t}else{l+=t;const e=t/l;this._mixBufferRegion(r,o,0,e,s)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,s=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,s=e*t+t,o=this.cumulativeWeight,l=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){const e=t*this._origIndex;this._mixBufferRegion(r,s,e,1-o,t)}l>0&&this._mixBufferRegionAdditive(r,s,this._addIndex*t,1,t);for(let e=t,o=t+t;e!==o;++e)if(r[e]!==r[e+t]){c.setValue(r,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,s=r*this._origIndex;e.getValue(t,s);for(let e=r,o=s;e!==o;++e)t[e]=t[s+e%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=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 r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,s,o){if(s>=.5)for(let s=0;s!==o;++s)e[t+s]=e[r+s]}_slerp(e,t,r,s){three_module_Quaternion.slerpFlat(e,t,e,t,e,r,s)}_slerpAdditive(e,t,r,s,o){const l=this._workIndex*o;three_module_Quaternion.multiplyQuaternionsFlat(e,l,e,t,e,r),three_module_Quaternion.slerpFlat(e,t,e,t,e,l,s)}_lerp(e,t,r,s,o){const l=1-s;for(let c=0;c!==o;++c){const o=t+c;e[o]=e[o]*l+e[r+c]*s}}_lerpAdditive(e,t,r,s,o){for(let l=0;l!==o;++l){const o=t+l;e[o]=e[o]+e[r+l]*s}}}const Ar="\\[\\]\\.:\\/",mr=new RegExp("[\\[\\]\\.:\\/]","g"),gr="[^\\[\\]\\.:\\/]",fr="[^"+Ar.replace("\\.","")+"]",_r=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",gr)+/(WCOD+)?/.source.replace("WCOD",fr)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",gr)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",gr)+"$"),vr=["material","materials","bones","map"];class PropertyBinding{constructor(e,t,r){this.path=t,this.parsedPath=r||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,r):new PropertyBinding(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mr,"")}static parseTrackName(e){const t=_r.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){const e=r.nodeName.substring(s+1);-1!==vr.indexOf(e)&&(r.nodeName=r.nodeName.substring(0,s),r.objectName=e)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){const searchNodeSubtree=function(e){for(let r=0;r<e.length;r++){const s=e[r];if(s.name===t||s.uuid===t)return s;const o=searchNodeSubtree(s.children);if(o)return o}return null},r=searchNodeSubtree(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const r=this.resolvedProperty;for(let s=0,o=r.length;s!==o;++s)e[t++]=r[s]}_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 r=this.resolvedProperty;for(let s=0,o=r.length;s!==o;++s)r[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const r=this.resolvedProperty;for(let s=0,o=r.length;s!==o;++s)r[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const r=this.resolvedProperty;for(let s=0,o=r.length;s!==o;++s)r[s]=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,r=t.objectName,s=t.propertyName;let l=t.propertyIndex;if(e||(e=PropertyBinding.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void o.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(r){let s=t.objectIndex;switch(r){case"materials":if(!e.material)return void o.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void o.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void o.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===s){s=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void o.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void o.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[r])return void o.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==s){if(void 0===e[s])return void o.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[s]}}const c=e[s];if(void 0===c){const r=t.nodeName;return void o.error("THREE.PropertyBinding: Trying to update property for track: "+r+"."+s+" but it wasn't found.",e)}let h=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?h=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(void 0!==l){if("morphTargetInfluences"===s){if(!e.geometry)return void o.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void o.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[l]&&(l=e.morphTargetDictionary[l])}d=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=l}else void 0!==c.fromArray&&void 0!==c.toArray?(d=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(d=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=s;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=class Composite{constructor(e,t,r){const s=r||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,s=this._bindings[r];void 0!==s&&s.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let s=this._targetGroup.nCachedObjects_,o=r.length;s!==o;++s)r[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AnimationAction{constructor(e,t,r=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=s;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:Ae,endingEnd:Ae};for(let e=0;e!==l;++e){const t=o[e].createInterpolant(null);c[e]=t,t.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ce,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&&0!==this.timeScale&&null===this._startTime&&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,r){if(e.fadeOut(t),this.fadeIn(t),r){const r=this._clip.duration,s=e._clip.duration,o=s/r,l=r/s;e.warp(1,o,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return null!==e&&(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,r){const s=this._mixer,o=s.time,l=this.timeScale;let c=this._timeScaleInterpolant;null===c&&(c=s._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,d=c.sampleValues;return h[0]=o,h[1]=o+r,d[0]=e/l,d[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(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,r,s){if(!this.enabled)return void this._updateWeight(e);const o=this._startTime;if(null!==o){const s=(e-o)*r;s<0||0===r?t=0:(this._startTime=null,t=r*s)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let r=0,s=e.length;r!==s;++r)e[r].evaluate(l),t[r].accumulateAdditive(c);else for(let r=0,o=e.length;r!==o;++r)e[r].evaluate(l),t[r].accumulate(s,c)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(null!==r){const s=r.evaluate(e)[0];t*=s,e>r.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(null!==r){t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let s=this.time+e,o=this._loopCount;const l=r===he;if(0===e)return-1===o?s:l&&1==(1&o)?t-s:s;if(2200===r){-1===o&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else{if(!(s<0)){this.time=s;break e}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===o&&(e>=0?(o=0,this._setEndings(!0,0===this.repetitions,l)):this._setEndings(0===this.repetitions,!0,l)),s>=t||s<0){const r=Math.floor(s/t);s-=t*r,o+=Math.abs(r);const c=this.repetitions-o;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===c){const t=e<0;this._setEndings(t,!t,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})}}else this.time=s;if(l&&1==(1&o))return t-s}return s}_setEndings(e,t,r){const s=this._interpolantSettings;r?(s.endingStart=me,s.endingEnd=me):(s.endingStart=e?this.zeroSlopeAtStart?me:Ae:ge,s.endingEnd=t?this.zeroSlopeAtEnd?me:Ae:ge)}_scheduleFading(e,t,r){const s=this._mixer,o=s.time;let l=this._weightInterpolant;null===l&&(l=s._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=r,this}}const yr=new Float32Array(1);class three_module_AnimationMixer extends EventDispatcher{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,s=e._clip.tracks,o=s.length,l=e._propertyBindings,c=e._interpolants,h=r.uuid,d=this._bindingsByRootAndName;let p=d[h];void 0===p&&(p={},d[h]=p);for(let e=0;e!==o;++e){const o=s[e],d=o.name;let A=p[d];if(void 0!==A)++A.referenceCount,l[e]=A;else{if(A=l[e],void 0!==A){null===A._cacheIndex&&(++A.referenceCount,this._addInactiveBinding(A,h,d));continue}const s=t&&t._propertyBindings[e].binding.parsedPath;A=new PropertyMixer(PropertyBinding.create(r,d,s),o.ValueTypeName,o.getValueSize()),++A.referenceCount,this._addInactiveBinding(A,h,d),l[e]=A}c[e].resultBuffer=A.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,t)}const t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){const r=t[e];0==r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){const r=t[e];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}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 null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,r){const s=this._actions,o=this._actionsByClip;let l=o[t];if(void 0===l)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=l;else{const t=l.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=s.length,s.push(e),l.actionByRoot[r]=e}_removeInactiveAction(e){const t=this._actions,r=t[t.length-1],s=e._cacheIndex;r._cacheIndex=s,t[s]=r,t.pop(),e._cacheIndex=null;const o=e._clip.uuid,l=this._actionsByClip,c=l[o],h=c.knownActions,d=h[h.length-1],p=e._byClipCacheIndex;d._byClipCacheIndex=p,h[p]=d,h.pop(),e._byClipCacheIndex=null;delete c.actionByRoot[(e._localRoot||this._root).uuid],0===h.length&&delete l[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){const r=t[e];0==--r.referenceCount&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,r=e._cacheIndex,s=this._nActiveActions++,o=t[s];e._cacheIndex=s,t[s]=e,o._cacheIndex=r,t[r]=o}_takeBackAction(e){const t=this._actions,r=e._cacheIndex,s=--this._nActiveActions,o=t[s];e._cacheIndex=s,t[s]=e,o._cacheIndex=r,t[r]=o}_addInactiveBinding(e,t,r){const s=this._bindingsByRootAndName,o=this._bindings;let l=s[t];void 0===l&&(l={},s[t]=l),l[r]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){const t=this._bindings,r=e.binding,s=r.rootNode.uuid,o=r.path,l=this._bindingsByRootAndName,c=l[s],h=t[t.length-1],d=e._cacheIndex;h._cacheIndex=d,t[d]=h,t.pop(),delete c[o],0===Object.keys(c).length&&delete l[s]}_lendBinding(e){const t=this._bindings,r=e._cacheIndex,s=this._nActiveBindings++,o=t[s];e._cacheIndex=s,t[s]=e,o._cacheIndex=r,t[r]=o}_takeBackBinding(e){const t=this._bindings,r=e._cacheIndex,s=--this._nActiveBindings,o=t[s];e._cacheIndex=s,t[s]=e,o._cacheIndex=r,t[r]=o}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let r=e[t];return void 0===r&&(r=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,yr),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){const t=this._controlInterpolants,r=e.__cacheIndex,s=--this._nActiveControlInterpolants,o=t[s];e.__cacheIndex=s,t[s]=e,o.__cacheIndex=r,t[r]=o}clipAction(e,t,r){const s=t||this._root,o=s.uuid;let l="string"==typeof e?three_module_AnimationClip.findByName(s,e):e;const c=null!==l?l.uuid:e,h=this._actionsByClip[c];let d=null;if(void 0===r&&(r=null!==l?l.blendMode:fe),void 0!==h){const e=h.actionByRoot[o];if(void 0!==e&&e.blendMode===r)return e;d=h.knownActions[0],null===l&&(l=d._clip)}if(null===l)return null;const p=new AnimationAction(this,l,t,r);return this._bindAction(p,d),this._addInactiveAction(p,c,o),p}existingAction(e,t){const r=t||this._root,s=r.uuid,o="string"==typeof e?three_module_AnimationClip.findByName(r,e):e,l=o?o.uuid:e,c=this._actionsByClip[l];return void 0!==c&&c.actionByRoot[s]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,s=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let c=0;c!==r;++c){t[c]._update(s,e,o,l)}const c=this._bindings,h=this._nActiveBindings;for(let e=0;e!==h;++e)c[e].apply(l);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,r=e.uuid,s=this._actionsByClip,o=s[r];if(void 0!==o){const e=o.knownActions;for(let r=0,s=e.length;r!==s;++r){const s=e[r];this._deactivateAction(s);const o=s._cacheIndex,l=t[t.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,l._cacheIndex=o,t[o]=l,t.pop(),this._removeInactiveBindingsForAction(s)}delete s[r]}}uncacheRoot(e){const t=e.uuid,r=this._actionsByClip;for(const e in r){const s=r[e].actionByRoot[t];void 0!==s&&(this._deactivateAction(s),this._removeInactiveAction(s))}const s=this._bindingsByRootAndName[t];if(void 0!==s)for(const e in s){const t=s[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class Uniform{constructor(e){this.value=e}clone(){return new Uniform(void 0===this.value.clone?this.value:this.value.clone())}}const Er=new three_module_Matrix4;function ascSort(e,t){return e.distance-t.distance}function intersect(e,t,r,s){if(e.layers.test(t.layers)&&e.raycast(t,r),!0===s){const s=e.children;for(let e=0,o=s.length;e<o;e++)intersect(s[e],t,r,!0)}}class Spherical{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(clamp(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:l}})),"undefined"!=typeof window&&(window.__THREE__?o.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=l);const xr=window,Mr=xr.ShadowRoot&&(void 0===xr.ShadyCSS||xr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),Sr=new WeakMap;class css_tag_o{constructor(e,t,r){if(this._$cssResult$=!0,r!==Cr)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(Mr&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=Sr.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Sr.set(t,e))}return e}toString(){return this.cssText}}const Ir=Mr?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new css_tag_o("string"==typeof e?e:e+"",void 0,Cr))(t)})(e):e;var br;const wr=window,Tr=wr.trustedTypes,Br=Tr?Tr.emptyScript:"",Rr=wr.reactiveElementPolyfillSupport,Lr={toAttribute(e,t){switch(t){case Boolean:e=e?Br:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},a=(e,t)=>t!==e&&(t==t||e==e),Dr={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:a},Ur="finalized";class u 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(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,r)=>{const s=this._$Ep(r,t);void 0!==s&&(this._$Ev.set(s,r),e.push(s))})),e}static createProperty(e,t=Dr){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const r="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,r,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(s){const o=this[e];this[t]=s,this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Dr}static finalize(){if(this.hasOwnProperty(Ur))return!1;this[Ur]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of t)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(Ir(e))}else void 0!==e&&t.push(Ir(e));return t}static _$Ep(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,r;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(r=e.hostConnected)||void 0===r||r.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||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=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{Mr?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),s=xr.litNonce;void 0!==s&&r.setAttribute("nonce",s),r.textContent=t.cssText,e.appendChild(r)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Dr){var s;const o=this.constructor._$Ep(e,r);if(void 0!==o&&!0===r.reflect){const l=(void 0!==(null===(s=r.converter)||void 0===s?void 0:s.toAttribute)?r.converter:Lr).toAttribute(t,r.type);this._$El=e,null==l?this.removeAttribute(o):this.setAttribute(o,l),this._$El=null}}_$AK(e,t){var r;const s=this.constructor,o=s._$Ev.get(e);if(void 0!==o&&this._$El!==o){const e=s.getPropertyOptions(o),l="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(r=e.converter)||void 0===r?void 0:r.fromAttribute)?e.converter:Lr;this._$El=o,this[o]=l.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,r){let s=!0;void 0!==e&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||a)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,r))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(r)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),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){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var Pr;u[Ur]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==Rr||Rr({ReactiveElement:u}),(null!==(br=wr.reactiveElementVersions)&&void 0!==br?br:wr.reactiveElementVersions=[]).push("1.6.3");const Fr=window,Nr=Fr.trustedTypes,Qr=Nr?Nr.createPolicy("lit-html",{createHTML:e=>e}):void 0,Or="$lit$",kr=`lit$${(Math.random()+"").slice(9)}$`,Gr="?"+kr,Vr=`<${Gr}>`,Hr=document,lit_html_u=()=>Hr.createComment(""),lit_html_d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,zr=Array.isArray,v=e=>zr(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),Wr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qr=/-->/g,jr=/>/g,Xr=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),Yr=/'/g,Kr=/"/g,Jr=/^(?:script|style|textarea|title)$/i,w=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),$r=w(1),Zr=(w(2),Symbol.for("lit-noChange")),es=Symbol.for("lit-nothing"),ts=new WeakMap,is=Hr.createTreeWalker(Hr,129,null,!1);function P(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Qr?Qr.createHTML(t):t}const V=(e,t)=>{const r=e.length-1,s=[];let o,l=2===t?"<svg>":"",c=Wr;for(let t=0;t<r;t++){const r=e[t];let h,d,p=-1,A=0;for(;A<r.length&&(c.lastIndex=A,d=c.exec(r),null!==d);)A=c.lastIndex,c===Wr?"!--"===d[1]?c=qr:void 0!==d[1]?c=jr:void 0!==d[2]?(Jr.test(d[2])&&(o=RegExp("</"+d[2],"g")),c=Xr):void 0!==d[3]&&(c=Xr):c===Xr?">"===d[0]?(c=null!=o?o:Wr,p=-1):void 0===d[1]?p=-2:(p=c.lastIndex-d[2].length,h=d[1],c=void 0===d[3]?Xr:'"'===d[3]?Kr:Yr):c===Kr||c===Yr?c=Xr:c===qr||c===jr?c=Wr:(c=Xr,o=void 0);const m=c===Xr&&e[t+1].startsWith("/>")?" ":"";l+=c===Wr?r+Vr:p>=0?(s.push(h),r.slice(0,p)+Or+r.slice(p)+kr+m):r+kr+(-2===p?(s.push(void 0),t):m)}return[P(e,l+(e[r]||"<?>")+(2===t?"</svg>":"")),s]};class N{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let o=0,l=0;const c=e.length-1,h=this.parts,[d,p]=V(e,t);if(this.el=N.createElement(d,r),is.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(s=is.nextNode())&&h.length<c;){if(1===s.nodeType){if(s.hasAttributes()){const e=[];for(const t of s.getAttributeNames())if(t.endsWith(Or)||t.startsWith(kr)){const r=p[l++];if(e.push(t),void 0!==r){const e=s.getAttribute(r.toLowerCase()+Or).split(kr),t=/([.?@])?(.*)/.exec(r);h.push({type:1,index:o,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else h.push({type:6,index:o})}for(const t of e)s.removeAttribute(t)}if(Jr.test(s.tagName)){const e=s.textContent.split(kr),t=e.length-1;if(t>0){s.textContent=Nr?Nr.emptyScript:"";for(let r=0;r<t;r++)s.append(e[r],lit_html_u()),is.nextNode(),h.push({type:2,index:++o});s.append(e[t],lit_html_u())}}}else if(8===s.nodeType)if(s.data===Gr)h.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(kr,e+1));)h.push({type:7,index:o}),e+=kr.length-1}o++}}static createElement(e,t){const r=Hr.createElement("template");return r.innerHTML=e,r}}function lit_html_S(e,t,r=e,s){var o,l,c,h;if(t===Zr)return t;let d=void 0!==s?null===(o=r._$Co)||void 0===o?void 0:o[s]:r._$Cl;const p=lit_html_d(t)?void 0:t._$litDirective$;return(null==d?void 0:d.constructor)!==p&&(null===(l=null==d?void 0:d._$AO)||void 0===l||l.call(d,!1),void 0===p?d=void 0:(d=new p(e),d._$AT(e,r,s)),void 0!==s?(null!==(c=(h=r)._$Co)&&void 0!==c?c:h._$Co=[])[s]=d:r._$Cl=d),void 0!==d&&(t=lit_html_S(e,d._$AS(e,t.values),d,s)),t}class M{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:r},parts:s}=this._$AD,o=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:Hr).importNode(r,!0);is.currentNode=o;let l=is.nextNode(),c=0,h=0,d=s[0];for(;void 0!==d;){if(c===d.index){let t;2===d.type?t=new R(l,l.nextSibling,this,e):1===d.type?t=new d.ctor(l,d.name,d.strings,this,e):6===d.type&&(t=new Z(l,this,e)),this._$AV.push(t),d=s[++h]}c!==(null==d?void 0:d.index)&&(l=is.nextNode(),c++)}return is.currentNode=Hr,o}v(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class R{constructor(e,t,r,s){var o;this.type=2,this._$AH=es,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lit_html_S(this,e,t),lit_html_d(e)?e===es||null==e||""===e?(this._$AH!==es&&this._$AR(),this._$AH=es):e!==this._$AH&&e!==Zr&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):v(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!==es&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=e:this.$(Hr.createTextNode(e)),this._$AH=e}g(e){var t;const{values:r,_$litType$:s}=e,o="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===o)this._$AH.v(r);else{const e=new M(o,this),t=e.u(this.options);e.v(r),this.$(t),this._$AH=e}}_$AC(e){let t=ts.get(e.strings);return void 0===t&&ts.set(e.strings,t=new N(e)),t}T(e){zr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const o of e)s===t.length?t.push(r=new R(this.k(lit_html_u()),this.k(lit_html_u()),this,this.options)):r=t[s],r._$AI(o),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class k{constructor(e,t,r,s,o){this.type=1,this._$AH=es,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=es}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,s){const o=this.strings;let l=!1;if(void 0===o)e=lit_html_S(this,e,t,0),l=!lit_html_d(e)||e!==this._$AH&&e!==Zr,l&&(this._$AH=e);else{const s=e;let c,h;for(e=o[0],c=0;c<o.length-1;c++)h=lit_html_S(this,s[r+c],t,c),h===Zr&&(h=this._$AH[c]),l||(l=!lit_html_d(h)||h!==this._$AH[c]),h===es?e=es:e!==es&&(e+=(null!=h?h:"")+o[c+1]),this._$AH[c]=h}l&&!s&&this.j(e)}j(e){e===es?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===es?void 0:e}}const ns=Nr?Nr.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==es?this.element.setAttribute(this.name,ns):this.element.removeAttribute(this.name)}}class z extends k{constructor(e,t,r,s,o){super(e,t,r,s,o),this.type=5}_$AI(e,t=this){var r;if((e=null!==(r=lit_html_S(this,e,t,0))&&void 0!==r?r:es)===Zr)return;const s=this._$AH,o=e===es&&s!==es||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,l=e!==es&&(s===es||o);o&&this.element.removeEventListener(this.name,this,s),l&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==r?r:this.element,e):this._$AH.handleEvent(e)}}class Z{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lit_html_S(this,e)}}const rs=Fr.litHtmlPolyfillSupport;null==rs||rs(N,R),(null!==(Pr=Fr.litHtmlVersions)&&void 0!==Pr?Pr:Fr.litHtmlVersions=[]).push("2.8.0");const D=(e,t,r)=>{var s,o;const l=null!==(s=null==r?void 0:r.renderBefore)&&void 0!==s?s:t;let c=l._$litPart$;if(void 0===c){const e=null!==(o=null==r?void 0:r.renderBefore)&&void 0!==o?o:null;l._$litPart$=c=new R(t.insertBefore(lit_html_u(),e),e,void 0,null!=r?r:{})}return c._$AI(e),c};var ss,as;class lit_element_s extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const r=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=r.firstChild),r}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return Zr}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(ss=globalThis.litElementHydrateSupport)||void 0===ss||ss.call(globalThis,{LitElement:lit_element_s});const os=globalThis.litElementPolyfillSupport;null==os||os({LitElement:lit_element_s});(null!==(as=globalThis.litElementVersions)&&void 0!==as?as:globalThis.litElementVersions=[]).push("3.3.3");const ls=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,cs=ls&&null!=self.XRSession.prototype.requestHitTestSource,hs=null!=self.ResizeObserver,us=null!=self.IntersectionObserver,ds=cs,ps=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(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(e)||/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(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),As=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,ms=(/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent)),gs=/OculusBrowser/.test(navigator.userAgent),fs=(As&&/CriOS\//.test(navigator.userAgent),ps&&!ms&&!gs),_s=Boolean(window.webkit&&window.webkit.messageHandlers),vs=(()=>{if(As){if(_s)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}}return!1})();var ys=r(5108);const deserializeUrl=e=>e&&"null"!==e?toFullUrl(e):null,assertIsArCandidate=()=>{if(ds)return;const e=[];throw ls||e.push("WebXR Device API"),cs||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},toFullUrl=e=>new URL(e,window.location.toString()).toString(),debounce=(e,t)=>{let r=null;return(...s)=>{null!=r&&self.clearTimeout(r),r=self.setTimeout((()=>{r=null,e(...s)}),t)}},utilities_clamp=(e,t,r)=>Math.max(t,Math.min(r,e)),Es=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;if(window.self!==window.top)return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||ys.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),xs=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();var __decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Ms=Symbol("currentEnvironmentMap"),Cs=Symbol("currentBackground"),Ss=Symbol("updateEnvironment"),Is=Symbol("cancelEnvironmentUpdate"),bs=$r`
|
|
3
|
+
<style>
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
position: relative;
|
|
7
|
+
contain: strict;
|
|
8
|
+
width: 300px;
|
|
9
|
+
height: 150px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container {
|
|
13
|
+
position: relative;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.userInput {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
display: none;
|
|
21
|
+
position: relative;
|
|
22
|
+
outline-offset: -1px;
|
|
23
|
+
outline-width: 1px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
canvas {
|
|
27
|
+
position: absolute;
|
|
28
|
+
display: none;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
/* NOTE(cdata): Chrome 76 and below apparently have a bug
|
|
31
|
+
* that causes our canvas not to display pixels unless it is
|
|
32
|
+
* on its own render layer
|
|
33
|
+
* @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
|
|
34
|
+
*/
|
|
35
|
+
transform: translateZ(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.show {
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Adapted from HTML5 Boilerplate
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
|
|
45
|
+
.screen-reader-only {
|
|
46
|
+
border: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 0;
|
|
49
|
+
clip: rect(0, 0, 0, 0);
|
|
50
|
+
height: 1px;
|
|
51
|
+
margin: -1px;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
padding: 0;
|
|
54
|
+
position: absolute;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
width: 1px;
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.slot {
|
|
61
|
+
position: absolute;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.slot > * {
|
|
70
|
+
pointer-events: initial;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.annotation-wrapper ::slotted(*) {
|
|
74
|
+
opacity: var(--max-hotspot-opacity, 1);
|
|
75
|
+
transition: opacity 0.3s;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pointer-tumbling .annotation-wrapper ::slotted(*) {
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.annotation-wrapper ::slotted(*) {
|
|
83
|
+
pointer-events: initial;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.annotation-wrapper.hide ::slotted(*) {
|
|
87
|
+
opacity: var(--min-hotspot-opacity, 0.25);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.slot.poster {
|
|
91
|
+
display: none;
|
|
92
|
+
background-color: inherit;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.slot.poster.show {
|
|
96
|
+
display: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.slot.poster > * {
|
|
100
|
+
pointer-events: initial;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.slot.poster:not(.show) > * {
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#default-poster {
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
/* The default poster is a <button> so we need to set display
|
|
111
|
+
* to prevent it from being affected by text-align: */
|
|
112
|
+
display: block;
|
|
113
|
+
position: absolute;
|
|
114
|
+
border: none;
|
|
115
|
+
padding: 0;
|
|
116
|
+
background-size: contain;
|
|
117
|
+
background-repeat: no-repeat;
|
|
118
|
+
background-position: center;
|
|
119
|
+
background-color: #fff0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#default-progress-bar {
|
|
123
|
+
display: block;
|
|
124
|
+
position: relative;
|
|
125
|
+
width: 100%;
|
|
126
|
+
height: 100%;
|
|
127
|
+
pointer-events: none;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#default-progress-bar > .bar {
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 0;
|
|
134
|
+
left: 0;
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: var(--progress-bar-height, 5px);
|
|
137
|
+
background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
|
|
138
|
+
transition: transform 0.09s;
|
|
139
|
+
transform-origin: top left;
|
|
140
|
+
transform: scaleX(0);
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#default-progress-bar > .bar.hide {
|
|
145
|
+
transition: opacity 0.3s 1s;
|
|
146
|
+
opacity: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.centered {
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.cover {
|
|
155
|
+
position: absolute;
|
|
156
|
+
top: 0;
|
|
157
|
+
left: 0;
|
|
158
|
+
width: 100%;
|
|
159
|
+
height: 100%;
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.slot.interaction-prompt {
|
|
164
|
+
display: var(--interaction-prompt-display, flex);
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
opacity: 0;
|
|
167
|
+
will-change: opacity;
|
|
168
|
+
transition: opacity 0.3s;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.slot.interaction-prompt.visible {
|
|
172
|
+
opacity: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.animated-container {
|
|
176
|
+
will-change: transform, opacity;
|
|
177
|
+
opacity: 0;
|
|
178
|
+
transition: opacity 0.3s;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.slot.interaction-prompt > * {
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.slot.ar-button {
|
|
186
|
+
-moz-user-select: none;
|
|
187
|
+
-webkit-tap-highlight-color: transparent;
|
|
188
|
+
user-select: none;
|
|
189
|
+
|
|
190
|
+
display: var(--ar-button-display, block);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.slot.ar-button:not(.enabled) {
|
|
194
|
+
display: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.fab {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
width: 40px;
|
|
203
|
+
height: 40px;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
background-color: #fff;
|
|
206
|
+
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
|
|
207
|
+
border-radius: 100px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.fab > * {
|
|
211
|
+
opacity: 0.87;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
#default-ar-button {
|
|
215
|
+
position: absolute;
|
|
216
|
+
bottom: 16px;
|
|
217
|
+
right: 16px;
|
|
218
|
+
transform: scale(var(--ar-button-scale, 1));
|
|
219
|
+
transform-origin: bottom right;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.slot.pan-target {
|
|
223
|
+
display: block;
|
|
224
|
+
position: absolute;
|
|
225
|
+
width: 0;
|
|
226
|
+
height: 0;
|
|
227
|
+
left: 50%;
|
|
228
|
+
top: 50%;
|
|
229
|
+
transform: translate3d(-50%, -50%, 0);
|
|
230
|
+
background-color: transparent;
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transition: opacity 0.3s;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
#default-pan-target {
|
|
236
|
+
width: 6px;
|
|
237
|
+
height: 6px;
|
|
238
|
+
border-radius: 6px;
|
|
239
|
+
border: 1px solid white;
|
|
240
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.slot.default {
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.slot.progress-bar {
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.slot.exit-webxr-ar-button {
|
|
252
|
+
pointer-events: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.slot.exit-webxr-ar-button:not(.enabled) {
|
|
256
|
+
display: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
#default-exit-webxr-ar-button {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: center;
|
|
263
|
+
position: absolute;
|
|
264
|
+
top: env(safe-area-inset-top, 16px);
|
|
265
|
+
right: 16px;
|
|
266
|
+
width: 40px;
|
|
267
|
+
height: 40px;
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#default-exit-webxr-ar-button > svg {
|
|
272
|
+
fill: #fff;
|
|
273
|
+
}
|
|
274
|
+
</style>
|
|
275
|
+
<div class="container">
|
|
276
|
+
<div class="userInput" tabindex="0" role="img"
|
|
277
|
+
aria-label="3D model">
|
|
278
|
+
<div class="slot canvas">
|
|
279
|
+
<slot name="canvas">
|
|
280
|
+
<canvas></canvas>
|
|
281
|
+
</slot>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
|
|
287
|
+
will have their <slot> elements removed by ShadyCSS -->
|
|
288
|
+
<div class="slot poster">
|
|
289
|
+
<slot name="poster">
|
|
290
|
+
<button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
|
|
291
|
+
</slot>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div class="slot ar-button">
|
|
295
|
+
<slot name="ar-button">
|
|
296
|
+
<a id="default-ar-button" part="default-ar-button" class="fab"
|
|
297
|
+
tabindex="2"
|
|
298
|
+
role="button"
|
|
299
|
+
href="javascript:void(0);"
|
|
300
|
+
aria-label="View in your space">
|
|
301
|
+
${$r`
|
|
302
|
+
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
|
|
303
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
|
|
304
|
+
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
|
305
|
+
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
|
|
306
|
+
<g id="Art_layer">
|
|
307
|
+
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
|
|
308
|
+
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
|
|
309
|
+
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
|
|
310
|
+
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
|
|
311
|
+
<g>
|
|
312
|
+
<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
|
|
313
|
+
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
|
|
314
|
+
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"/>
|
|
315
|
+
</g>
|
|
316
|
+
</g>
|
|
317
|
+
</svg>`}
|
|
318
|
+
</a>
|
|
319
|
+
</slot>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<div class="slot pan-target">
|
|
323
|
+
<slot name="pan-target">
|
|
324
|
+
<div id="default-pan-target">
|
|
325
|
+
</div>
|
|
326
|
+
</slot>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<div class="slot interaction-prompt cover centered">
|
|
330
|
+
<div id="prompt" class="animated-container">
|
|
331
|
+
<slot name="interaction-prompt" aria-hidden="true">
|
|
332
|
+
${$r`
|
|
333
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
|
|
334
|
+
<defs>
|
|
335
|
+
<path id="A" d="M.001.232h24.997V36H.001z" />
|
|
336
|
+
</defs>
|
|
337
|
+
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
|
|
338
|
+
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
|
|
339
|
+
<g transform="translate(11 3)">
|
|
340
|
+
<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" />
|
|
341
|
+
<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" />
|
|
342
|
+
<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" />
|
|
343
|
+
<g transform="translate(0 .769)">
|
|
344
|
+
<mask id="B" fill="#fff">
|
|
345
|
+
<use xlink:href="#A" />
|
|
346
|
+
</mask>
|
|
347
|
+
<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.715-.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)" />
|
|
348
|
+
</g>
|
|
349
|
+
</g>
|
|
350
|
+
</g>
|
|
351
|
+
</svg>`}
|
|
352
|
+
</slot>
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<div id="finger0" class="animated-container cover">
|
|
357
|
+
<slot name="finger0" aria-hidden="true">
|
|
358
|
+
</slot>
|
|
359
|
+
</div>
|
|
360
|
+
<div id="finger1" class="animated-container cover">
|
|
361
|
+
<slot name="finger1" aria-hidden="true">
|
|
362
|
+
</slot>
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<div class="slot default">
|
|
366
|
+
<slot></slot>
|
|
367
|
+
|
|
368
|
+
<div class="slot progress-bar">
|
|
369
|
+
<slot name="progress-bar">
|
|
370
|
+
<div id="default-progress-bar" aria-hidden="true">
|
|
371
|
+
<div class="bar" part="default-progress-bar"></div>
|
|
372
|
+
</div>
|
|
373
|
+
</slot>
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
<div class="slot exit-webxr-ar-button">
|
|
377
|
+
<slot name="exit-webxr-ar-button">
|
|
378
|
+
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
|
|
379
|
+
tabindex="3"
|
|
380
|
+
aria-label="Exit AR"
|
|
381
|
+
aria-hidden="true">
|
|
382
|
+
${$r`
|
|
383
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
|
|
384
|
+
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
|
|
385
|
+
support for dynamic re-coloring of UI components -->
|
|
386
|
+
<defs>
|
|
387
|
+
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
|
|
388
|
+
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
|
389
|
+
<feOffset dx="0" dy="0" result="offsetblur"/>
|
|
390
|
+
<feFlood flood-color="#000000"/>
|
|
391
|
+
<feComposite in2="offsetblur" operator="in"/>
|
|
392
|
+
<feMerge>
|
|
393
|
+
<feMergeNode/>
|
|
394
|
+
<feMergeNode in="SourceGraphic"/>
|
|
395
|
+
</feMerge>
|
|
396
|
+
</filter>
|
|
397
|
+
</defs>
|
|
398
|
+
<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"/>
|
|
399
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
400
|
+
</svg>`}
|
|
401
|
+
</a>
|
|
402
|
+
</slot>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
407
|
+
<span id="status" role="status"></span>
|
|
408
|
+
</div>`;var ws=r(5108);const Ts=new WeakMap;function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),h=r.num_points()*c,d=h*o.BYTES_PER_ELEMENT,p=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),A=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,p,d,A);const m=new o(e.HEAPF32.buffer,A,h).slice();return e._free(A),{name:s,array:m,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,h;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,h=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,h=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!h.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const r in o){const h=self[l[r]];let d,A;if(s.useUniqueIDs)A=o[r],d=t.GetAttributeByUniqueId(c,A);else{if(A=t.GetAttributeId(c,e[o[r]]),-1===A)continue;d=t.GetAttribute(c,A)}const m=decodeAttribute(e,t,c,r,h,d);"color"===r&&(m.vertexColorSpace=s.vertexColorSpace),p.attributes.push(m)}d===e.TRIANGULAR_MESH&&(p.index=function decodeIndex(e,t,r){const s=3*r.num_faces(),o=4*s,l=e._malloc(o);t.GetTrianglesUInt32Array(r,o,l);const c=new Uint32Array(e.HEAPF32.buffer,l,s).slice();return e._free(l),{array:c,itemSize:1}}(e,t,c));return e.destroy(c),p}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){ws.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var Bs=r(5108);function toTrianglesDrawMode(e,t){if(0===t)return Bs.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return Bs.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,o=[];if(2===t)for(let e=1;e<=s;e++)o.push(r.getX(0)),o.push(r.getX(e)),o.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(o.push(r.getX(e)),o.push(r.getX(e+1)),o.push(r.getX(e+2))):(o.push(r.getX(e+2)),o.push(r.getX(e+1)),o.push(r.getX(e)));o.length/3!==s&&Bs.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(o),l.clearGroups(),l}return Bs.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Rs=r(5108);class GLTFLoader extends Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const o=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=LoaderUtils.extractUrlBase(e);l=LoaderUtils.resolveURL(t,this.path)}else l=LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):Rs.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new three_module_FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(r){try{o.parse(r,l,(function(r){t(r),o.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}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-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Ds){try{l[Ls.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[Ls.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||Rs.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case Ls.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case Ls.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Ls.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case Ls.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&Rs.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Ls={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 GLTFLightsExtension{constructor(e){this.parser=e,this.name=Ls.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const o=t.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const h=new Color(16777215);void 0!==l.color&&h.setRGB(l.color[0],l.color[1],l.color[2],ye);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":c=new DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new PointLight(h),c.distance=d;break;case"spot":c=new SpotLight(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?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,assignExtrasToUserData(c,l),void 0!==l.intensity&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(c),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Ls.KHR_MATERIALS_UNLIT}getMaterialType(){return MeshBasicMaterial}extendParams(e,t,r){const s=[];e.color=new Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const t=o.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ye),e.opacity=t[3]}void 0!==o.baseColorTexture&&s.push(r.assignTexture(e,"map",o.baseColorTexture,ve))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&o.push(r.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(o.push(r.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vector2(e,e)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=s.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ye)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&o.push(r.assignTexture(t,"sheenColorMap",l.sheenColorTexture,ve)),void 0!==l.sheenRoughnessTexture&&o.push(r.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&o.push(r.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=(new Color).setRGB(c[0],c[1],c[2],ye),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&o.push(r.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=(new Color).setRGB(c[0],c[1],c[2],ye),void 0!==l.specularColorTexture&&o.push(r.assignTexture(t,"specularColorMap",l.specularColorTexture,ve)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Ls.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Ls.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Ls.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Ls.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=Ls.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=Ls.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.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(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,h=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Ls.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==Ns.TRIANGLES&&e.mode!==Ns.TRIANGLE_STRIP&&e.mode!==Ns.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,l=[],c={};for(const e in o)l.push(this.parser.getDependency("accessor",o[e]).then((t=>(c[e]=t,c[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,o=[];for(const e of r){const t=new three_module_Matrix4,r=new three_module_Vector3,l=new three_module_Quaternion,h=new three_module_Vector3(1,1,1),d=new InstancedMesh(e.geometry,e.material,s);for(let e=0;e<s;e++)c.TRANSLATION&&r.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(r,l,h));for(const t in c)if("_COLOR_0"===t){const e=c[t];d.instanceColor=new three_module_InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);Object3D.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),o.push(d)}return t.isGroup?(t.clear(),t.add(...o),t):o[0]})))}}const Ds="glTF",Us=1313821514,Ps=5130562;class GLTFBinaryExtension{constructor(e){this.name=Ls.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ds)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===Us){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===Ps){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ls.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},h={},d={};for(const e in l){const t=Vs[e]||e.toLowerCase();c[t]=l[e]}for(const t in e.attributes){const s=Vs[t]||t.toLowerCase();if(void 0!==l[t]){const o=r.accessors[e.attributes[t]],l=Qs[o.componentType];d[s]=l.name,h[s]=!0===o.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=h[t];void 0!==s&&(r.normalized=s)}t(e)}),c,d,ye,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Ls.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=Ls.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=2*c,d=3*c,p=s-t,A=(r-t)/p,m=A*A,g=m*A,f=e*d,_=f-d,y=-2*g+3*m,E=g-m,x=1-y,C=E-m+A;for(let e=0;e!==c;e++){const t=l[_+e+c],r=l[_+e+h]*p,s=l[f+e+c],d=l[f+e]*p;o[e]=x*t+C*r+y*s+E*d}return o}}const Fs=new three_module_Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return Fs.fromArray(o).normalize().toArray(o),o}}const Ns={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Qs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Os={9728:x,9729:I,9984:C,9985:b,9986:S,9987:T},ks={33071:y,33648:E,10497:_},Gs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Vs={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"},Hs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},zs={CUBICSPLINE:void 0,LINEAR:de,STEP:ue},Ws="OPAQUE",qs="MASK",js="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):Rs.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else Rs.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[Ls.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){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.")}}const Xs=new three_module_Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,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 r=!1,s=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||s&&o<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three_module_FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){for(const e of l.scenes)e.updateMatrixWorld();e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Ls.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,o){r.load(LoaderUtils.resolveURL(t.uri,s.path),e,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(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=Gs[s.type],t=Qs[s.componentType],r=!0===s.normalized,o=new t(s.count*e);return Promise.resolve(new three_module_BufferAttribute(o,e,r))}const o=[];return void 0!==s.bufferView?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),void 0!==s.sparse&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then((function(e){const o=e[0],l=Gs[s.type],c=Qs[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,p=s.byteOffset||0,A=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let g,f;if(A&&A!==d){const e=Math.floor(p/A),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let d=t.cache.get(r);d||(g=new c(o,e*A,s.count*A/h),d=new three_module_InterleavedBuffer(g,A/h),t.cache.add(r,d)),f=new three_module_InterleavedBufferAttribute(d,l,p%A/h,m)}else g=null===o?new c(s.count*l):new c(o,p,s.count*l),f=new three_module_BufferAttribute(g,l,m);if(void 0!==s.sparse){const t=Gs.SCALAR,r=Qs[s.sparse.indices.componentType],h=s.sparse.indices.byteOffset||0,d=s.sparse.values.byteOffset||0,p=new r(e[1],h,s.sparse.count*t),A=new c(e[2],d,s.sparse.count*l);null!==o&&(f=new three_module_BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=p.length;e<t;e++){const t=p[e];if(f.setX(t,A[e*l]),l>=2&&f.setY(t,A[e*l+1]),l>=3&&f.setZ(t,A[e*l+2]),l>=4&&f.setW(t,A[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,o=this.json,l=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=l.name||c.name||"",""===t.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(t.name=c.uri);const r=(o.samplers||{})[l.sampler]||{};return t.magFilter=Os[r.magFilter]||I,t.minFilter=Os[r.minFilter]||T,t.wrapS=ks[r.wrapS]||_,t.wrapT=ks[r.wrapT]||_,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[h]=d,d}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=s.images[e],c=self.URL||self.webkitURL;let h=l.uri||"",d=!1;if(void 0!==l.bufferView)h=r.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(h).then((function(e){return new Promise((function(r,s){let l=r;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,r(t)}),t.load(LoaderUtils.resolveURL(e,o.path),l,void 0,s)}))})).then((function(e){return!0===d&&c.revokeObjectURL(h),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw Rs.error("THREE.GLTFLoader: Couldn't load texture",h),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[Ls.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[Ls.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[Ls.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,o=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||o||l){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),l&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let l;const c={},h=[];if((o.extensions||{})[Ls.KHR_MATERIALS_UNLIT]){const e=s[Ls.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),h.push(e.extendParams(c,o,t))}else{const r=o.pbrMetallicRoughness||{};if(c.color=new Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.setRGB(e[0],e[1],e[2],ye),c.opacity=e[3]}void 0!==r.baseColorTexture&&h.push(t.assignTexture(c,"map",r.baseColorTexture,ve)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(h.push(t.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===o.doubleSided&&(c.side=2);const d=o.alphaMode||Ws;if(d===js?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===qs&&(c.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new Vector2(1,1),void 0!==o.normalTexture.scale)){const e=o.normalTexture.scale;c.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(c.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&l!==MeshBasicMaterial){const e=o.emissiveFactor;c.emissive=(new Color).setRGB(e[0],e[1],e[2],ye)}return void 0!==o.emissiveTexture&&l!==MeshBasicMaterial&&h.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,ve)),Promise.all(h).then((function(){const r=new l(c);return o.name&&(r.name=o.name),assignExtrasToUserData(r,o),t.associations.set(r,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(s,r,o),r}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[Ls.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const o=[];for(let r=0,l=e.length;r<l;r++){const l=e[r],c=createPrimitiveKey(l),h=s[c];if(h)o.push(h.promise);else{let e;e=l.extensions&&l.extensions[Ls.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new three_module_BufferGeometry,l,t),s[c]={primitive:l,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,o=r.meshes[e],l=o.primitives,c=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);c.push(t)}return c.push(t.loadGeometries(l)),Promise.all(c).then((function(r){const c=r.slice(0,r.length-1),h=r[r.length-1],d=[];for(let r=0,p=h.length;r<p;r++){const p=h[r],A=l[r];let m;const g=c[r];if(A.mode===Ns.TRIANGLES||A.mode===Ns.TRIANGLE_STRIP||A.mode===Ns.TRIANGLE_FAN||void 0===A.mode)m=!0===o.isSkinnedMesh?new SkinnedMesh(p,g):new three_module_Mesh(p,g),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),A.mode===Ns.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,1):A.mode===Ns.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,2));else if(A.mode===Ns.LINES)m=new LineSegments(p,g);else if(A.mode===Ns.LINE_STRIP)m=new Line(p,g);else if(A.mode===Ns.LINE_LOOP)m=new LineLoop(p,g);else{if(A.mode!==Ns.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);m=new Points(p,g)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(m,o),A.extensions&&addUnknownExtensionsToUserData(s,m,A),t.assignFinalMaterial(m),d.push(m)}for(let r=0,s=d.length;r<s;r++)t.associations.set(d[r],{meshes:e,primitives:r});if(1===d.length)return o.extensions&&addUnknownExtensionsToUserData(s,d[0],o),d[0];const p=new three_module_Group;o.extensions&&addUnknownExtensionsToUserData(s,p,o),t.associations.set(p,{meshes:e});for(let e=0,t=d.length;e<t;e++)p.add(d[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new PerspectiveCamera(Fe.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);Rs.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,o=[],l=[];for(let e=0,c=s.length;e<c;e++){const c=s[e];if(c){o.push(c);const t=new three_module_Matrix4;null!==r&&t.fromArray(r.array,16*e),l.push(t)}else Rs.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Skeleton(o,l)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,l=[],c=[],h=[],d=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,A=o.node,m=void 0!==s.parameters?s.parameters[r.input]:r.input,g=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",m)),h.push(this.getDependency("accessor",g)),d.push(r),p.push(o))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],p=s[e],A=l[e],m=c[e],g=h[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,p,A,m,g);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new three_module_AnimationClip(o,void 0,d)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Xs)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const o=t.nodes[e],l=o.name?s.createUniqueName(o.name):"",c=[],h=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return h&&c.push(h),void 0!==o.camera&&c.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){c.push(e)})),this.nodeCache[e]=Promise.all(c).then((function(t){let c;if(c=!0===o.isBone?new Bone:t.length>1?new three_module_Group:1===t.length?t[0]:new Object3D,c!==t[0])for(let e=0,r=t.length;e<r;e++)c.add(t[e]);if(o.name&&(c.userData.name=o.name,c.name=l),assignExtrasToUserData(c,o),o.extensions&&addUnknownExtensionsToUserData(r,c,o),void 0!==o.matrix){const e=new three_module_Matrix4;e.fromArray(o.matrix),c.applyMatrix4(e)}else void 0!==o.translation&&c.position.fromArray(o.translation),void 0!==o.rotation&&c.quaternion.fromArray(o.rotation),void 0!==o.scale&&c.scale.fromArray(o.scale);return s.associations.has(c)||s.associations.set(c,{}),s.associations.get(c).nodes=e,c})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,o=new three_module_Group;r.name&&(o.name=s.createUniqueName(r.name)),assignExtrasToUserData(o,r),r.extensions&&addUnknownExtensionsToUserData(t,o,r);const l=r.nodes||[],c=[];for(let e=0,t=l.length;e<t;e++)c.push(s.getDependency("node",l[e]));return Promise.all(c).then((function(e){for(let t=0,r=e.length;t<r;t++)o.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(o),o}))}_createAnimationTracks(e,t,r,s,o){const l=[],c=e.name?e.name:e.uuid,h=[];let d;switch(Hs[o.path]===Hs.weights?e.traverse((function(e){e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)})):h.push(c),Hs[o.path]){case Hs.weights:d=NumberKeyframeTrack;break;case Hs.rotation:d=three_module_QuaternionKeyframeTrack;break;case Hs.position:case Hs.scale:d=three_module_VectorKeyframeTrack;break;default:if(1===r.itemSize)d=NumberKeyframeTrack;else d=three_module_VectorKeyframeTrack}const p=void 0!==s.interpolation?zs[s.interpolation]:de,A=this._getArrayFromAccessor(r);for(let e=0,r=h.length;e<r;e++){const r=new d(h[e]+"."+Hs[o.path],t.array,A,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),l.push(r)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof three_module_QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,o=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=Vs[t]||t.toLowerCase();r in e.attributes||o.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(s)}return He.workingColorSpace!==ye&&"COLOR_0"in s&&Rs.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${He.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,o=new Box3;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void Rs.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new three_module_Vector3(t[0],t[1],t[2]),new three_module_Vector3(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(Qs[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new three_module_Vector3,t=new three_module_Vector3;for(let s=0,o=l.length;s<o;s++){const o=l[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(Qs[s.componentType]);t.multiplyScalar(e)}e.max(t)}else Rs.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(e)}e.boundingBox=o;const c=new Sphere;o.getCenter(c.center),c.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=c}(e,t,r),Promise.all(o).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],h=[],d=[];for(let p=0,A=t.length;p<A;p++){const A=t[p];if(s){const t=void 0!==A.POSITION?r.getDependency("accessor",A.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==A.NORMAL?r.getDependency("accessor",A.NORMAL):e.attributes.normal;h.push(t)}if(l){const t=void 0!==A.COLOR_0?r.getDependency("accessor",A.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(h),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],h=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{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 r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,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}}var Ys=r(3085).Buffer;class Si{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 Ii{constructor(e,t,r,s){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,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)+2**32*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 r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const Ks=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Ys.from(e).toString("utf8")}var Js=r(3085).Buffer;let $s,Zs,ea;const ta={env:{emscripten_notify_memory_growth:function(e){ea=new Uint8Array(Zs.exports.memory.buffer)}}};class zstddec_module_Q{init(){return $s||($s="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+ia).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,ta))).then(this._init):WebAssembly.instantiate(Js.from(ia,"base64"),ta).then(this._init),$s)}_init(e){Zs=e.instance,ta.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Zs)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=Zs.exports.malloc(r);ea.set(e,s),t=t||Number(Zs.exports.ZSTD_findDecompressedSize(s,r));const o=Zs.exports.malloc(t),l=Zs.exports.ZSTD_decompress(o,t,s,r),c=ea.slice(o,o+l);return Zs.exports.free(s),Zs.exports.free(o),c}}const ia="AGFzbQEAAAABpQEVYAF/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//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/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";var na=r(5108);const ra=new WeakMap;let sa,aa=0;class KTX2Loader extends Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&na.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!0===e.isWebGPURenderer?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 three_module_FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new three_module_FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),aa>0&&na.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),aa++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const o=new three_module_FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{if(ra.has(e)){return ra.get(e).promise.then(t).catch(s)}this._createTexture(e).then((e=>t?t(e):null)).catch(s)}),r,s)}_createTextureFrom(e,t){const{faces:r,width:s,height:o,format:l,type:c,error:h,dfdFlags:d}=e;if("error"===c)return Promise.reject(h);let p;if(6===t.faceCount)p=new CompressedCubeTexture(r,l,B);else{const e=r[0].mipmaps;p=t.layerCount>1?new CompressedArrayTexture(e,s,o,t.layerCount,l,B):new CompressedTexture(e,s,o,l,B)}return p.minFilter=1===r[0].mipmaps.length?I:T,p.magFilter=I,p.generateMipmaps=!1,p.needsUpdate=!0,p.colorSpace=parseColorSpace(t),p.premultiplyAlpha=!!(1&d),p}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Ks.length);if(t[0]!==Ks[0]||t[1]!==Ks[1]||t[2]!==Ks[2]||t[3]!==Ks[3]||t[4]!==Ks[4]||t[5]!==Ks[5]||t[6]!==Ks[6]||t[7]!==Ks[7]||t[8]!==Ks[8]||t[9]!==Ks[9]||t[10]!==Ks[10]||t[11]!==Ks[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Si,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,Ks.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),h=o._nextUint32(),d=o._nextUint32(),p=o._nextUint32(),A=o._nextUint64(),m=o._nextUint64(),g=new Ii(e,Ks.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+g._nextUint64(),g._nextUint64()),uncompressedByteLength:g._nextUint64()});const f=new Ii(e,c,h,!0),_={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:[]},y=(_.descriptorBlockSize/4-6)/4;for(let e=0;e<y;e++){const t={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&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),_.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const E=new Ii(e,d,p,!0);for(;E._offset<p;){const e=E._nextUint32(),t=E._scan(e),s=Ei(t),o=E._scan(e-t.byteLength);r.keyValue[s]=s.match(/^ktx/i)?Ei(o):o,E._offset%4&&E._skip(4-E._offset%4)}if(m<=0)return r;const x=new Ii(e,A,m,!0),C=x._nextUint16(),S=x._nextUint16(),I=x._nextUint32(),b=x._nextUint32(),T=x._nextUint32(),B=x._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const F=A+x._offset,Q=F+I,O=Q+b,G=O+T,W=new Uint8Array(e.buffer,e.byteOffset+F,I),q=new Uint8Array(e.buffer,e.byteOffset+Q,b),j=new Uint8Array(e.buffer,e.byteOffset+O,T),X=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:C,selectorCount:S,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:j,extendedData:X},r}(new Uint8Array(e));if(0!==r.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===la[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(sa||(sa=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await sa);const s=[];for(let o=0;o<e.levels.length;o++){const l=Math.max(1,e.pixelWidth>>o),c=Math.max(1,e.pixelHeight>>o),h=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,d=e.levels[o];let p,A;if(0===e.supercompressionScheme)p=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(d.levelData,d.uncompressedByteLength)}A=ca[t]===Q?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):ca[t]===O?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:A,width:l,height:c,depth:h})}let o;if(oa.has(la[t]))o=0===e.pixelDepth?new DataTexture(s[0].data,e.pixelWidth,e.pixelHeight):new Data3DTexture(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");o=new CompressedTexture(s,e.pixelWidth,e.pixelHeight)}return o.mipmaps=s,o.type=ca[t],o.format=la[t],o.colorSpace=parseColorSpace(e),o.needsUpdate=!0,Promise.resolve(o)}(r);const s=t,o=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e]))).then((e=>this._createTextureFrom(e.data,r)));return ra.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),aa--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.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},KTX2Loader.EngineFormat={RGBAFormat:W,RGBA_ASTC_4x4_Format:ae,RGBA_BPTC_Format:le,RGBA_ETC2_EAC_Format:se,RGBA_PVRTC_4BPPV1_Format:ie,RGBA_S3TC_DXT5_Format:ee,RGB_ETC1_Format:ne,RGB_ETC2_Format:re,RGB_PVRTC_4BPPV1_Format:te,RGB_S3TC_DXT1_Format:K},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",(function(c){const p=c.data;switch(p.type){case"init":e=p.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&na.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(p.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:c,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_}=function transcode(t){const c=new r.KTX2File(new Uint8Array(t));function cleanup(){c.close(),c.delete()}if(!c.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const p=c.isUASTC()?l.UASTC_4x4:l.ETC1S,A=c.getWidth(),m=c.getHeight(),g=c.getLayers()||1,f=c.getLevels(),_=c.getFaces(),y=c.getHasAlpha(),E=c.getDFDFlags(),{transcoderFormat:x,engineFormat:C}=function getTranscoderFormat(t,r,c,p){let A,m;const g=t===l.ETC1S?h:d;for(let s=0;s<g.length;s++){const o=g[s];if(e[o.if]&&(o.basisFormat.includes(t)&&!(p&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(r)&&isPowerOfTwo(c))))return A=o.transcoderFormat[p?1:0],m=o.engineFormat[p?1:0],{transcoderFormat:A,engineFormat:m}}return na.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=o.RGBA32,m=s.RGBAFormat,{transcoderFormat:A,engineFormat:m}}(p,A,m,y);if(!A||!m||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!c.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const S=[],I=[];for(let e=0;e<_;e++){const t=[];for(let r=0;r<f;r++){const s=[];let o,l;for(let t=0;t<g;t++){const h=c.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||h.origWidth%4==0&&h.origHeight%4==0||na.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,l=h.origHeight):(o=h.width,l=h.height);const d=new Uint8Array(c.getImageTranscodedSizeInBytes(r,t,0,x));if(!c.transcodeImage(d,r,t,e,x,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");s.push(d)}const h=concat(s);t.push({data:h,width:o,height:l}),I.push(h.buffer)}S.push({mipmaps:t,width:A,height:m,format:C})}return cleanup(),{faces:S,buffers:I,width:A,height:m,hasAlpha:y,format:C,dfdFlags:E}}(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:t,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_},c)}catch(e){na.error(e),self.postMessage({type:"error",id:p.id,error:e.message})}}))}}));const c=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[s.RGB_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=c.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),d=c.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||0==(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const oa=new Set([W,Y,X]),la={109:W,97:W,37:W,43:W,103:Y,83:Y,16:Y,22:Y,100:X,76:X,15:X,9:X,166:oe,165:oe},ca={109:Q,97:O,37:B,43:B,103:Q,83:O,16:B,22:B,100:Q,76:O,15:B,9:B,166:B,165:B};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?ve:ye:10===t.colorPrimaries?2===t.transferFunction?Ee:xe:(0===t.colorPrimaries||na.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),_e)}var ha,ua;const da=Symbol("retainerCount"),pa=Symbol("recentlyUsed"),Aa=Symbol("evict"),ma=Symbol("evictionThreshold"),ga=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[ha]=new Map,this[ua]=[],this[ga]=e,this[ma]=t}set evictionThreshold(e){this[ma]=e,this[Aa]()}get evictionThreshold(){return this[ma]}get cache(){return this[ga]}retainerCount(e){return this[da].get(e)||0}reset(){this[da].clear(),this[pa]=[]}retain(e){this[da].has(e)||this[da].set(e,0),this[da].set(e,this[da].get(e)+1);const t=this[pa].indexOf(e);-1!==t&&this[pa].splice(t,1),this[pa].unshift(e),this[Aa]()}release(e){this[da].has(e)&&this[da].set(e,Math.max(this[da].get(e)-1,0)),this[Aa]()}[(ha=da,ua=pa,Aa)](){if(!(this[pa].length<this[ma]))for(let e=this[pa].length-1;e>=this[ma];--e){const t=this[pa][e];0===this[da].get(t)&&(this[ga].delete(t),this[pa].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var fa,_a,va=r(5108);Texture.DEFAULT_ANISOTROPY=4;const ya=new Map,Ea=new Map;let xa;const Ma=new class DRACOLoader extends Loader{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,r,s){const o=new three_module_FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=(()=>{})){this.decodeDracoFile(e,t,null,null,ve).catch(r)}decodeDracoFile(e,t,r,s,o="srgb-linear",l=(()=>{})){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,c).then(t).catch(l)}decodeGeometry(e,t){const r=JSON.stringify(t);if(Ts.has(e)){const t=Ts.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),Ts.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new three_module_BufferGeometry;e.index&&t.setIndex(new three_module_BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],o=s.name,l=s.array,c=s.itemSize,h=new three_module_BufferAttribute(l,c);"color"===o&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=l instanceof Float32Array==!1),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==ve)return;const r=new Color;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new three_module_FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,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((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:ws.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){ws.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}};let Ca;const Sa=new KTX2Loader;let Ia,ba;const wa=Symbol("loader"),Ta=Symbol("evictionPolicy"),Ba=Symbol("GLTFInstance");class CachingGLTFLoader extends EventDispatcher{constructor(e){super(),this[_a]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[Ba]=e,this[wa].setDRACOLoader(Ma),this[wa].setKTX2Loader(Sa)}static setDRACODecoderLocation(e){xa=e,Ma.setDecoderPath(e)}static getDRACODecoderLocation(){return xa}static setKTX2TranscoderLocation(e){Ca=e,Sa.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Ca}static setMeshoptDecoderLocation(e){var t;Ia!==e&&(Ia=e,ba=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Ia}static initializeKTX2Loader(e){Sa.detectSupport(e)}static get cache(){return ya}static clearCache(){ya.forEach(((e,t)=>{this.delete(t)})),this[Ta].reset()}static has(e){return ya.has(e)}static async delete(e){if(!this.has(e))return;const t=ya.get(e);Ea.delete(e),ya.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!Ea.get(e)}get[(fa=Ta,_a=wa,Ta)](){return this.constructor[Ta]}async preload(e,t,r=(()=>{})){if(this[wa].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!ya.has(e)){null!=ba&&this[wa].setMeshoptDecoder(await ba);const t=((e,t,r=(()=>{}))=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[wa],(e=>{r(.8*e)})),s=this[Ba],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(va.error(e),new s)));ya.set(e,o)}await ya.get(e),Ea.set(e,!0),r&&r(1)}async load(e,t,r=(()=>{})){await this.preload(e,t,r);const s=await ya.get(e),o=await s.clone();return this[Ta].retain(e),o.dispose=()=>{this[Ta].release(e)},o}}CachingGLTFLoader[fa]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends Object3D{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 Vector2(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Ra=new three_module_Vector3,La=new three_module_Matrix4,Da=new three_module_Matrix4,Ua=new three_module_Vector3,Pa=new three_module_Vector3;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,r,s){if(e.isCSS2DObject){Ra.setFromMatrixPosition(e.matrixWorld),Ra.applyMatrix4(Da);const d=!0===e.visible&&Ra.z>=-1&&Ra.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(t,r,s);const c=e.element;c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Ra.x*o+o)+"px,"+(-Ra.y*l+l)+"px)",c.parentNode!==h&&h.appendChild(c),e.onAfterRender(t,r,s)}const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}function getDistanceToSquared(e,t){return Ua.setFromMatrixPosition(e.matrixWorld),Pa.setFromMatrixPosition(t.matrixWorld),Ua.distanceToSquared(Pa)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),La.copy(t.matrixWorldInverse),Da.multiplyMatrices(t.projectionMatrix,La),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,h.style.width=e+"px",h.style.height=t+"px"}}}r(5108);function reduceVertices(e,t,r){let s=r;const o=new three_module_Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:l}=r.attributes;if(void 0!==l)for(let r=0,c=l.count;r<c;r++)e.isMesh?e.getVertexPosition(r,o):o.fromBufferAttribute(l,r),e.isSkinnedMesh||o.applyMatrix4(e.matrixWorld),s=t(s,o)}})),s}let Fa,Na,Qa,Oa;function decompress(e,t=1/0,r=null){Na||(Na=new PlaneGeometry(2,2,1,1)),Qa||(Qa=new ShaderMaterial({uniforms:{blitTexture:new Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),Qa.uniforms.blitTexture.value=e,Qa.defines.IS_SRGB=e.colorSpace==ve,Qa.needsUpdate=!0,Oa||(Oa=new three_module_Mesh(Na,Qa),Oa.frustumCulled=!1);const s=new PerspectiveCamera,o=new Scene;o.add(Oa),null===r&&(r=Fa=new WebGLRenderer({antialias:!1}));const l=Math.min(e.image.width,t),c=Math.min(e.image.height,t);r.setSize(l,c),r.clear(),r.render(o,s);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=l,h.height=c,d.drawImage(r.domElement,0,0,l,c);const p=new CanvasTexture(h);return p.minFilter=e.minFilter,p.magFilter=e.magFilter,p.wrapS=e.wrapS,p.wrapT=e.wrapT,p.name=e.name,Fa&&(Fa.forceContextLoss(),Fa.dispose(),Fa=null),p}var ka=r(5108);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 GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.write(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Va=0,Ha=1,za=2,Wa=3,qa=4,ja=5120,Xa=5121,Ya=5122,Ka=5123,Ja=5124,$a=5125,Za=5126,eo=34962,to=34963,io=9728,no=9729,ro=9984,so=9985,ao=9986,oo=9987,lo=33071,co=33648,ho=10497,uo={};uo[x]=io,uo[1004]=ro,uo[1005]=ao,uo[1006]=no,uo[1007]=so,uo[1008]=oo,uo[1001]=lo,uo[1e3]=ho,uo[1002]=co;const po={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Ao=new Color;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}class GLTFWriter{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,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,h=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),p=Object.keys(c),A=Object.keys(h);if(p.length>0&&(l.extensionsUsed=p),A.length>0&&(l.extensionsRequired=A),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const p=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,p,!0);const A=new Blob([h,c,o,s,r],{type:"application/octet-stream"}),m=new FileReader;m.readAsArrayBuffer(A),m.onloadend=function(){t(m.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){ka.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new three_module_Vector3;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).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 r=e.clone(),s=new three_module_Vector3;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===ve?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}ka.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof CompressedTexture&&(e=decompress(e)),t instanceof CompressedTexture&&(t=decompress(t));const r=e?e.image:null,s=t?t.image:null,o=Math.max(r?r.width:0,s?s.width:0),l=Math.max(r?r.height:0,s?s.height:0),c=getCanvas();c.width=o,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,o,l);const d=h.getImageData(0,0,o,l);if(r){h.drawImage(r,0,0,o,l);const t=getEncodingConversion(e),s=h.getImageData(0,0,o,l).data;for(let e=2;e<s.length;e+=4)d.data[e]=256*t(s[e]/256)}if(s){h.drawImage(s,0,0,o,l);const e=getEncodingConversion(t),r=h.getImageData(0,0,o,l).data;for(let t=1;t<r.length;t+=4)d.data[t]=256*e(r[t]/256)}h.putImageData(d,0,0);const p=(e||t).clone();return p.source=new Source(c),p.colorSpace=_e,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&ka.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,o){const l=this.json;let c;switch(l.bufferViews||(l.bufferViews=[]),t){case ja:case Xa:c=1;break;case Ya:case Ka:c=2;break;default:c=4}let h=e.itemSize*c;o===eo&&(h=4*Math.ceil(h/4));const d=getPaddedBufferSize(s*h),p=new DataView(new ArrayBuffer(d));let A=0;for(let o=r;o<r+s;o++){for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[o*e.itemSize+r]:(0===r?s=e.getX(o):1===r?s=e.getY(o):2===r?s=e.getZ(o):3===r&&(s=e.getW(o)),!0===e.normalized&&(s=Fe.normalize(s,e.array))),t===Za?p.setFloat32(A,s,!0):t===Ja?p.setInt32(A,s,!0):t===$a?p.setUint32(A,s,!0):t===Ya?p.setInt16(A,s,!0):t===Ka?p.setUint16(A,s,!0):t===ja?p.setInt8(A,s):t===Xa&&p.setUint8(A,s),A+=c}A%h!=0&&(A+=h-A%h)}const m={buffer:this.processBuffer(p.buffer),byteOffset:this.byteOffset,byteLength:d};void 0!==o&&(m.target=o),o===eo&&(m.byteStride=h),this.byteOffset+=d,l.bufferViews.push(m);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const o=this.json;let l;if(e.array.constructor===Float32Array)l=Za;else if(e.array.constructor===Int32Array)l=Ja;else if(e.array.constructor===Uint32Array)l=$a;else if(e.array.constructor===Int16Array)l=Ya;else if(e.array.constructor===Uint16Array)l=Ka;else if(e.array.constructor===Int8Array)l=ja;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=Xa}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const c=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let o=t;o<t+r;o++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[o*e.itemSize+t]:(0===t?r=e.getX(o):1===t?r=e.getY(o):2===t?r=e.getZ(o):3===t&&(r=e.getW(o)),!0===e.normalized&&(r=Fe.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let h;void 0!==t&&(h=e===t.index?to:eo);const d=this.processBufferView(e,l,r,s,h),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const o=this,l=o.cache,c=o.json,h=o.options,d=o.pending;l.images.has(e)||l.images.set(e,{});const p=l.images.get(e),A=s+":flipY/"+r.toString();if(void 0!==p[A])return p[A];c.images||(c.images=[]);const m={mimeType:s},g=getCanvas();g.width=Math.min(e.width,h.maxTextureSize),g.height=Math.min(e.height,h.maxTextureSize);const f=g.getContext("2d");if(!0===r&&(f.translate(0,g.height),f.scale(1,-1)),void 0!==e.data){t!==W&&ka.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>h.maxTextureSize||e.height>h.maxTextureSize)&&ka.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];f.putImageData(new ImageData(r,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");f.drawImage(e,0,0,g.width,g.height)}!0===h.binary?d.push(getToBlobPromise(g,s).then((e=>o.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==g.toDataURL?m.uri=g.toDataURL(s):d.push(getToBlobPromise(g,s).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const _=c.images.push(m)-1;return p[A]=_,_}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 r={magFilter:uo[e.magFilter],minFilter:uo[e.minFilter],wrapS:uo[e.wrapS],wrapT:uo[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof CompressedTexture&&(e=decompress(e,t.maxTextureSize));let o=e.userData.mimeType;"image/webp"===o&&(o="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const c=s.textures.push(l)-1;return r.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return ka.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&ka.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(equalArray(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),r={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),2===e.side&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,s)}));const l=r.materials.push(s)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const l=e.geometry;let c;c=e.isLineSegments?Ha:e.isLineLoop?za:e.isLine?Wa:e.isPoints?Va:e.material.wireframe?Ha:qa;const h={},d={},p=[],A=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||this.isNormalizedNormalAttribute(g)||(ka.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(g)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const r=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){d[e]=t.attributes.get(this.getUID(r));continue}f=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array||(ka.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new three_module_BufferAttribute(new Uint16Array(s),r.itemSize,r.normalized));const o=this.processAccessor(f||r,l);null!==o&&(e.startsWith("_")||this.detectMeshQuantization(e,r),d[e]=o,t.attributes.set(this.getUID(r),o))}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let c=0;c<e.morphTargetInfluences.length;++c){const h={};let d=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){d||(ka.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=l.morphAttributes[e][c],s=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(r,!0))){h[s]=t.attributes.get(this.getUID(r,!0));continue}const p=r.clone();if(!l.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&p.setX(e,r.getX(e)-o.getX(e)),1===t&&p.setY(e,r.getY(e)-o.getY(e)),2===t&&p.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&p.setW(e,r.getW(e)-o.getW(e));h[s]=this.processAccessor(p,l),t.attributes.set(this.getUID(o,!0),h[s])}A.push(h),r.push(e.morphTargetInfluences[c]),void 0!==e.morphTargetDictionary&&s.push(o[c])}h.weights=r,s.length>0&&(h.extras={},h.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===l.groups.length)return null;let y=!1;if(_&&null===l.index){const e=[];for(let t=0,r=l.attributes.position.count;t<r;t++)e[t]=t;l.setIndex(e),y=!0}const E=_?e.material:[e.material],x=_?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=x.length;e<r;e++){const r={mode:c,attributes:d};if(this.serializeUserData(l,r),A.length>0&&(r.targets=A),null!==l.index){let s=this.getUID(l.index);void 0===x[e].start&&void 0===x[e].count||(s+=":"+x[e].start+":"+x[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(l.index,l,x[e].start,x[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=this.processMaterial(E[x[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===y&&l.setIndex(null),h.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)}));const C=r.meshes.push(h)-1;return t.meshes.set(o,C),C}detectMeshQuantization(e,t){if(this.extensionsUsed.KHR_mesh_quantization)return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];Ga[s]&&Ga[s].includes(r)&&(this.extensionsUsed.KHR_mesh_quantization=!0,this.extensionsRequired.KHR_mesh_quantization=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:Fe.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const o=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],c=[];for(let e=0;e<o.length;++e){const r=o[e],h=PropertyBinding.parseTrackName(r.name);let d=PropertyBinding.findNode(t,h.nodeName);const p=po[h.propertyName];if("bones"===h.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(h.objectIndex):void 0),!d||!p)return ka.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name),null;const A=1;let m,g=r.values.length/r.times.length;p===po.morphTargetInfluences&&(g/=d.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",g/=3):m=r.getInterpolation()===ue?"STEP":"LINEAR",c.push({input:this.processAccessor(new three_module_BufferAttribute(r.times,A)),output:this.processAccessor(new three_module_BufferAttribute(r.values,g)),interpolation:m}),l.push({sampler:c.length-1,target:{node:s.get(d),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:c,channels:l}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const c=[],h=new Float32Array(16*o.bones.length),d=new three_module_Matrix4;for(let t=0;t<o.bones.length;++t)c.push(r.get(o.bones[t])),d.copy(o.boneInverses[t]),d.multiply(e.bindMatrix).toArray(h,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new three_module_BufferAttribute(h,16)),joints:c,skeleton:r.get(l)});return s.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=this.processNode(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof Scene?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void ka.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&ka.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||ka.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(Ao)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,o=new Float32Array(3*s.count),l=new Float32Array(4*s.count),c=new Float32Array(3*s.count),h=new three_module_Matrix4,d=new three_module_Vector3,p=new three_module_Quaternion,A=new three_module_Vector3;for(let e=0;e<s.count;e++)s.getMatrixAt(e,h),h.decompose(d,p,A),d.toArray(o,3*e),p.toArray(l,4*e),A.toArray(c,3*e);const m={TRANSLATION:r.processAccessor(new three_module_BufferAttribute(o,3)),ROTATION:r.processAccessor(new three_module_BufferAttribute(l,4)),SCALE:r.processAccessor(new three_module_BufferAttribute(c,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),h=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),h=d+1;break}}return e.times=o,e.values=l,h},mergeMorphTargetTracks:function(e,t){const r=[],s={},o=e.tracks;for(let e=0;e<o.length;++e){let l=o[e];const c=PropertyBinding.parseTrackName(l.name),h=PropertyBinding.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){r.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");ka.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(de)}const d=h.morphTargetInfluences.length,p=h.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);let A;if(void 0===s[h.uuid]){A=l.clone();const e=new A.ValueBufferType(d*A.times.length);for(let t=0;t<A.times.length;t++)e[t*d+p]=A.values[t];A.name=(c.nodeName||"")+".morphTargetInfluences",A.values=e,s[h.uuid]=A,r.push(A);continue}const m=l.createInterpolant(new l.ValueBufferType(1));A=s[h.uuid];for(let e=0;e<A.times.length;e++)A.values[e*d+p]=m.evaluate(A.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(A,l.times[e]);A.values[t*d+p]=l.values[e]}}return e.tracks=r,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const p=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)p>=0&&(e.material=p),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,r,s,o){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new WebGLCubeRenderTarget(16);e.environment=r.texture;const s=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.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 r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends three_module_Group{constructor(e,t=!0){super(),this.lightProbe=new LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,h=l+r*c,d=Math.exp(-this.naturalFrequency*r),p=(c-this.naturalFrequency*h)*d,A=-this.naturalFrequency*(p+c*d);return Math.abs(p)<o*Math.abs(s)&&A*l>=0?(this.velocity=0,t):(this.velocity=p,t+h*d)}}const mo=.2,go=Math.PI/24,fo=new Vector2,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+mo*Math.cos(s),r+mo*Math.sin(s),0),s+=go};class PlacementBox extends three_module_Mesh{constructor(e,t){const r=new three_module_BufferGeometry,s=[],o=[],{size:l,boundingBox:c}=e,h=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(o,h,d),addCorner(o,-h,d),addCorner(o,-h,-d),addCorner(o,h,-d);const p=o.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const A=p-2;s.push(A,A+1,1,A,1,0),r.setAttribute("position",new three_module_Float32BufferAttribute(o,3)),r.setIndex(s),super(r),this.side=t;const m=this.material;switch(m.side=2,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new three_module_Mesh(new PlaneGeometry(2*(h+mo),2*(d+mo))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),c.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=c.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=c.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){fo.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(fo,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75: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:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),_o=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=vo(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),vo=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=yo(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?xo(s):Eo(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),yo=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),Eo=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let h=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(h.length);return null==h||r.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:h}],remainingInput:d}}})(),xo=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=vo(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Mo=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Mo]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[Mo].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const Co=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},So=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=Co)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var Io,bo,wo;const To=Symbol("evaluate"),Bo=Symbol("lastValue");class Evaluator{constructor(){this[Io]=null}static evaluatableFor(e,t=Co){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Co}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=So(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[Bo]||(this[Bo]=this[To]()),this[Bo]}}Io=Bo;const Ro=Symbol("percentage"),Lo=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[Ro]=e,this[Lo]=t}get isConstant(){return!0}[To](){return numberNode(this[Ro].number/100*this[Lo].number,this[Lo].unit)}}const Do=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[bo]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Do]=t)}get isConstant(){return!1}[(bo=Do,To)](){if(null!=this[Do]&&"window-scroll-y"===this[Do].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Co}}const Uo=/[\*\/]/,Po=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Co){if(super(),this[wo]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Uo.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[Po]=s[0])}get isConstant(){return null==this[Po]||Evaluator.isConstant(this[Po])}[(wo=Po,To)](){return null!=this[Po]?Evaluator.evaluate(this[Po]):Co}}const Fo=Symbol("operator"),No=Symbol("left"),Qo=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[Fo]=e,this[No]=t,this[Qo]=r}get isConstant(){return Evaluator.isConstant(this[No])&&Evaluator.isConstant(this[Qo])}[To](){const e=So(Evaluator.evaluate(this[No])),t=So(Evaluator.evaluate(this[Qo])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return Co;const c=s||l;let h;switch(this[Fo].value){case"+":h=r+o;break;case"-":h=r-o;break;case"/":h=r/o;break;case"*":h=r*o;break;default:return Co}return{type:"number",number:h,unit:c}}}const Oo=Symbol("evaluatables"),ko=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[ko]=t;const r=e[0],s=null!=r?r.terms:[];this[Oo]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[Oo])if(!Evaluator.isConstant(e))return!1;return!0}[To](){const e=this[Oo].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[ko]).map((e=>e.number))}}var Go,Vo,Ho,zo;const Wo=Symbol("instances"),qo=Symbol("activateListener"),jo=Symbol("deactivateListener"),Xo=Symbol("notifyInstances"),Yo=Symbol("notify"),Ko=Symbol("callback");class ScrollObserver{constructor(e){this[Ko]=e}static[Xo](){for(const e of ScrollObserver[Wo])e[Yo]()}static[(Go=Wo,qo)](){window.addEventListener("scroll",this[Xo],{passive:!0})}static[jo](){window.removeEventListener("scroll",this[Xo])}observe(){0===ScrollObserver[Wo].size&&ScrollObserver[qo](),ScrollObserver[Wo].add(this)}disconnect(){ScrollObserver[Wo].delete(this),0===ScrollObserver[Wo].size&&ScrollObserver[jo]()}[Yo](){this[Ko]()}}ScrollObserver[Go]=new Set;const Jo=Symbol("computeStyleCallback"),$o=Symbol("astWalker"),Zo=Symbol("dependencies"),el=Symbol("onScroll");class StyleEffector{constructor(e){this[Vo]={},this[Ho]=new ASTWalker(["function"]),this[zo]=()=>{this[Jo]({relatedState:"window-scroll"})},this[Jo]=e}observeEffectsFor(e){const t={},r=this[Zo];this[$o].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[el]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[Zo]=t}dispose(){for(const e in this[Zo]){this[Zo][e].disconnect()}}}Vo=Zo,Ho=$o,zo=el;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,h=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),p=Symbol(`${o}StyleEvaluator`),A=Symbol(`${o}UpdateEvaluator`),m=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[p]:{value:null,writable:!0},[A]:{value:function(){const e=_o(this[o]);this[p]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[m]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[p])return;const t=this[p].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[A](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:h}=l,d=l.ease||easeInOutQuad,p=interpolate(s,c,d);t.push(p),r.push(h),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=utilities_clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var tl=r(5108),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const il=timeline({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}]}),nl=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),rl="0deg 75deg 105%",sl=["front","right","back","left"],al=["upper-","","lower-"],ol="auto",ll="basic",cl="wiggle",hl="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),ul=(()=>{const e=_o(rl)[0].terms,t=So(e[0]),r=So(e[1]);return e=>{const s=e[sd].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[sd].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=ul(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[sd].boundingBox.getCenter(new three_module_Vector3);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},dl=Math.PI/2,pl=Math.PI/3,Al=dl/2,ml=2*Math.PI,gl=Symbol("controls"),fl=Symbol("panElement"),_l=Symbol("promptElement"),vl=Symbol("promptAnimatedContainer"),yl=Symbol("fingerAnimatedContainers"),El=Symbol("deferInteractionPrompt"),xl=Symbol("updateAria"),Ml=Symbol("a11y"),Cl=Symbol("updateA11y"),Sl=Symbol("updateCameraForRadius"),Il=Symbol("cancelPrompts"),bl=Symbol("onChange"),wl=Symbol("onPointerChange"),Tl=Symbol("waitingToPromptUser"),Bl=Symbol("userHasInteracted"),Rl=Symbol("promptElementVisibleTime"),Ll=Symbol("lastPromptOffset"),Dl=Symbol("cancellationSource"),Ul=Symbol("lastSpherical"),Pl=Symbol("jumpCamera"),Fl=Symbol("initialized"),Nl=Symbol("maintainThetaPhi"),Ql=Symbol("syncCameraOrbit"),Ol=Symbol("syncFieldOfView"),kl=Symbol("syncCameraTarget"),Gl=Symbol("syncMinCameraOrbit"),Vl=Symbol("syncMaxCameraOrbit"),Hl=Symbol("syncMinFieldOfView"),zl=Symbol("syncMaxFieldOfView"),Wl=new Vector2,ql=new three_module_Vector3,jl=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"}),Xl=Math.PI/8,Yl=.04,Kl={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends EventDispatcher{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Kl.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Matrix3,this.panPerPixel=0,this.spherical=new Spherical,this.goalSpherical=new Spherical,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(jl.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=Yl*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===Kl.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Kl.AUTOMATIC:Kl.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Kl.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Kl.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Kl.AUTOMATIC:Kl.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=Kl.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[fl].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Kl.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*Yl*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Kl.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},jl),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){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(!0===this._interactionEnabled){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,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Spherical){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=0===t?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,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:h,maximumRadius:d}=this._options,{theta:p,phi:A,radius:m}=this.goalSpherical,g=utilities_clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-g)+g);const f=utilities_clamp(t,l,c),_=utilities_clamp(r,h,d);return(g!==p||f!==A||_!==m)&&(!!(isFinite(g)&&isFinite(f)&&isFinite(_))&&(this.goalSpherical.theta=g,this.goalSpherical.phi=f,this.goalSpherical.radius=_,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=utilities_clamp(e,t,r),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,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:h,minimumFieldOfView:d,maximumFieldOfView:p}=this._options,A=this.spherical.theta-s,m=Math.PI-.001,g=s-utilities_clamp(e,-m-A,m-A),f=o-t,_=0===r?0:((r>0?h:c)-l)/(Math.log(r>0?p:d)-this.goalLogFov),y=l+r*(isFinite(_)?_:2*(h-c));if(this.setOrbit(g,f,y),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*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,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),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&&"none"!==t?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 Euler(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,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,h=l-s;return Math.sqrt(c*c+h*h)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=ql.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Wl.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=ql.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),h=c.dot(t.position.sub(r));r.add(c.multiplyScalar(h)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?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&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[fl].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[fl].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Yl*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Xl,0);break;case"ArrowDown":this.userAdjustOrbit(0,Xl,0);break;case"ArrowLeft":this.userAdjustOrbit(-Xl,0,0);break;case"ArrowRight":this.userAdjustOrbit(Xl,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var Jl=r(5108);const $l="not-presenting",Zl="session-started",ec="object-placed",tc="failed",ic="tracking",nc="not-tracking",rc=new three_module_Vector3,sc=new three_module_Matrix4,ac=new three_module_Vector3,oc=new PerspectiveCamera(45,1,.1,100);class ARRenderer extends EventDispatcher{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 three_module_Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new three_module_Vector3,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new three_module_Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/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(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-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 assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Jl.warn("Request to present in WebXR denied:"),Jl.warn(e),Jl.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Jl.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.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 c=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Zl})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Jl.warn("Error while trying to end WebXR AR session"),Jl.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){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;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(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 r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[Ms],e[Cs]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[cd](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Kl.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:$l})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(oc),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:h}=r.getCameraOrbit(),d=s.getWorldDirection(rc);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(h)),this.updateTarget();const p=e.getTarget();t.add(p).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:A}=this.frame;A.addEventListener("selectstart",this.onSelectStart),A.addEventListener("selectend",this.onSelectEnd),A.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(rc.copy(t).sub(this.presentedScene.getCamera().position),rc.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=sc.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?ac.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:ec}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>.7692307692307692?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=rc.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,h=this.placementBox;let d=Kl.NONE;if(!l.equals(r)||this.goalScale!==c){d=Kl.USER_INTERACTION;let{x:s,y:p,z:A}=r;s=this.xDamper.update(s,l.x,e,o),p=this.yDamper.update(p,l.y,e,o),A=this.zDamper.update(A,l.z,e,o),r.set(s,p,A);const m=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){const e=l.y-p;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:nc}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:ic}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const cc=Symbol("prepared"),hc=Symbol("prepare"),uc=Symbol("preparedGLTF"),dc=Symbol("clone");class GLTFInstance{constructor(e){this[uc]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[cc])return e;const t=this[hc](e);return t[cc]=!0,t}static[hc](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[uc].parser}get animations(){return this[uc].animations}get scene(){return this[uc].scene}get scenes(){return this[uc].scenes}get cameras(){return this[uc].cameras}get asset(){return this[uc].asset}get userData(){return this[uc].userData}clone(){return new(0,this.constructor)(this[dc]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof Texture){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[dc](){const e=this[uc],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},pc=Symbol("threeGLTF"),Ac=Symbol("gltf"),mc=Symbol("gltfElementMap"),gc=Symbol("threeObjectMap"),fc=Symbol("parallelTraverseThreeScene"),_c=Symbol("correlateOriginalThreeGLTF"),vc=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[pc]=e,this[Ac]=t,this[mc]=s,this[gc]=r}static from(e,t){return null!=t?this[vc](e,t):this[_c](e)}static[_c](e){const t=e.parser.json,r=e.parser.associations,s=new Map,o={name:"Default"},l={type:"materials",index:-1};for(const e of r.keys())e instanceof Material&&null==r.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(o)),e.name=o.name,r.set(e,{materials:l.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let h=s.get(c);null==h&&(h=new Set,s.set(c,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[vc](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[fc](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,h=s[t],d=o[t][h],p=l.get(r)||{};p[t]=h,l.set(r,p);const A=c.get(d)||new Set;A.add(r),c.set(d,A)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[fc](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[pc]}get gltf(){return this[Ac]}get gltfElementMap(){return this[mc]}get threeObjectMap(){return this[gc]}}const yc=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[hc](e){const t=super[hc](e);null==t[yc]&&(t[yc]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new Sphere(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const o=r.material;if(!0===o.isMeshBasicMaterial&&(o.toneMapped=!1),o.shadowSide=0,o.aoMap){const{gltf:r,threeObjectMap:s}=t[yc],l=s.get(o);if(null!=r.materials&&null!=l&&null!=l.materials){const t=r.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[uc][yc]}[dc](){const e=super[dc](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[yc]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var Ec=r(5108);const getBufferForType=(e,t,r)=>{let s;switch(e){case B:s=new Uint8ClampedArray(t*r*4);break;case O:s=new Uint16Array(t*r*4);break;case F:s=new Uint32Array(t*r*4);break;case 1010:s=new Int8Array(t*r*4);break;case 1011:s=new Int16Array(t*r*4);break;case U:s=new Int32Array(t*r*4);break;case Q:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let xc;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,o,l,c,h,p,A,m,g,f,_,E,x,C;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const S={format:W,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter:I,minFilter:void 0!==(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter)?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.minFilter:I,samples:void 0!==(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.samples)?null===(m=e.renderTargetOptions)||void 0===m?void 0:m.samples:void 0,wrapS:void 0!==(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:y,wrapT:void 0!==(null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:y};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Scene,this._camera=new OrthographicCamera,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(),!((e,t,r,s)=>{if(void 0!==xc)return xc;const o=new WebGLRenderTarget(1,1,s);t.setRenderTarget(o);const l=new three_module_Mesh(new PlaneGeometry,new MeshBasicMaterial({color:16777215}));t.render(l,r),t.setRenderTarget(null);const c=getBufferForType(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),l.geometry.dispose(),l.material.dispose(),xc=0!==c[0],xc})(this._type,this._renderer,this._camera,S)){let e;if(this._type===O)e=this._renderer.extensions.has("EXT_color_buffer_float")?Q:void 0;void 0!==e?(Ec.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,Ec.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new three_module_Mesh(new PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new WebGLRenderTarget(this.width,this.height,S),this._renderTarget.texture.mapping=void 0!==(null===(x=e.renderTargetOptions)||void 0===x?void 0:x.mapping)?null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping:d}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(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 DataTexture(this.toArray(),this.width,this.height,W,this._type,(null==e?void 0:e.mapping)||d,(null==e?void 0:e.wrapS)||y,(null==e?void 0:e.wrapT)||y,(null==e?void 0:e.magFilter)||I,(null==e?void 0:e.minFilter)||I,(null==e?void 0:e.anisotropy)||1,ye);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),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 ShaderMaterial&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof Texture&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof Texture&&e.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}}var Mc=r(5108);class GainMapDecoderMaterial extends ShaderMaterial{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:d,gainMap:p}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:p},gamma:{value:new three_module_Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new three_module_Vector3).fromArray(t)},offsetSdr:{value:(new three_module_Vector3).fromArray(r)},gainMapMin:{value:(new three_module_Vector3).fromArray(s)},gainMapMax:{value:(new three_module_Vector3).fromArray(o)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,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 GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,h=2,d=0;for(;h<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(h))return void r(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(c=o.getUint8(h+1),s&&Mc.log(`Marker: ${c.toString(16)}`),226===c){s&&Mc.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const h=s+c,d=o.getUint16(h,!l),p=h+2;let A=0;for(let e=p;e<p+12*d;e+=12)45057===o.getUint16(e,!l)&&(A=o.getUint32(e+8,!l));const m=h+2+12*d+4,g=[];for(let e=m;e<m+16*A;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([o]),r=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let A=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;A||(A="0");const m=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!m)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(p)?p.map((e=>parseFloat(e))):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(A),hdrCapacityMax:parseFloat(m)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends Loader{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new LoadingManager}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({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 Texture,sdr:new Texture});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:O,colorSpace:ye,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const o=s?new Blob([s],{type:"image/jpeg"}):void 0,l=new Blob([r],{type:"image/jpeg"});let c,h,p=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([o?getHTMLImageFromBlob(o):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);h=e[0],c=e[1],p=!0}else{const e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);h=e[0],c=e[1]}const A=new Texture(h||new ImageData(2,2),d,y,y,I,1008,W,B,1,ye);A.flipY=p,A.needsUpdate=!0;const m=new Texture(c,d,y,y,I,1008,W,B,1,ve);m.flipY=p,m.needsUpdate=!0,e.width=c.width,e.height=c.height,e.material.gainMap=A,e.material.sdr=m,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 HDRJPGLoader extends LoaderBase{load(e,t,r,s){const o=this.prepareQuadRenderer(),l=new three_module_FileLoader(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(r);let c,h,d;try{const e=await extractGainmapFromJPEG(l);c=e.sdr,h=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Mc.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={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}try{await this.render(o,d,c,h)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void o.disposeOnDemandRenderer()}"function"==typeof t&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),o}}class RGBELoader extends DataTextureLoader{constructor(e){super(e),this.type=O}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=h.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=h,l+=h.length,s+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=ri.toHalfFloat(Math.min(e[t+0]*l,65504)),r[s+1]=ri.toHalfFloat(Math.min(e[t+1]*l,65504)),r[s+2]=ri.toHalfFloat(Math.min(e[t+2]*l,65504)),r[s+3]=ri.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,h;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(h=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=h[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((h=c.match(t))&&(l.gamma=parseFloat(h[1])),(h=c.match(r))&&(l.exposure=parseFloat(h[1])),(h=c.match(s))&&(l.valid|=2,l.format=h[1]),(h=c.match(o))&&(l.valid|=4,l.height=parseInt(h[1],10),l.width=parseInt(h[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,o=r.height,l=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const h=4*s,d=new Uint8Array(4),p=new Uint8Array(h);let A=r;for(;A>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<h&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>h)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)p[r++]=s}else p.set(e.subarray(c,c+t),r),r+=t,c+=t}const m=s;for(let e=0;e<m;e++){let t=0;o[l]=p[e+t],t+=s,o[l+1]=p[e+t],t+=s,o[l+2]=p[e+t],t+=s,o[l+3]=p[e+t],l+=4}A--}return o}(t.subarray(t.pos),s,o);let c,h,d;switch(this.type){case Q:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);c=e,h=Q;break;case O:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);c=t,h=O;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:o,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case Q:case O:e.colorSpace=ye,e.minFilter=I,e.magFilter=I,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const Cc={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]}]},Sc={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 EnvironmentScene extends Scene{constructor(e){super(),this.position.y=-3.5;const t=new BoxGeometry;t.deleteAttribute("uv");const r=new MeshStandardMaterial({metalness:0,side:1}),s=new MeshStandardMaterial({metalness:0}),o="legacy"==e?Cc:Sc,l=new PointLight(16777215,o.topLight.intensity,28,2);l.position.set(...o.topLight.position),this.add(l);const c=new three_module_Mesh(t,r);c.position.set(...o.room.position),c.scale.set(...o.room.scale),this.add(c);for(const e of o.boxes){const r=new three_module_Mesh(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of o.lights){const r=new three_module_Mesh(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new MeshBasicMaterial;return t.color.setScalar(e),t}}var Ic=r(5108);const bc=20,wc=/\.hdr(\.js)?$/;class TextureUtils{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 null==this._ldrLoader&&(this._ldrLoader=new TextureLoader),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(O)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){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(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=(()=>{})){try{const r=wc.test(e),s=r?this.hdrLoader:this.imageLoader,o=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),o.name=e,o.mapping=m,r||(o.colorSpace=ve),o}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=(()=>{})){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,h]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:O,format:W,colorSpace:ye,depthBuffer:!0}),o=new CubeCamera(.1,100,s),l=o.renderTarget.texture;l.name=t;const c=r.outputColorSpace,h=r.toneMapping;return r.toneMapping=0,r.outputColorSpace=ye,o.update(r,e),this.blurCubemap(s,.04),r.toneMapping=h,r.outputColorSpace=c,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(bc);const e=new BoxGeometry,t=new three_module_Mesh(e,this.blurMaterial);this.blurScene=new Scene,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const o=e.width,l=isFinite(r)?Math.PI/(2*o):2*Math.PI/39,c=r/l,h=isFinite(r)?1+Math.floor(3*c):bc;h>bc&&Ic.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const d=[];let p=0;for(let e=0;e<bc;++e){const t=e/c,r=Math.exp(-t*t/2);d.push(r),0==e?p+=r:e<h&&(p+=2*r)}for(let e=0;e<d.length;e++)d[e]=d[e]/p;const A=this.blurMaterial.uniforms;A.envMap.value=e.texture,A.samples.value=h,A.weights.value=d,A.latitudinal.value="latitudinal"===s,A.dTheta.value=l;new CubeCamera(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var Tc=r(5108);const Bc=[1,.79,.62,.5,.4,.31,.25],Rc="high-performance";class Renderer extends EventDispatcher{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),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=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[Ss]()},this.dpr=Es(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new WebGLRenderer({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=4}catch(e){Tc.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.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 Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Rc,debug:xs()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Rc,debug:xs()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Bc[this.scaleStep]}set minScale(e){let t=1;for(;t<Bc.length&&!(Bc[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Vector2;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[rd]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=Es();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Wu](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=utilities_clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Bc[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*Bc[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=Bc[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):Tc.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:o,toneMapping:l}=e;s[od](t,r);const c="number"==typeof o&&!Number.isNaN(o),h=s.environmentImage,d=s.skyboxImage,p=7===l&&("neutral"===h||"legacy"===h||!h&&!d);this.threeRenderer.toneMappingExposure=(c?o:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&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}}const Lc=Symbol("correlatedObjects"),Dc=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Dc]=e,this[Lc]=t}}const Uc=new MeshBasicMaterial,Pc=new PlaneGeometry(2,2);let Fc=0;const Nc=Symbol("threeTexture"),Qc=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[Nc](){var e;return null===(e=this[Lc])||void 0===e?void 0:e.values().next().value}get[Qc](){return this[Lc]}constructor(e,t){super(e,new Set(t?[t]:[])),this[Nc].image.src||(this[Nc].image.src=t.name?t.name:"adhoc_image"+Fc++),this[Nc].image.name||(this[Nc].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[Nc].image.name||""}get uri(){return this[Nc].image.src}get bufferView(){return this[Nc].image.bufferView}get element(){const e=this[Nc];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Nc];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[Qc])t.image.name=e}update(){const e=this[Nc];e&&e.isCanvasTexture&&!e.animation&&(this[Nc].needsUpdate=!0,this[Dc]())}async createThumbnail(e,t){const r=new Scene;Uc.map=this[Nc];const s=new three_module_Mesh(Pc,Uc);r.add(s);const o=new OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,c=new WebGLRenderTarget(e,t);l.setRenderTarget(c),l.render(r,o),l.setRenderTarget(null);const h=new Uint8Array(e*t*4);l.readRenderTargetPixels(c,0,0,e,t,h),Pu.width=e,Pu.height=t;const d=Pu.getContext("2d"),p=d.createImageData(e,t);return p.data.set(h),d.putImageData(p,0,0),new Promise((async(e,t)=>{Pu.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var Oc,kc;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Oc||(Oc={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(kc||(kc={}));const Gc=new Map([[kc.Repeat,_],[kc.ClampToEdge,y],[kc.MirroredRepeat,E]]),Vc=new Map([[_,kc.Repeat],[y,kc.ClampToEdge],[E,kc.MirroredRepeat]]),Hc=new Map([[Oc.Nearest,x],[Oc.Linear,I],[Oc.NearestMipmapNearest,C],[Oc.LinearMipmapNearest,b],[Oc.NearestMipmapLinear,S],[Oc.LinearMipmapLinear,T]]),zc=new Map([[x,Oc.Nearest],[I,Oc.Linear],[C,Oc.NearestMipmapNearest],[b,Oc.LinearMipmapNearest],[S,Oc.NearestMipmapLinear],[T,Oc.LinearMipmapLinear]]),Wc=new Map([[Oc.Nearest,x],[Oc.Linear,I]]),qc=new Map([[x,Oc.Nearest],[I,Oc.Linear]]),isMinFilter=e=>zc.has(e),isMagFilter=e=>qc.has(e),isWrapping=e=>Vc.has(e),jc=Symbol("threeTexture"),Xc=Symbol("threeTextures"),Yc=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[jc](){var e;return null===(e=this[Lc])||void 0===e?void 0:e.values().next().value}get[Xc](){return this[Lc]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[jc].name||""}get minFilter(){return zc.get(this[jc].minFilter)}get magFilter(){return qc.get(this[jc].magFilter)}get wrapS(){return Vc.get(this[jc].wrapS)}get wrapT(){return Vc.get(this[jc].wrapT)}get rotation(){return this[jc].rotation}get scale(){return toVector2D(this[jc].repeat)}get offset(){return toVector2D(this[jc].offset)}setMinFilter(e){this[Yc]("minFilter",Hc.get(e))}setMagFilter(e){this[Yc]("magFilter",Wc.get(e))}setWrapS(e){this[Yc]("wrapS",Gc.get(e))}setWrapT(e){this[Yc]("wrapT",Gc.get(e))}setRotation(e){null==e&&(e=0),this[Yc]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[Yc]("repeat",new Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[Yc]("offset",new Vector2(e.u,e.v))}[Yc](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[Xc])r[e]=t,r.needsUpdate=!0;this[Dc]()}}const Kc=Symbol("image"),Jc=Symbol("sampler"),$c=Symbol("threeTexture");class texture_Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Jc]=new Sampler(e,t),this[Kc]=new image_Image(e,t)}get[$c](){var e;return null===(e=this[Lc])||void 0===e?void 0:e.values().next().value}get name(){return this[$c].name||""}set name(e){for(const t of this[Lc])t.name=e}get sampler(){return this[Jc]}get source(){return this[Kc]}}var Zc,eh,th;const ih=Symbol("texture"),nh=Symbol("transform"),rh=Symbol("materials"),sh=Symbol("usage"),ah=Symbol("onUpdate"),oh=Symbol("activeVideo");var lh;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(lh||(lh={}));class TextureInfo{constructor(e,t,r,s){this[Zc]=null,this[eh]={rotation:0,scale:new Vector2(1,1),offset:new Vector2(0,0)},this[th]=!1,r&&(this[nh].rotation=r.rotation,this[nh].scale.copy(r.repeat),this[nh].offset.copy(r.offset),this[ih]=new texture_Texture(e,r)),this[ah]=e,this[rh]=s,this[sh]=t}get texture(){return this[ih]}setTexture(e){var t,r;const s=null!=e?e.source[Nc]:null,o=null===(t=this[ih])||void 0===t?void 0:t.source[Nc];if(null!=o&&o.isVideoTexture?this[oh]=!1:(null===(r=this[ih])||void 0===r?void 0:r.source.animation)&&this[ih].source.animation.removeEventListener("enterFrame",this[ah]),this[ih]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[oh]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[oh]&&(this[ah](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[oh]&&(this[ah](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[ah]);let l=ve;if(this[rh])for(const e of this[rh]){switch(this[sh]){case lh.Base:e.map=s;break;case lh.MetallicRoughness:l=ye,e.metalnessMap=s,e.roughnessMap=s;break;case lh.Normal:l=ye,e.normalMap=s;break;case lh.Occlusion:l=ye,e.aoMap=s;break;case lh.Emissive:e.emissiveMap=s;break;case lh.Clearcoat:e.clearcoatMap=s;break;case lh.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case lh.ClearcoatNormal:e.clearcoatNormalMap=s;break;case lh.SheenColor:e.sheenColorMap=s;break;case lh.SheenRoughness:e.sheenRoughnessMap=s;break;case lh.Transmission:e.transmissionMap=s;break;case lh.Thickness:e.thicknessMap=s;break;case lh.Specular:e.specularIntensityMap=s;break;case lh.SpecularColor:e.specularColorMap=s;break;case lh.Iridescence:e.iridescenceMap=s;break;case lh.IridescenceThickness:e.iridescenceThicknessMap=s;break;case lh.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=l,s.rotation=this[nh].rotation,s.repeat=this[nh].scale,s.offset=this[nh].offset),this[ah]()}}Zc=ih,eh=nh,th=oh;const ch=Symbol("threeMaterial"),hh=Symbol("threeMaterials"),uh=Symbol("baseColorTexture"),dh=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[uh]=new TextureInfo(e,lh.Base,r,t),this[dh]=new TextureInfo(e,lh.MetallicRoughness,s,t)}get[hh](){return this[Lc]}get[ch](){var e;return null===(e=this[Lc])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[ch].opacity];return this[ch].color.toArray(e),e}get metallicFactor(){return this[ch].metalness}get roughnessFactor(){return this[ch].roughness}get baseColorTexture(){return this[uh]}get metallicRoughnessTexture(){return this[dh]}setBaseColorFactor(e){const t=new Color;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[hh])r.color.set(t),e instanceof Array&&e.length>3?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[Dc]()}setMetallicFactor(e){for(const t of this[hh])t.metalness=e;this[Dc]()}setRoughnessFactor(e){for(const t of this[hh])t.roughness=e;this[Dc]()}}var ph,Ah;const mh=Symbol("pbrMetallicRoughness"),gh=Symbol("normalTexture"),fh=Symbol("occlusionTexture"),_h=Symbol("emissiveTexture"),vh=Symbol("backingThreeMaterial"),yh=Symbol("applyAlphaCutoff"),Eh=Symbol("getAlphaMode"),xh=Symbol("lazyLoadGLTFInfo"),Mh=Symbol("initialize"),Ch=Symbol("getLoadedMaterial"),Sh=Symbol("ensureMaterialIsLoaded"),Ih=Symbol("gltfIndex"),bh=Symbol("setActive"),wh=Symbol("variantIndices"),Th=Symbol("isActive"),Bh=Symbol("variantSet"),Rh=Symbol("modelVariants"),Lh=Symbol("name"),Dh=Symbol("pbrTextures");class material_Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c){super(e,o),this[ph]=new Set,this[Ah]=new Map,this[Ih]=t,this[Th]=r,this[Rh]=s,this[Lh]=l,null==c?this[Mh]():this[xh]=c}get[(ph=Bh,Ah=Dh,vh)](){return this[Lc].values().next().value}[Mh](){const e=this[Dc],t=this[Lc];this[mh]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[gh]=new TextureInfo(e,lh.Normal,r,t),this[fh]=new TextureInfo(e,lh.Occlusion,s,t),this[_h]=new TextureInfo(e,lh.Emissive,o,t);const createTextureInfo=r=>{this[Dh].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(lh.Clearcoat),createTextureInfo(lh.ClearcoatRoughness),createTextureInfo(lh.ClearcoatNormal),createTextureInfo(lh.SheenColor),createTextureInfo(lh.SheenRoughness),createTextureInfo(lh.Transmission),createTextureInfo(lh.Thickness),createTextureInfo(lh.Specular),createTextureInfo(lh.SpecularColor),createTextureInfo(lh.Iridescence),createTextureInfo(lh.IridescenceThickness),createTextureInfo(lh.Anisotropy)}async[Ch](){if(null!=this[xh]){const{set:e,material:t}=await this[xh].doLazyLoad();return this[Lc]=e,this[Mh](),this[xh]=void 0,this.ensureLoaded=async()=>{},t}return this[Lc].values().next().value}colorFromRgb(e){const t=new Color;return e instanceof Array?t.fromArray(e):t.set(e),t}[Sh](){if(null!=this[xh])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Ch]()}get isLoaded(){return null==this[xh]}get isActive(){return this[Th]}[bh](e){this[Th]=e}get name(){return this[Lh]||""}set name(e){if(this[Lh]=e,null!=this[Lc])for(const t of this[Lc])t.name=e}get pbrMetallicRoughness(){return this[Sh](),this[mh]}get normalTexture(){return this[Sh](),this[gh]}get occlusionTexture(){return this[Sh](),this[fh]}get emissiveTexture(){return this[Sh](),this[_h]}get emissiveFactor(){return this[Sh](),this[vh].emissive.toArray()}get index(){return this[Ih]}[wh](){return this[Bh]}hasVariant(e){const t=this[Rh].get(e);return null!=t&&this[Bh].has(t.index)}setEmissiveFactor(e){this[Sh]();const t=this.colorFromRgb(e);for(const e of this[Lc])e.emissive.set(t);this[Dc]()}[Eh](){return this[vh].transparent?"BLEND":this[vh].alphaTest>0?"MASK":"OPAQUE"}[yh](){this[Sh]();for(const e of this[Lc])"MASK"===this[Eh]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Sh]();for(const t of this[Lc])t.alphaTest=e,t.needsUpdate=!0;this[yh](),this[Dc]()}getAlphaCutoff(){return this[Sh](),this[vh].alphaTest}setDoubleSided(e){this[Sh]();for(const t of this[Lc])t.side=e?2:0,t.needsUpdate=!0;this[Dc]()}getDoubleSided(){return this[Sh](),2==this[vh].side}setAlphaMode(e){this[Sh]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Lc])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Dc]()}getAlphaMode(){return this[Sh](),this[Eh]()}get emissiveStrength(){return this[Sh](),this[vh].emissiveIntensity}setEmissiveStrength(e){this[Sh]();for(const t of this[Lc])t.emissiveIntensity=e;this[Dc]()}get clearcoatFactor(){return this[Sh](),this[vh].clearcoat}get clearcoatRoughnessFactor(){return this[Sh](),this[vh].clearcoatRoughness}get clearcoatTexture(){return this[Sh](),this[Dh].get(lh.Clearcoat)}get clearcoatRoughnessTexture(){return this[Sh](),this[Dh].get(lh.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Sh](),this[Dh].get(lh.ClearcoatNormal)}get clearcoatNormalScale(){return this[Sh](),this[vh].clearcoatNormalScale.x}setClearcoatFactor(e){this[Sh]();for(const t of this[Lc])t.clearcoat=e;this[Dc]()}setClearcoatRoughnessFactor(e){this[Sh]();for(const t of this[Lc])t.clearcoatRoughness=e;this[Dc]()}setClearcoatNormalScale(e){this[Sh]();for(const t of this[Lc])t.clearcoatNormalScale=new Vector2(e,e);this[Dc]()}get ior(){return this[Sh](),this[vh].ior}setIor(e){this[Sh]();for(const t of this[Lc])t.ior=e;this[Dc]()}get sheenColorFactor(){return this[Sh](),this[vh].sheenColor.toArray()}get sheenColorTexture(){return this[Sh](),this[Dh].get(lh.SheenColor)}get sheenRoughnessFactor(){return this[Sh](),this[vh].sheenRoughness}get sheenRoughnessTexture(){return this[Sh](),this[Dh].get(lh.SheenRoughness)}setSheenColorFactor(e){this[Sh]();const t=this.colorFromRgb(e);for(const e of this[Lc])e.sheenColor.set(t),e.sheen=1;this[Dc]()}setSheenRoughnessFactor(e){this[Sh]();for(const t of this[Lc])t.sheenRoughness=e,t.sheen=1;this[Dc]()}get transmissionFactor(){return this[Sh](),this[vh].transmission}get transmissionTexture(){return this[Sh](),this[Dh].get(lh.Transmission)}setTransmissionFactor(e){this[Sh]();for(const t of this[Lc])t.transmission=e;this[Dc]()}get thicknessFactor(){return this[Sh](),this[vh].thickness}get thicknessTexture(){return this[Sh](),this[Dh].get(lh.Thickness)}get attenuationDistance(){return this[Sh](),this[vh].attenuationDistance}get attenuationColor(){return this[Sh](),this[vh].attenuationColor.toArray()}setThicknessFactor(e){this[Sh]();for(const t of this[Lc])t.thickness=e;this[Dc]()}setAttenuationDistance(e){this[Sh]();for(const t of this[Lc])t.attenuationDistance=e;this[Dc]()}setAttenuationColor(e){this[Sh]();const t=this.colorFromRgb(e);for(const e of this[Lc])e.attenuationColor.set(t);this[Dc]()}get specularFactor(){return this[Sh](),this[vh].specularIntensity}get specularTexture(){return this[Sh](),this[Dh].get(lh.Specular)}get specularColorFactor(){return this[Sh](),this[vh].specularColor.toArray()}get specularColorTexture(){return this[Sh](),this[Dh].get(lh.SheenColor)}setSpecularFactor(e){this[Sh]();for(const t of this[Lc])t.specularIntensity=e;this[Dc]()}setSpecularColorFactor(e){this[Sh]();const t=this.colorFromRgb(e);for(const e of this[Lc])e.specularColor.set(t);this[Dc]()}get iridescenceFactor(){return this[Sh](),this[vh].iridescence}get iridescenceTexture(){return this[Sh](),this[Dh].get(lh.Iridescence)}get iridescenceIor(){return this[Sh](),this[vh].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Sh](),this[vh].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Sh](),this[vh].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Sh](),this[Dh].get(lh.IridescenceThickness)}setIridescenceFactor(e){this[Sh]();for(const t of this[Lc])t.iridescence=e;this[Dc]()}setIridescenceIor(e){this[Sh]();for(const t of this[Lc])t.iridescenceIOR=e;this[Dc]()}setIridescenceThicknessMinimum(e){this[Sh]();for(const t of this[Lc])t.iridescenceThicknessRange[0]=e;this[Dc]()}setIridescenceThicknessMaximum(e){this[Sh]();for(const t of this[Lc])t.iridescenceThicknessRange[1]=e;this[Dc]()}get anisotropyStrength(){return this[Sh](),this[vh].anisotropy}get anisotropyRotation(){return this[Sh](),this[vh].anisotropyRotation}get anisotropyTexture(){return this[Sh](),this[Dh].get(lh.Anisotropy)}setAnisotropyStrength(e){this[Sh]();for(const t of this[Lc])t.anisotropy=e;this[Dc]()}setAnisotropyRotation(e){this[Sh]();for(const t of this[Lc])t.anisotropyRotation=e;this[Dc]()}}var Uh=r(5108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const h=c.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:Uh.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void Uh.error("Mesh is missing primitive index association");const p=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=p){if(null!=p.material)this.materials.set(p.material,t[p.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):Uh.warn("gltfPrimitive has no material!")}if(p.extensions&&p.extensions.KHR_materials_variants){const e=p.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[wh]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else Uh.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[Ch]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&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(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}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 r=this.modelVariants.get(t).index;return e[wh]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[wh]().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[Lc].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(Uh.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Ph,Fh,Nh,Qh,Oh,kh,Gh=r(5108);const Vh=Symbol("materials"),Hh=Symbol("hierarchy"),zh=Symbol("roots"),Wh=Symbol("primitives"),qh=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),jh=Symbol("switchVariant"),Xh=Symbol("materialFromPoint"),Yh=Symbol("nodeFromPoint"),Kh=Symbol("nodeFromIndex"),Jh=Symbol("variantData"),$h=Symbol("availableVariants"),Zh=Symbol("modelOnUpdate"),eu=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=(()=>{})){this[Ph]=new Array,this[Fh]=new Array,this[Nh]=new Array,this[Qh]=new Array,this[Oh]=()=>{},this[kh]=new Map,this[Zh]=t;const{gltf:r,threeGLTF:s,gltfElementMap:o}=e;for(const[e,l]of r.materials.entries()){const c=o.get(l);if(null!=c)this[Vh].push(new material_Material(t,e,!0,this[Jh],c,l.name));else{const h=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return o.set(h,t),t.add(e),{set:t,material:e}};this[Vh].push(new material_Material(t,e,!1,this[Jh],c,l.name,new LazyLoader(r,o,h,materialLoadCallback)))}}const l=new Map,c=new Array;for(const e of s.scene.children)c.push(e);for(;c.length>0;){const t=c.pop();let r=null;t instanceof three_module_Mesh?(r=new PrimitiveNode(t,this.materials,this[Jh],e),this[Wh].push(r)):r=new primitive_node_Node(t.name);const s=l.get(t);null!=s?s.children.push(r):this[zh].push(r),this[Hh].push(r);for(const e of t.children)c.push(e),l.set(t,r)}}get materials(){return this[Vh]}[(Ph=Vh,Fh=Hh,Nh=zh,Qh=Wh,Oh=Zh,kh=Jh,$h)](){const e=Array.from(this[Jh].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Vh].filter((t=>t.name===e));return t.length>0?t[0]:null}[Kh](e,t){const r=this[Hh].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[Yh](e){return this[Hh].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[Xh](e){return this[Yh](e).getActiveMaterial()}async[jh](e){for(const t of this[Wh])await t.enableVariant(e);for(const e of this.materials)e[bh](!1);for(const e of this[Wh])this.materials[e.getActiveMaterial().index][bh](!0)}async[qh](){const e=new Array;for(const t of this[Wh])e.push(t.instantiateVariants());await Promise.all(e)}[eu](e,t){const r=this.materials[e];r.isLoaded||Gh.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[Lc],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new material_Material(this[Zh],this[Vh].length,!1,this[Jh],o,t);return this[Vh].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[Wh]){const l=this[Jh].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[eu](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[bh](!0),this.materials[e][bh](!1);for(const e of this[Wh])e.enableVariant(r)}return o}createVariant(e){this[Jh].has(e)?Gh.warn(`Variant '${e}'' already exists`):this[Jh].set(e,{name:e,index:this[Jh].size})}hasVariant(e){return this[Jh].has(e)}setMaterialToVariant(e,t){if(null!=this[$h]().find((e=>e===t)))if(e<0||e>=this.materials.length)Gh.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[Wh]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else Gh.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[Jh].get(e);null!=r&&(r.name=t,this[Jh].set(t,r),this[Jh].delete(e))}deleteVariant(e){const t=this[Jh].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[Bh].delete(t.index);for(const e of this[Wh])e.deleteVariant(t.index);this[Jh].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const tu=Symbol("currentGLTF"),iu=Symbol("originalGltfJson"),nu=Symbol("model"),ru=Symbol("getOnUpdateMethod"),su=Symbol("buildTexture");class GroundedSkybox extends three_module_Mesh{constructor(){super(void 0,new MeshBasicMaterial({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&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new SphereGeometry(t,2*r,r);s.scale(1,1,-1);const o=s.getAttribute("position"),l=new three_module_Vector3;for(let t=0;t<o.count;++t)if(l.fromBufferAttribute(o,t),l.y<0){const r=3*-e/2,s=l.y<r?-e/l.y:1-l.y*l.y/(3*r*r);l.multiplyScalar(s),l.toArray(o.array,3*t)}return o.needsUpdate=!0,s}(e,t,r)))}}const au=new three_module_Vector3,ou=new three_module_Vector3,lu=new three_module_Vector3,cu=new Matrix3,hu=new Triangle,uu=new three_module_Quaternion;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new three_module_Vector3(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,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=_o(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,So(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=_o(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,au),t.getVertexPosition(r.y,ou),t.getVertexPosition(r.z,lu),au.toArray(cu.elements,0),ou.toArray(cu.elements,3),lu.toArray(cu.elements,6),this.position.copy(s).applyMatrix3(cu);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),hu.set(au,ou,lu),hu.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;uu.setFromAxisAngle(au.set(0,1,0),-l.yaw),this.normal.applyQuaternion(uu)}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 r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const du={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},pu={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};r(5108);Math.PI,Math.PI;function MathUtils_lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends Object3D{constructor(e,t,r){super(),this.camera=new OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new MeshDepthMaterial,this.horizontalBlurMaterial=new ShaderMaterial(du),this.verticalBlurMaterial=new ShaderMaterial(pu),this.intensity=0,this.softness=1,this.boundingBox=new Box3,this.size=new three_module_Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const o=new PlaneGeometry,l=new MeshBasicMaterial({opacity:1,transparent:!0,side:1});this.floor=new three_module_Mesh(o,l),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new three_module_Mesh(o),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.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,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=MathUtils_lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),o=10+r,l=10+s;if(null==this.renderTarget||this.renderTarget.width===o&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:W};this.renderTarget=new WebGLRenderTarget(o,l,e),this.renderTargetBlur=new WebGLRenderTarget(o,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*MathUtils_lerp(.3,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 r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&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()}}var Au=r(5108);const mu=new three_module_Vector3,gu=new three_module_Vector3,fu=new three_module_Vector3,_u=new class Raycaster{constructor(e,t,r=0,s=1/0){this.ray=new Ray(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new Layers,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):o.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Er.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Er),this}intersectObject(e,t=!0,r=[]){return intersect(e,this,r,t),r.sort(ascSort),r}intersectObjects(e,t=!0,r=[]){for(let s=0,o=e.length;s<o;s++)intersect(e[s],this,r,t);return r.sort(ascSort),r}},vu=new three_module_Vector3,yu=new Vector2;class ModelScene extends Scene{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,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 PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Object3D,this.animationNames=[],this.boundingBox=new Box3,this.boundingSphere=new Sphere,this.size=new three_module_Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=4,this.canScale=!0,this.isDirty=!1,this.goalTarget=new three_module_Vector3,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new three_module_AnimationMixer(this.target);const{domElement:o}=this.annotationRenderer,{style:l}=o;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(o),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?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)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[hd].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,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(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[tu]=null,this.element[iu]=null,this.element[nu]=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,null!=this.externalRenderer){const r=Es();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(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 Box3;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(vu),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new Box3;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=_o(this.element.orientation)[0].terms,r=So(t[0]).number,s=So(t[1]).number,o=So(t[2]).number;e.quaternion.setFromEuler(new Euler(s,o,r,"YXZ"));const l=_o(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new Box3),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new Box3)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)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());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),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(null!=this.xrCamera)yu.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();yu.set((e-r.x)/this.width,(t-r.y)/this.height)}return yu.multiplyScalar(2).subScalar(1),yu.y*=-1,yu}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[hd].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*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=_o(this.element.skyboxHeight)[0].terms[0],t=So(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-c,this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}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(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===he&&1==(1&e)?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 null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=2201,s=1/0){if(null==this._currentGLTF)return;const{animations:o}=this;if(null==o||0===o.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<o.length&&(l=o[t])}null==l&&(l=o[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){Au.error(e)}}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(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){_u.setFromCamera(e,this.getCamera());return _u.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new Matrix3).getNormalMatrix(s.object.matrixWorld)):_u.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const o=r[Yh](s),{meshes:l,primitives:c}=o.mesh.userData.associations,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,{a:A,b:m,c:g}=s.face,f=s.object;f.getVertexPosition(A,h),f.getVertexPosition(m,d),f.getVertexPosition(g,p);const _=new Triangle(h,d,p),y=new three_module_Vector3;return _.getBarycoord(f.worldToLocal(s.point),y),`${l} ${c} ${A} ${m} ${g} ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${y.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 r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=_o(e.surface)[0].terms;if(8!=t.length)return void Au.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[Kh](t[0].number,t[1].number),s=new three_module_Vector3(t[2].number,t[3].number,t[4].number);if(null==r)return void Au.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const o=r.mesh.geometry.attributes.position.count;if(s.x>=o||s.y>=o||s.z>=o)return void Au.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new three_module_Vector3(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{mu.copy(e),gu.setFromMatrixPosition(t.matrixWorld),mu.sub(gu),fu.copy(t.normal).transformDirection(this.target.matrixWorld),mu.dot(fu)<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:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(h),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker 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),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(utilities_clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var Eu,xu,Mu,Cu,Su,Iu,bu,wu,Tu,Bu,Ru,Lu,Du,Uu=r(5108),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Pu=document.createElement("canvas"),Fu=Symbol("fallbackResizeHandler"),Nu=Symbol("defaultAriaLabel"),Qu=Symbol("resizeObserver"),Ou=Symbol("clearModelTimeout"),ku=Symbol("onContextLost"),Gu=Symbol("loaded"),Vu=Symbol("status"),Hu=Symbol("onFocus"),zu=Symbol("onBlur"),Wu=Symbol("updateSize"),qu=Symbol("intersectionObserver"),ju=Symbol("isElementInViewport"),Xu=Symbol("announceModelVisibility"),Yu=Symbol("ariaLabel"),Ku=Symbol("altDefaulted"),Ju=Symbol("statusElement"),$u=Symbol("updateStatus"),Zu=Symbol("loadedTime"),ed=Symbol("updateSource"),td=Symbol("markLoaded"),id=Symbol("container"),nd=Symbol("input"),rd=Symbol("canvas"),sd=Symbol("scene"),ad=Symbol("needsRender"),od=Symbol("tick"),ld=Symbol("onModelLoad"),cd=Symbol("onResize"),hd=Symbol("renderer"),ud=Symbol("progressTracker"),dd=Symbol("getLoaded"),pd=Symbol("getModelIsVisible"),Ad=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends u{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Eu]=!1,this[xu]=!1,this[Mu]=0,this[Cu]="",this[Su]=null,this[Iu]=debounce((()=>{const e=this.getBoundingClientRect();this[Wu](e)}),50),this[bu]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[wu]=null,this[Tu]=null,this[Bu]=new ProgressTracker,this[Ru]=()=>{this[Ju].textContent=this[Vu]},this[Lu]=()=>{this[Ju].textContent=""},this[Du]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(bs,e)})(e),this[id]=e.querySelector(".container"),this[nd]=e.querySelector(".userInput"),this[rd]=e.querySelector("canvas"),this[Ju]=e.querySelector("#status"),this[Nu]=this[nd].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[sd]=new ModelScene({canvas:this[rd],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[Wu](this.getBoundingClientRect())})),hs&&(this[Qu]=new ResizeObserver((e=>{if(!this[hd].isPresenting)for(let t of e)t.target===this&&this[Wu](t.contentRect)}))),us?this[qu]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[ju]=t.isIntersecting,this[Xu](e),this[ju]&&!this.loaded&&this[ed]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[ju]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[Ta].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[Ta].evictionThreshold}static set minimumRenderScale(e){e>1&&Uu.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&Uu.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[dd]()}get[(Eu=ju,xu=Gu,Mu=Zu,Cu=Vu,Su=Ou,Iu=Fu,bu=Xu,wu=Qu,Tu=qu,Bu=ud,hd)](){return Renderer.singleton}get modelIsVisible(){return this[pd]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),hs?this[Qu].observe(this):self.addEventListener("resize",this[Fu]),us&&this[qu].observe(this),this.addEventListener("focus",this[Hu]),this.addEventListener("blur",this[zu]);const e=this[hd];e.addEventListener("contextlost",this[ku]),e.registerScene(this[sd]),null!=this[Ou]&&(self.clearTimeout(this[Ou]),this[Ou]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),hs?this[Qu].unobserve(this):self.removeEventListener("resize",this[Fu]),us&&this[qu].unobserve(this),this.removeEventListener("focus",this[Hu]),this.removeEventListener("blur",this[zu]);const e=this[hd];e.removeEventListener("contextlost",this[ku]),e.unregisterScene(this[sd]),this[Ou]=self.setTimeout((()=>{this[sd].dispose(),this[Ou]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Gu]=!1,this[Zu]=0,this[sd].reset()):this.src!==this[sd].url&&(this[Gu]=!1,this[Zu]=0,this[ed]())),e.has("alt")&&this[nd].setAttribute("aria-label",this[Yu]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[hd].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[sd].updateSchema(this.src):this[sd].updateSchema(null))}toDataURL(e,t){return this[hd].displayCanvas(this[sd]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:h}=this[sd],{dpr:d,scaleFactor:p}=this[hd];let A=o*p*d,m=l*p*d,g=0,f=0;if(!0===s)if(c>h){const e=m;m=Math.round(A/c),f=(e-m)/2}else{const e=A;A=Math.round(m*c),g=(e-A)/2}Pu.width=A,Pu.height=m;try{return new Promise((async(e,s)=>{Pu.getContext("2d").drawImage(this[hd].displayCanvas(this[sd]),g,f,A,m,0,0,A,m),Pu.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[Wu]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[hd].threeRenderer),e.setMainCamera(this[sd].getCamera()),e.setMainScene(this[sd]),this[sd].effectRenderer=e}unregisterEffectComposer(){this[sd].effectRenderer=null}registerRenderer(e){this[sd].externalRenderer=e}unregisterRenderer(){this[sd].externalRenderer=null}get[Yu](){return this[Ku]}get[Ku](){return null==this.alt||"null"===this.alt?this[Nu]:this.alt}[dd](){return this[Gu]}[pd](){return this.loaded&&this[ju]}[Ad](){return!!this.src&&this[ju]}[Wu]({width:e,height:t}){0!==e&&0!==t&&(this[id].style.width=`${e}px`,this[id].style.height=`${t}px`,this[cd]({width:e,height:t}))}[od](e,t){var r;null===(r=this[sd].effectRenderer)||void 0===r||r.beforeRender(e,t)}[td](){this[Gu]||(this[Gu]=!0,this[Zu]=performance.now())}[ad](){this[sd].queueRender()}[ld](){}[$u](e){this[Vu]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Ju].textContent!=e&&(this[Ju].textContent=e)}[(Ru=Hu,Lu=zu,cd)](e){this[sd].setSize(e.width,e.height)}async[(Du=ku,ed)](){const e=this[sd];if(this.loaded||!this[Ad]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[$u]("Loading"),e.stopAnimation();const t=this[ud].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*utilities_clamp(e,0,1)))),o=this[Ss]();await Promise.all([s,o]),this[td](),this[ld](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const md=Symbol("changeAnimation"),gd=Symbol("paused"),fd={repetitions:1/0,pingpong:!1},_d=Symbol("hotspotMap"),vd=Symbol("mutationCallback"),yd=Symbol("observer"),Ed=Symbol("addHotspot"),xd=Symbol("removeHotspot"),Md=new three_module_Matrix4;var Cd=Uint8Array,Sd=Uint16Array,Id=Int32Array,bd=new Cd([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]),wd=new Cd([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]),Td=new Cd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var r=new Sd(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];var o=new Id(r[30]);for(s=1;s<30;++s)for(var l=r[s];l<r[s+1];++l)o[l]=l-r[s]<<5|s;return{b:r,r:o}},Bd=freb(bd,2),Rd=Bd.b,Ld=Bd.r;Rd[28]=258,Ld[258]=28;for(var Dd=freb(wd,0),Ud=(Dd.b,Dd.r),Pd=new Sd(32768),Fd=0;Fd<32768;++Fd){var Nd=(43690&Fd)>>1|(21845&Fd)<<1;Nd=(61680&(Nd=(52428&Nd)>>2|(13107&Nd)<<2))>>4|(3855&Nd)<<4,Pd[Fd]=((65280&Nd)>>8|(255&Nd)<<8)>>1}var hMap=function(e,t,r){for(var s=e.length,o=0,l=new Sd(t);o<s;++o)e[o]&&++l[e[o]-1];var c,h=new Sd(t);for(o=1;o<t;++o)h[o]=h[o-1]+l[o-1]<<1;if(r){c=new Sd(1<<t);var d=15-t;for(o=0;o<s;++o)if(e[o])for(var p=o<<4|e[o],A=t-e[o],m=h[e[o]-1]++<<A,g=m|(1<<A)-1;m<=g;++m)c[Pd[m]>>d]=p}else for(c=new Sd(s),o=0;o<s;++o)e[o]&&(c[o]=Pd[h[e[o]-1]++]>>15-e[o]);return c},Qd=new Cd(288);for(Fd=0;Fd<144;++Fd)Qd[Fd]=8;for(Fd=144;Fd<256;++Fd)Qd[Fd]=9;for(Fd=256;Fd<280;++Fd)Qd[Fd]=7;for(Fd=280;Fd<288;++Fd)Qd[Fd]=8;var Od=new Cd(32);for(Fd=0;Fd<32;++Fd)Od[Fd]=5;var kd=hMap(Qd,9,0),Gd=hMap(Od,5,0),shft=function(e){return(e+7)/8|0},slc=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new Cd(e.subarray(t,r))},Vd=["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"],err=function(e,t,r){var s=new Error(t||Vd[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,err),!r)throw s;return s},wbits=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8},wbits16=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8,e[s+2]|=r>>16},hTree=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var o=r.length,l=r.slice();if(!o)return{t:zd,l:0};if(1==o){var c=new Cd(r[0].s+1);return c[r[0].s]=1,{t:c,l:1}}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var h=r[0],d=r[1],p=0,A=1,m=2;for(r[0]={s:-1,f:h.f+d.f,l:h,r:d};A!=o-1;)h=r[r[p].f<r[m].f?p++:m++],d=r[p!=A&&r[p].f<r[m].f?p++:m++],r[A++]={s:-1,f:h.f+d.f,l:h,r:d};var g=l[0].s;for(s=1;s<o;++s)l[s].s>g&&(g=l[s].s);var f=new Sd(g+1),_=fflate_module_ln(r[A-1],f,0);if(_>t){s=0;var y=0,E=_-t,x=1<<E;for(l.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));s<o;++s){var C=l[s].s;if(!(f[C]>t))break;y+=x-(1<<_-f[C]),f[C]=t}for(y>>=E;y>0;){var S=l[s].s;f[S]<t?y-=1<<t-f[S]++-1:++s}for(;s>=0&&y;--s){var I=l[s].s;f[I]==t&&(--f[I],++y)}_=t}return{t:new Cd(f),l:_}},fflate_module_ln=function(e,t,r){return-1==e.s?Math.max(fflate_module_ln(e.l,t,r+1),fflate_module_ln(e.r,t,r+1)):t[e.s]=r},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Sd(++t),s=0,o=e[0],l=1,w=function(e){r[s++]=e},c=1;c<=t;++c)if(e[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(o),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(o);l=1,o=e[c]}return{c:r.subarray(0,s),n:t}},clen=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},wfblk=function(e,t,r){var s=r.length,o=shft(t+2);e[o]=255&s,e[o+1]=s>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var l=0;l<s;++l)e[o+l+4]=r[l];return 8*(o+4+s)},wblk=function(e,t,r,s,o,l,c,h,d,p,A){wbits(t,A++,r),++o[256];for(var m=hTree(o,15),g=m.t,f=m.l,_=hTree(l,15),y=_.t,E=_.l,x=lc(g),C=x.c,S=x.n,I=lc(y),b=I.c,T=I.n,B=new Sd(19),U=0;U<C.length;++U)++B[31&C[U]];for(U=0;U<b.length;++U)++B[31&b[U]];for(var F=hTree(B,7),Q=F.t,O=F.l,G=19;G>4&&!Q[Td[G-1]];--G);var W,q,j,X,Y=p+5<<3,K=clen(o,Qd)+clen(l,Od)+c,J=clen(o,g)+clen(l,y)+c+14+3*G+clen(B,Q)+2*B[16]+3*B[17]+7*B[18];if(d>=0&&Y<=K&&Y<=J)return wfblk(t,A,e.subarray(d,d+p));if(wbits(t,A,1+(J<K)),A+=2,J<K){W=hMap(g,f,0),q=g,j=hMap(y,E,0),X=y;var $=hMap(Q,O,0);wbits(t,A,S-257),wbits(t,A+5,T-1),wbits(t,A+10,G-4),A+=14;for(U=0;U<G;++U)wbits(t,A+3*U,Q[Td[U]]);A+=3*G;for(var ee=[C,b],te=0;te<2;++te){var ie=ee[te];for(U=0;U<ie.length;++U){var ne=31&ie[U];wbits(t,A,$[ne]),A+=Q[ne],ne>15&&(wbits(t,A,ie[U]>>5&127),A+=ie[U]>>12)}}}else W=kd,q=Qd,j=Gd,X=Od;for(U=0;U<h;++U){var re=s[U];if(re>255){wbits16(t,A,W[(ne=re>>18&31)+257]),A+=q[ne+257],ne>7&&(wbits(t,A,re>>23&31),A+=bd[ne]);var se=31&re;wbits16(t,A,j[se]),A+=X[se],se>3&&(wbits16(t,A,re>>5&8191),A+=wd[se])}else wbits16(t,A,W[re]),A+=q[re]}return wbits16(t,A,W[256]),A+q[256]},Hd=new Id([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zd=new Cd(0),dflt=function(e,t,r,s,o,l){var c=l.z||e.length,h=new Cd(s+c+5*(1+Math.ceil(c/7e3))+o),d=h.subarray(s,h.length-o),p=l.l,A=7&(l.r||0);if(t){A&&(d[0]=l.r>>3);for(var m=Hd[t-1],g=m>>13,f=8191&m,_=(1<<r)-1,y=l.p||new Sd(32768),E=l.h||new Sd(_+1),x=Math.ceil(r/3),C=2*x,hsh=function(t){return(e[t]^e[t+1]<<x^e[t+2]<<C)&_},S=new Id(25e3),I=new Sd(288),b=new Sd(32),T=0,B=0,U=l.i||0,F=0,Q=l.w||0,O=0;U+2<c;++U){var G=hsh(U),W=32767&U,q=E[G];if(y[W]=q,E[G]=W,Q<=U){var j=c-U;if((T>7e3||F>24576)&&(j>423||!p)){A=wblk(e,d,0,S,I,b,B,F,O,U-O,A),F=T=B=0,O=U;for(var X=0;X<286;++X)I[X]=0;for(X=0;X<30;++X)b[X]=0}var Y=2,K=0,J=f,$=W-q&32767;if(j>2&&G==hsh(U-$))for(var ee=Math.min(g,j)-1,te=Math.min(32767,U),ie=Math.min(258,j);$<=te&&--J&&W!=q;){if(e[U+Y]==e[U+Y-$]){for(var ne=0;ne<ie&&e[U+ne]==e[U+ne-$];++ne);if(ne>Y){if(Y=ne,K=$,ne>ee)break;var re=Math.min($,ne-2),se=0;for(X=0;X<re;++X){var ae=U-$+X&32767,oe=ae-y[ae]&32767;oe>se&&(se=oe,q=ae)}}}$+=(W=q)-(q=y[W])&32767}if(K){S[F++]=268435456|Ld[Y]<<18|Ud[K];var le=31&Ld[Y],ce=31&Ud[K];B+=bd[le]+wd[ce],++I[257+le],++b[ce],Q=U+Y,++T}else S[F++]=e[U],++I[e[U]]}}for(U=Math.max(U,Q);U<c;++U)S[F++]=e[U],++I[e[U]];A=wblk(e,d,p,S,I,b,B,F,O,U-O,A),p||(l.r=7&A|d[A/8|0]<<3,A-=7,l.h=E,l.p=y,l.i=U,l.w=Q)}else{for(U=l.w||0;U<c+p;U+=65535){var he=U+65535;he>=c&&(d[A/8|0]=p,he=c),A=wfblk(d,A+1,e.subarray(U,he))}l.i=c}return slc(h,0,s+shft(A)+o)},Wd=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,s=9;--s;)r=(1&r&&-306674912)^r>>>1;e[t]=r}return e}(),crc=function(){var e=-1;return{p:function(t){for(var r=e,s=0;s<t.length;++s)r=Wd[255&r^t[s]]^r>>>8;e=r},d:function(){return~e}}},dopt=function(e,t,r,s,o){if(!o&&(o={l:1},t.dictionary)){var l=t.dictionary.subarray(-32768),c=new Cd(l.length+e.length);c.set(l),c.set(e,l.length),e=c,o.w=l.length}return dflt(e,null==t.level?6:t.level,null==t.mem?o.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,r,s,o)},mrg=function(e,t){var r={};for(var s in e)r[s]=e[s];for(var s in t)r[s]=t[s];return r},wbytes=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,r,s){for(var o in e){var l=e[o],c=t+o,h=s;Array.isArray(l)&&(h=mrg(s,l[1]),l=l[0]),l instanceof Cd?r[c]=[l,h]:(r[c+="/"]=[new Cd(0),h],fltn(l,c,r,s))}},qd="undefined"!=typeof TextEncoder&&new TextEncoder,jd="undefined"!=typeof TextDecoder&&new TextDecoder;try{jd.decode(zd,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var r=new Cd(e.length),s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r}if(qd)return qd.encode(e);var o=e.length,l=new Cd(e.length+(e.length>>1)),c=0,w=function(e){l[c++]=e};for(s=0;s<o;++s){if(c+5>l.length){var h=new Cd(c+8+(o-s<<1));h.set(l),l=h}var d=e.charCodeAt(s);d<128||t?w(d):d<2048?(w(192|d>>6),w(128|63&d)):d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++s))>>18),w(128|d>>12&63),w(128|d>>6&63),w(128|63&d)):(w(224|d>>12),w(128|d>>6&63),w(128|63&d))}return slc(l,0,c)}var exfl=function(e){var t=0;if(e)for(var r in e){var s=e[r].length;s>65535&&err(9),t+=s+4}return t},wzh=function(e,t,r,s,o,l,c,h){var d=s.length,p=r.extra,A=h&&h.length,m=exfl(p);wbytes(e,t,null!=c?33639248:67324752),t+=4,null!=c&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(l<0&&8),e[t++]=o&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var g=new Date(null==r.mtime?Date.now():r.mtime),f=g.getFullYear()-1980;if((f<0||f>119)&&err(10),wbytes(e,t,f<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),t+=4,-1!=l&&(wbytes(e,t,r.crc),wbytes(e,t+4,l<0?-l-2:l),wbytes(e,t+8,r.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=c&&(wbytes(e,t,A),wbytes(e,t+6,r.attrs),wbytes(e,t+10,c),t+=14),e.set(s,t),t+=d,m)for(var _ in p){var y=p[_],E=y.length;wbytes(e,t,+_),wbytes(e,t+2,E),e.set(y,t+4),t+=4+E}return A&&(e.set(h,t),t+=A),t},wzf=function(e,t,r,s,o){wbytes(e,t,101010256),wbytes(e,t+8,r),wbytes(e,t+10,r),wbytes(e,t+12,s),wbytes(e,t+16,o)};"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var Xd=r(5108);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const r={};r["model.usda"]=null;let s=buildHeader();s+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const o={},l={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,l=e.material;if(l.isMeshStandardMaterial){const c="geometries/Geometry_"+t.id+".usda";if(!(c in r)){const e=function buildMeshObject(e){return`\ndef "Geometry"\n{\n${function buildMesh(e){const t="Geometry",r=e.attributes,s=r.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,r=[];if(null!==t)for(let e=0;e<t.count;e++)r.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)r.push(e)}return r.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(r.normal,s)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(r.position,s)}]\n${function buildPrimvars(e){let t="";for(let r=0;r<4;r++){const s=r>0?r:"",o=e["uv"+s];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${s} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}const r=e.color;if(void 0!==r){t+=`\n\tcolor3f[] primvars:displayColor = [${buildVector3Array(r,r.count)}] (\n\t\tinterpolation = "vertex"\n\t\t)`}return t}(r)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e)}\n}\n`}(t);r[c]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}l.uuid in o||(o[l.uuid]=l),s+=function buildXform(e,t,r){const s="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Xd.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${s}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${r.id}>\n}\n\n`}(e,t,l)}else Xd.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(s+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,r=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Xd.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(7)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(7)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(7)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(7)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(7)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(7)}\n\t\t}\n\t\n\t`}(e))})),s+="\n\t\t}\n\t}\n}\n\n",s+=function buildMaterials(e,t,r=!1){const s=[];for(const o in e){const l=e[o];s.push(buildMaterial(l,t,r))}return`def "Materials"\n{\n${s.join("")}\n}\n\n`}(o,l,t.quickLookCompatible),r["model.usda"]=strToU8(s),s=null;for(const e in l){let s=l[e];!0===s.isCompressedTexture&&(s=decompress(s));const o=imageToCanvas(s.image,s.flipY,t.maxTextureSize),c=await new Promise((e=>o.toBlob(e,"image/png",1)));r[`textures/Texture_${e}.png`]=new Uint8Array(await c.arrayBuffer())}let c=0;for(const e in r){const t=r[e];c+=34+e.length;const s=63&c;if(4!==s){const o=new Uint8Array(64-s);r[e]=[t,{extra:{12345:o}}]}c=t.length}return function zipSync(e,t){t||(t={});var r={},s=[];fltn(e,"",r,t);var o=0,l=0;for(var c in r){var h=r[c],d=h[0],p=h[1],A=0==p.level?0:8,m=(B=strToU8(c)).length,g=p.comment,f=g&&strToU8(g),_=f&&f.length,y=exfl(p.extra);m>65535&&err(11);var E=A?deflateSync(d,p):d,x=E.length,C=crc();C.p(d),s.push(mrg(p,{size:d.length,crc:C.d(),c:E,f:B,m:f,u:m!=c.length||f&&g.length!=_,o,compression:A})),o+=30+m+y+x,l+=76+2*(m+y)+(_||0)+x}for(var S=new Cd(l+22),I=o,b=l-o,T=0;T<s.length;++T){var B=s[T];wzh(S,B.o,B,B.f,B.u,B.c.length);var U=30+B.f.length+exfl(B.extra);S.set(B.c,B.o+U),wzh(S,o,B,B.f,B.u,B.c.length,B.o,B.m),o+=16+U+(B.m?B.m.length:0)}return wzf(S,o,s.length,b,I),S}(r,{level:0})}}function imageToCanvas(e,t,r){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=r/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,s),o.height=e.height*Math.min(1,s);const l=o.getContext("2d");return!0===t&&(l.translate(0,o.height),l.scale(1,-1)),l.drawImage(e,0,0,o.width,o.height),o}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return Xd.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[];for(let t=0;t<e.count;t++){const s=e.getX(t),o=e.getY(t),l=e.getZ(t);r.push(`(${s.toPrecision(7)}, ${o.toPrecision(7)}, ${l.toPrecision(7)})`)}return r.join(", ")}function buildVector2Array(e){const t=[];for(let r=0;r<e.count;r++){const s=e.getX(r),o=e.getY(r);t.push(`(${s.toPrecision(7)}, ${1-o.toPrecision(7)})`)}return t.join(", ")}function buildMaterial(e,t,r=!1){const s=[],o=[];function buildTexture(s,o,l){const c=s.source.id+"_"+s.flipY;t[c]=s;const h=s.channel>0?"st"+s.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},p=s.repeat.clone(),A=s.offset.clone(),m=s.rotation,g=Math.sin(m),f=Math.cos(m);return A.y=1-A.y-p.y,r?(A.x=A.x/p.x,A.y=A.y/p.y,A.x+=g/p.x,A.y+=f-1):(A.x+=g*p.x,A.y+=(1-f)*p.y),`\n\t\tdef Shader "PrimvarReader_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${h}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${o}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(7)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(p)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(A)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${s.id}_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${c}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${o}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${s.colorSpace===_e?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[s.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[s.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return 2===e.side&&Xd.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(s.push(`\t\t\tcolor3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?s.push(`\t\t\tfloat inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(s.push(`\t\t\tfloat inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),s.push(`\t\t\tfloat inputs:opacityThreshold = ${e.alphaTest}`)),o.push(buildTexture(e.map,"diffuse",e.color))):s.push(`\t\t\tcolor3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(s.push(`\t\t\tcolor3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),o.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&s.push(`\t\t\tcolor3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(s.push(`\t\t\tnormal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),o.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(s.push(`\t\t\tfloat inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),o.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(s.push(`\t\t\tfloat inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),o.push(buildTexture(e.roughnessMap,"roughness"))):s.push(`\t\t\tfloat inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(s.push(`\t\t\tfloat inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),o.push(buildTexture(e.metalnessMap,"metallic"))):s.push(`\t\t\tfloat inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(s.push(`\t\t\tfloat inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),s.push("\t\t\tfloat inputs:opacityThreshold = 0.0001"),o.push(buildTexture(e.alphaMap,"opacity"))):s.push(`\t\t\tfloat inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(s.push(`\t\t\tfloat inputs:clearcoat = ${e.clearcoat}`),s.push(`\t\t\tfloat inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),s.push(`\t\t\tfloat inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${s.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${o.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var Yd=r(5108),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let Kd=!1,Jd=!1;const $d="#model-viewer-no-ar-fallback",Zd=(ep=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=_o(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>ep.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var ep;const tp="quick-look",ip="scene-viewer",np="webxr",rp="none",sp=Symbol("arButtonContainer"),ap=Symbol("enterARWithWebXR"),op=Symbol("openSceneViewer"),lp=Symbol("openIOSARQuickLook"),cp=Symbol("canActivateAR"),hp=Symbol("arMode"),up=Symbol("arModes"),dp=Symbol("arAnchor"),pp=Symbol("preload"),Ap=Symbol("onARButtonContainerClick"),mp=Symbol("onARStatus"),gp=Symbol("onARTracking"),fp=Symbol("onARTap"),_p=Symbol("selectARMode"),vp=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const yp="auto",Ep="auto",xp="eager",Mp=Symbol("defaultProgressBarElement"),Cp=Symbol("posterContainerElement"),Sp=Symbol("defaultPosterElement"),Ip=Symbol("shouldDismissPoster"),bp=Symbol("hidePoster"),wp=Symbol("modelIsRevealed"),Tp=Symbol("updateProgressBar"),Bp=Symbol("ariaLabelCallToAction"),Rp=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Lp=Math.PI/32,Dp={basis:[degreesToRadians(numberNode(Lp,"rad"))],keywords:{auto:[null]}},Up=Symbol("autoRotateStartTime"),Pp=Symbol("radiansPerSecond"),Fp=Symbol("syncRotationRate"),Np=Symbol("onCameraChange"),Qp=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Ed](e)})),e.removedNodes.forEach((e=>{this[xd](e)})),this[ad]())}))},this[s]=new MutationObserver(this[vd])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Ed](this.children[e]);const{ShadyDOM:e}=self;null==e?this[yd].observe(this,{childList:!0}):this[yd]=e.observeChildren(this,this[vd])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[yd].disconnect():e.unobserveChildren(this[yd])}[(t=_d,r=vd,s=yd,od)](e,t){super[od](e,t);const r=this[sd],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[_d].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[ad]())}queryHotspot(e){const t=this[_d].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),o=t.facingCamera,l=this[sd],c=l.getCamera(),h=new three_module_Vector3;h.setFromMatrixPosition(t.matrixWorld),h.project(c);const d=l.width/2,p=l.height/2;h.x=h.x*d+d,h.y=-h.y*p+p;const A=toVector3D(new three_module_Vector3(h.x,h.y,h.z));return Number.isFinite(A.x)&&Number.isFinite(A.y)?{position:r,normal:s,canvasPosition:A,facingCamera:o}:null}positionAndNormalFromPoint(e,t){const r=this[sd],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;Md.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(Md)),c=toVector3D(o.normal.transformDirection(Md));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:l,normal:c,uv:h}}surfaceFromPoint(e,t){const r=this[sd],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[Ed](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[_d].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[_d].set(e.slot,t),this[sd].addHotspot(t)),this[sd].queueRender()}[xd](e){if(!(e instanceof HTMLElement))return;const t=this[_d].get(e.slot);t&&(t.decrement()&&(this[sd].removeHotspot(t),this[_d].delete(e.slot)),this[sd].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[nu]}get availableVariants(){return this.model?this.model[$h]():[]}get originalGltfJson(){return this[iu]}[(t=nu,r=tu,s=iu,ru)](){return()=>{this[ad]()}}[su](e){return e.colorSpace=ve,e.wrapS=_,e.wrapT=_,new texture_Texture(this[ru](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[hd],s=await r.loadImage(e);return s.userData.mimeType=t,this[su](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[hd],s=await r.loadLottie(e,t);return this[su](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new VideoTexture(t);return this[su](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new CanvasTexture(e);return this[su](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[ud].beginActivity("variant-update");e(.1);const t=this[nu],{variantName:r}=this;null!=t&&(await t[jh](r),this[ad](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[sd];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[hd].arRenderer.onUpdateScene(),this[ad]()}}[ld](){super[ld]();const{currentGLTF:e}=this[sd];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[tu]&&(this[nu]=new Model(t,this[ru]()),this[iu]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[tu]=e}async exportScene(e){const t=this[sd];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[nu][qh]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[nu];if(null==r)return null;const s=this[sd],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[Xh](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[Up]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[Np]),this[Up]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[Np]),this[Up]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[Up]=performance.now())}[(t=Up,r=Pp,Fp)](e){this[Pp]=e[0]}[od](e,t){if(super[od](e,t),!this.autoRotate||!this[pd]()||this[hd].isPresenting)return;const r=Math.min(t,e-this[Up]-this.autoRotateDelay);r>0&&(this[sd].yaw=this.turntableRotation+this[Pp]*r*.001)}get turntableRotation(){return this[sd].yaw}resetTurntableRotation(e=0){this[sd].yaw=e}}return s=Np,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:Dp,updateHandler:Fp}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[sd].setShadowIntensity(.5*this.shadowIntensity),this[ad]()),e.has("shadowSoftness")&&(this[sd].setShadowSoftness(this.shadowSoftness),this[ad]()),e.has("exposure")&&(this[sd].exposure=this.exposure,this[ad]()),e.has("toneMapping")&&(this[sd].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?7:"agx"===this.toneMapping?6:4,this[ad]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Ad]()&&this[Ss](),e.has("skyboxHeight")&&(this[sd].setGroundedSkybox(),this[ad]())}hasBakedShadow(){return this[sd].bakedShadows.size>0}async[(t=Ms,r=Cs,s=Is,Ss)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Is]&&(this[Is](),this[Is]=null);const{textureUtils:r}=this[hd];if(null==r)return;const s=this[ud].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(utilities_clamp(e,0,1))));this[Ms]!==o&&(this[Ms]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[Cs]=null!=l?l.name===o.name?o:l:null,this[sd].setEnvironmentAndSkybox(this[Ms],this[Cs])}catch(e){if(e instanceof Error)throw this[sd].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A,m,g,f,_,y,E,x,C;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=rl,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=ol,this.interactionPromptStyle=cl,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=hl,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[o]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[c]=1/0,this[h]=!1,this[d]=!1,this[p]=Kl.AUTOMATIC,this[A]=new SmoothControls(this[sd].camera,this[nd],this[sd]),this[m]=new Spherical,this[g]=!1,this[f]=!1,this[_]=!1,this[y]={},this[E]=()=>{const e=this[gl].changeSource;this[Dl]=e,e===Kl.USER_INTERACTION&&(this[Bl]=!0,this[El]())},this[x]=()=>{this[xl](),this[ad]();const e=this[gl].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[C]=e=>{this[id].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[gl].inputSensitivity}set inputSensitivity(e){this[gl].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[Ul];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[hd].isPresenting?this[hd].arRenderer.target:this[sd].getTarget())}getFieldOfView(){return this[gl].getFieldOfView()}getMinimumFieldOfView(){return this[gl].options.minimumFieldOfView}getMaximumFieldOfView(){return this[gl].options.maximumFieldOfView}getIdealAspect(){return this[sd].idealAspect}jumpCameraToGoal(){this[Pl]=!0,this.requestUpdate(Pl,!1)}resetInteractionPrompt(){this[Ll]=0,this[Rl]=1/0,this[Bl]=!1,this[Tl]=this.interactionPrompt===ol&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[nd].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[gl].addEventListener("user-interaction",this[Il]),this[gl].addEventListener("pointer-change-start",this[wl]),this[gl].addEventListener("pointer-change-end",this[wl])}disconnectedCallback(){super.disconnectedCallback(),this[gl].removeEventListener("user-interaction",this[Il]),this[gl].removeEventListener("pointer-change-start",this[wl]),this[gl].removeEventListener("pointer-change-end",this[wl])}updated(e){super.updated(e);const t=this[gl],r=this[sd];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===ol&&(this[Tl]=!0)):(t.disableInteraction(),this[El]()),this[nd].setAttribute("aria-label",this[Yu])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===ol&&this.cameraControls&&!this[Bl]?this[Tl]=!0:this[El]()),e.has("interactionPromptStyle")&&(this[vl].style.opacity=this.interactionPromptStyle==ll?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[Cl](),!0===this[Pl]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[bl](),this[Pl]=!1}))}async updateFraming(){const e=this[sd],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[gl].getFieldOfView()/t;this[gl].setFieldOfView(r*s),this[Nl]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[nd],o=this[yl];if("1"===o[0].style.opacity)return void tl.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let h=performance.now();const{width:d,height:p}=this[sd],A=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${p*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+A.x,clientY:p*r.y+A.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Dl];if(t!==Kl.AUTOMATIC||!s.isConnected){for(const e of this[yl])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-h)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Kl.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Dl]=Kl.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=_l,r=vl,s=yl,o=fl,l=Ll,c=Rl,h=Bl,d=Tl,p=Dl,A=gl,m=Ul,g=Pl,f=Fl,_=Nl,y=Ml,Ol)](e){const t=this[gl],r=this[sd];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Kl.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[Il]()}[Ql](e){const t=this[gl];if(this[Nl]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[Nl]=!1}t.changeSource=Kl.NONE,t.setOrbit(e[0],e[1],e[2]),this[Il]()}[Gl](e){this[gl].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Vl](e){this[gl].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[Sl](e[2]),this.jumpCameraToGoal()}[Hl](e){this[gl].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[zl](e){const t=this[sd].adjustedFoV(180*e[0]/Math.PI);this[gl].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[kl](e){const[t,r,s]=e;this[hd].arRenderer.isPresenting||this[sd].setTarget(t,r,s),this[gl].changeSource=Kl.NONE,this[hd].arRenderer.updateTarget(),this[Il]()}[od](e,t){if(super[od](e,t),this[hd].isPresenting||!this[pd]())return;const r=this[gl],s=this[sd],o=performance.now();if(this[Tl]&&this.loaded&&o>this[Zu]+this.interactionPromptThreshold&&(this[Tl]=!1,this[Rl]=o,this[_l].classList.add("visible")),isFinite(this[Rl])&&this.interactionPromptStyle===cl){const e=(o-this[Rl])/5e3%1,t=il(e),l=nl(e);if(this[vl].style.opacity=`${l}`,t!==this[Ll]){const e=t*s.width*.05,o=(t-this[Ll])*Math.PI/16;this[vl].style.transform=`translateX(${e}px)`,r.changeSource=Kl.AUTOMATIC,r.adjustOrbit(o,0,0),this[Ll]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[bl]()}[El](){this[Tl]=!1,this[_l].classList.remove("visible"),this[Rl]=1/0}[Sl](e){const t=Math.max(this[sd].farRadius(),e),r=Math.abs(2*t);this[gl].updateNearFar(0,r)}[xl](){const{theta:e,phi:t}=this[gl].getCameraSpherical(this[Ul]),r=(4+Math.floor((e%ml+Al)/dl))%4,s=Math.floor(t/pl),o=`${al[s]}${sl[r]}`,l=o;l in this[Ml]?this[$u](this[Ml][l]):this[$u](`View from stage ${o}`)}get[Yu](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Ml]&&(e=`. ${this[Ml]["interaction-prompt"]}`),super[Yu].replace(/\.$/,"")+(this.cameraControls?e:"")}async[cd](e){const t=this[gl],r=this[sd],s=r.adjustedFoV(r.framedFoVDeg);super[cd](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[sd].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[gl].setFieldOfView(l),this.jumpCameraToGoal()}[ld](){super[ld](),this[Fl]?this[Nl]=!0:this[Fl]=!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()}[(E=Il,x=bl,C=wl,Cl)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Ml]=JSON.parse(this.a11y)}catch(e){tl.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?tl.warn("Error not supported format, should be a JSON string:",this.a11y):this[Ml]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Ml]=Object.assign({},this.a11y):this[Ml]={};this[nd].setAttribute("aria-label",this[Yu])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:ul,observeEffects:!0,updateHandler:Ql}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:kl}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Ol}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:Gl}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:Vl}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Hl}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:zl}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),controls_decorate([n()],ControlsModelViewerElement.prototype,"a11y",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=rp,this[c]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==$l&&this[hd].arRenderer.presentedScene!==this[sd]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===$l?this.removeAttribute("ar-tracking"):e===Zl&&this.setAttribute("ar-tracking",ic))},this[p]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[A]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[hp]!==rp}connectedCallback(){super.connectedCallback(),this[hd].arRenderer.addEventListener("status",this[mp]),this.setAttribute("ar-status",$l),this[hd].arRenderer.addEventListener("tracking",this[gp]),this[dp].addEventListener("message",this[fp])}disconnectedCallback(){super.disconnectedCallback(),this[hd].arRenderer.removeEventListener("status",this[mp]),this[hd].arRenderer.removeEventListener("tracking",this[gp]),this[dp].removeEventListener("message",this[fp])}update(e){super.update(e),e.has("arScale")&&(this[sd].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[sd].updateShadow(),this[ad]()),e.has("arModes")&&(this[up]=Zd(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[_p]()}async activateAR(){switch(this[hp]){case tp:await this[lp]();break;case np:await this[ap]();break;case ip:this[op]();break;default:Yd.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=cp,r=sp,s=dp,o=up,l=hp,c=pp,h=Ap,d=mp,p=gp,A=fp,_p)](){var e;let t=rp;if(this.ar){if(null!=this.src)for(const r of this[up]){if("webxr"===r&&ds&&!Kd&&await this[hd].arRenderer.supportsPresentation()){t=np;break}if("scene-viewer"===r&&!Jd&&(fs||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=ip;break}if("quick-look"===r&&vs){t=tp;break}}t===rp&&null!=this.iosSrc&&vs&&(t=tp)}if(t!==rp)this[sp].classList.add("enabled"),this[sp].addEventListener("click",this[Ap]);else if(this[sp].classList.contains("enabled")){this[sp].removeEventListener("click",this[Ap]),this[sp].classList.remove("enabled");const e=tc;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[hp]=t}async[ap](){Yd.log("Attempting to present in AR with WebXR..."),await this[vp]();try{this[sp].removeEventListener("click",this[Ap]);const{arRenderer:e}=this[hd];e.placeOnWall="wall"===this.arPlacement,await e.present(this[sd],this.xrEnvironment)}catch(e){Yd.warn("Error while trying to present in AR with WebXR"),Yd.error(e),await this[hd].arRenderer.stopPresenting(),Kd=!0,Yd.warn("Falling back to next ar-mode"),await this[_p](),this.activateAR()}finally{this[_p]()}}async[vp](){this.loaded||(this[pp]=!0,this[ed](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[pp]=!1)}[Ad](){return super[Ad]()||this[pp]}[op](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=$d,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.2?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===$d&&(Jd=!0,self.history.back(),Yd.warn("Error while trying to present in AR with Scene Viewer"),Yd.warn("Falling back to next ar-mode"),this[_p]())}),{once:!0}),this[dp].setAttribute("href",o),Yd.log("Attempting to present in AR with Scene Viewer..."),this[dp].click()}async[lp](){const e=!this.iosSrc;this[sp].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[dp];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),Yd.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[sp].classList.add("enabled")}async prepareUSDZ(){const e=this[ud].beginActivity("usdz-conversion");await this[vp]();const{model:t,shadow:r,target:s}=this[sd];if(null==t)return"";let o=!1;null!=r&&(o=r.visible,r.visible=!1),e(.2);const l=new USDZExporter;s.remove(t),t.position.copy(s.position),t.updateWorldMatrix(!1,!0);const c=await l.parse(t);t.position.set(0,0,0),s.add(t);const h=new Blob([c],{type:"model/vnd.usdz+zip"}),d=URL.createObjectURL(h);return e(1),null!=r&&(r.visible=o),d}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,o,l,c,h,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=yp,this.loading=Ep,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this[Sp].getAttribute("aria-label"),this[h]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[Mp].parentNode;requestAnimationFrame((()=>{this[Mp].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[Mp]),t.appendChild(this[Mp])),this[Mp].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress,r=e.detail.reason;1===t&&(this[Tp].flush(),this.loaded&&(this[Ip]||this.reveal===yp)&&this[bp]()),this[Tp](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:r}}))};const p=self.ModelViewerElement||{},A=p.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(A);const m=p.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),p.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(p.meshoptDecoderLocation);const g=p.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[wa].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[bp]():(this[Ip]=!0,this[ed]())}showPoster(){const e=this[Cp];if(e.classList.contains("show"))return;e.classList.add("show"),this[nd].classList.remove("show");const t=this[Sp];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[wp]=!1,this[Xu](r)}getDimensions(){return toVector3D(this[sd].size)}getBoundingBoxCenter(){return toVector3D(this[sd].boundingBox.getCenter(new three_module_Vector3))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[ud].addEventListener("progress",this[Rp])}disconnectedCallback(){super.disconnectedCallback(),this[ud].removeEventListener("progress",this[Rp])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[Sp].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[Sp].setAttribute("aria-label",this[Ku]),(e.has("reveal")||e.has("loading"))&&this[ed]()}[(t=wp,r=Ip,s=Cp,o=Sp,l=Mp,c=Bp,h=Tp,d=Rp,Ad)](){return!!this.src&&(this[Ip]||this.loading===xp||this.reveal===yp&&this[ju])}[bp](){this[Ip]=!1;const e=this[Cp];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[nd].classList.add("show");const t=this.modelIsVisible;this[wp]=!0,this[Xu](t);const r=this.getRootNode();r&&r.activeElement===this&&this[nd].focus();const s=this[Sp];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[pd](){return super[pd]()&&this[wp]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[sd].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[sd].subscribeMixerEvent("finished",(()=>{this[gd]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[sd].animationNames:[]}get duration(){return this[sd].duration}get paused(){return this[gd]}get currentTime(){return this[sd].animationTime}set currentTime(e){this[sd].animationTime=e,this[ad]()}get timeScale(){return this[sd].animationTimeScale}set timeScale(e){this[sd].animationTimeScale=e}pause(){this[gd]||(this[gd]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[gd]=!1,this[md](e),this.dispatchEvent(new CustomEvent("play")))}[(t=gd,ld)](){super[ld](),this[gd]=!0,null!=this.animationName&&this[md](),this.autoplay&&this.play()}[od](e,t){super[od](e,t),this[gd]||!this[pd]()&&!this[hd].isPresenting||(this[sd].updateAnimation(t/1e3),this[ad]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[md]()}[md](e=fd){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?he:1===r?2200:ce;this[sd].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[gd]&&(this[sd].updateAnimation(0),this[ad]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",Qp)}}]);
|