//////////////////////////////////////////////////////////////////////
// Pano2VR 7.1.10/21009 HTML5/CSS3 & WebGL Panorama Player          //
// License: Jim Michael                                             //
// (c) 2025, Garden Gnome Software, https://ggnome.com              //
//////////////////////////////////////////////////////////////////////

/*

 Copyright 2010-2023 Three.js Authors
 SPDX-License-Identifier: MIT
 Copyright 2005-2024 Garden Gnome GmbH.
 All rights reserved
*/
var vf="function"==typeof Object.defineProperties?Object.defineProperty:function(Vb,Kd,zd){if(Vb==Array.prototype||Vb==Object.prototype)return Vb;Vb[Kd]=zd.value;return Vb};function ig(Vb){Vb=["object"==typeof globalThis&&globalThis,Vb,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var Kd=0;Kd<Vb.length;++Kd){var zd=Vb[Kd];if(zd&&zd.Math==Math)return zd}throw Error("Cannot find global object");}var xg=ig(this);
function Vm(Vb,Kd){if(Kd)a:{var zd=xg;Vb=Vb.split(".");for(var fd=0;fd<Vb.length-1;fd++){var jd=Vb[fd];if(!(jd in zd))break a;zd=zd[jd]}Vb=Vb[Vb.length-1];fd=zd[Vb];Kd=Kd(fd);Kd!=fd&&null!=Kd&&vf(zd,Vb,{configurable:!0,writable:!0,value:Kd})}}function Vx(Vb){function Kd(fd){return Vb.next(fd)}function zd(fd){return Vb.throw(fd)}return new Promise(function(fd,jd){function kf(hg){hg.done?fd(hg.value):Promise.resolve(hg.value).then(Kd,zd).then(kf,jd)}kf(Vb.next())})}
function Wx(Vb){Vb=Math.trunc(Vb)||0;0>Vb&&(Vb+=this.length);if(!(0>Vb||Vb>=this.length))return this[Vb]}Vm("Array.prototype.at",function(Vb){return Vb?Vb:Wx});function Xx(Vb){return Vb?Vb:Wx}Vm("Int8Array.prototype.at",Xx);Vm("Uint8Array.prototype.at",Xx);Vm("Uint8ClampedArray.prototype.at",Xx);Vm("Int16Array.prototype.at",Xx);Vm("Uint16Array.prototype.at",Xx);Vm("Int32Array.prototype.at",Xx);Vm("Uint32Array.prototype.at",Xx);Vm("Float32Array.prototype.at",Xx);Vm("Float64Array.prototype.at",Xx);
Vm("String.prototype.at",function(Vb){return Vb?Vb:Wx});function Yx(Vb,Kd){Vb instanceof String&&(Vb+="");var zd=0,fd=!1,jd={next:function(){if(!fd&&zd<Vb.length){var kf=zd++;return{value:Kd(kf,Vb[kf]),done:!1}}fd=!0;return{done:!0,value:void 0}}};jd[Symbol.iterator]=function(){return jd};return jd}Vm("Array.prototype.values",function(Vb){return Vb?Vb:function(){return Yx(this,function(Kd,zd){return zd})}});
Vm("Array.prototype.includes",function(Vb){return Vb?Vb:function(Kd,zd){var fd=this;fd instanceof String&&(fd=String(fd));var jd=fd.length;zd=zd||0;for(0>zd&&(zd=Math.max(zd+jd,0));zd<jd;zd++){var kf=fd[zd];if(kf===Kd||Object.is(kf,Kd))return!0}return!1}});Vm("Promise.prototype.finally",function(Vb){return Vb?Vb:function(Kd){return this.then(function(zd){return Promise.resolve(Kd()).then(function(){return zd})},function(zd){return Promise.resolve(Kd()).then(function(){throw zd;})})}});
Vm("Object.values",function(Vb){return Vb?Vb:function(Kd){var zd=[],fd;for(fd in Kd)Object.prototype.hasOwnProperty.call(Kd,fd)&&zd.push(Kd[fd]);return zd}});
(()=>{function Vb(fd){var jd=zd[fd];if(void 0!==jd)return jd.exports;jd=zd[fd]={exports:{}};Kd[fd](jd,jd.exports,Vb);return jd.exports}var Kd={768:fd=>{fd.exports=function(){return!1}}},zd={};(()=>{Vb.n=fd=>{var jd=fd&&fd.__esModule?()=>fd["default"]:()=>fd;Vb.d(jd,{a:jd});return jd}})();(()=>{Vb.d=(fd,jd)=>{for(var kf in jd)Vb.Es(jd,kf)&&!Vb.Es(fd,kf)&&Object.defineProperty(fd,kf,{enumerable:!0,get:jd[kf]})}})();(()=>{Vb.Es=(fd,jd)=>Object.prototype.hasOwnProperty.call(fd,jd)})();(()=>{Vb.r=fd=>
{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(fd,Symbol.toStringTag,{value:"Module"});Object.defineProperty(fd,"__esModule",{value:!0})}})();(()=>{function fd(){const a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,e=4294967295*Math.random()|0,f=4294967295*Math.random()|0;return(of[a&255]+of[a>>8&255]+of[a>>16&255]+of[a>>24&255]+"-"+of[b&255]+of[b>>8&255]+"-"+of[b>>16&15|64]+of[b>>24&255]+"-"+of[e&63|128]+of[e>>8&255]+"-"+of[e>>16&255]+of[e>>24&255]+of[f&255]+of[f>>
8&255]+of[f>>16&255]+of[f>>24&255]).toLowerCase()}function jd(a,b,e){return Math.max(b,Math.min(e,a))}function kf(a,b){return(a%b+b)%b}function hg(a,b,e){return(1-e)*a+e*b}function wf(a,b){switch(b.constructor){case Float32Array:return a;case Uint32Array:return a/4294967295;case Uint16Array:return a/65535;case Uint8Array:return a/255;case Int32Array:return Math.max(a/2147483647,-1);case Int16Array:return Math.max(a/32767,-1);case Int8Array:return Math.max(a/127,-1);default:throw Error("Invalid component type.");
}}function kd(a,b){switch(b.constructor){case Float32Array:return a;case Uint32Array:return Math.round(4294967295*a);case Uint16Array:return Math.round(65535*a);case Uint8Array:return Math.round(255*a);case Int32Array:return Math.round(2147483647*a);case Int16Array:return Math.round(32767*a);case Int8Array:return Math.round(127*a);default:throw Error("Invalid component type.");}}function Nq(a){for(let b=a.length-1;0<=b;--b)if(65535<=a[b])return!0;return!1}function wj(a){return document.createElementNS("http://www.w3.org/1999/xhtml",
a)}function Oq(){const a=wj("canvas");a.style.display="block";return a}function xj(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function Wm(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function Xm(a){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return Pq.getDataURL(a);if(a.data)return{data:Array.from(a.data),
width:a.width,height:a.height,type:a.data.constructor.name};console.warn("THREE.Texture: Unable to serialize Texture.");return{}}function Ym(a,b,e,f,h){for(let n=0,r=a.length-3;n<=r;n+=3){Og.fromArray(a,n);const t=h.x*Math.abs(Og.x)+h.y*Math.abs(Og.y)+h.z*Math.abs(Og.z),w=b.dot(Og),x=e.dot(Og),y=f.dot(Og);if(Math.max(-Math.max(w,x,y),Math.min(w,x,y))>t)return!1}return!0}function Zm(a,b,e){0>e&&(e+=1);1<e&&--e;return e<1/6?a+6*(b-a)*e:.5>e?b:e<2/3?a+6*(b-a)*(2/3-e):a}function Bf(a){65504<Math.abs(a)&&
console.warn("THREE.DataUtils.toHalfFloat(): Value out of range.");a=jd(a,-65504,65504);jg.floatView[0]=a;a=jg.uint32View[0];const b=a>>23&511;return jg.baseTable[b]+((a&8388607)>>jg.shiftTable[b])}function fk(a){const b=a>>10;jg.uint32View[0]=jg.mantissaTable[jg.offsetTable[b]+(a&1023)]+jg.exponentTable[b];return jg.floatView[0]}function Ik(a,b,e,f,h,n,r,t,w,x){a.getVertexPosition(t,Pg);a.getVertexPosition(w,Qg);a.getVertexPosition(x,Rg);null===(1===b.side?f.intersectTriangle(Rg,Qg,Pg,!0,yj):f.intersectTriangle(Pg,
Qg,Rg,0===b.side,yj))?a=null:(Jk.copy(yj),Jk.applyMatrix4(a.matrixWorld),b=e.ray.origin.distanceTo(Jk),a=b<e.near||b>e.far?null:{distance:b,point:Jk.clone(),object:a});a&&(h&&(Kk.fromBufferAttribute(h,t),Lk.fromBufferAttribute(h,w),Mk.fromBufferAttribute(h,x),a.uv=Hf.getInterpolation(yj,Pg,Qg,Rg,Kk,Lk,Mk,new Lb)),n&&(Kk.fromBufferAttribute(n,t),Lk.fromBufferAttribute(n,w),Mk.fromBufferAttribute(n,x),a.uv1=Hf.getInterpolation(yj,Pg,Qg,Rg,Kk,Lk,Mk,new Lb)),r&&(Qq.fromBufferAttribute(r,t),Rq.fromBufferAttribute(r,
w),Sq.fromBufferAttribute(r,x),a.normal=Hf.getInterpolation(yj,Pg,Qg,Rg,Qq,Rq,Sq,new mb),0<a.normal.dot(f.direction)&&a.normal.multiplyScalar(-1)),f={a:t,b:w,c:x,normal:new mb,materialIndex:0},Hf.getNormal(Pg,Qg,Rg,f.normal),a.face=f);return a}function zj(a){const b={};for(const e in a){b[e]={};for(const f in a[e]){const h=a[e][f];h&&(h.isColor||h.isMatrix3||h.isMatrix4||h.isVector2||h.isVector3||h.isVector4||h.isTexture||h.isQuaternion)?h.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),
b[e][f]=null):b[e][f]=h.clone():b[e][f]=Array.isArray(h)?h.slice():h}}return b}function xf(a){const b={};for(let e=0;e<a.length;e++){const f=zj(a[e]);for(const h in f)b[h]=f[h]}return b}function Tq(a){const b=a.getRenderTarget();return null===b?a.outputColorSpace:!0===b.isXRRenderTarget?b.texture.colorSpace:Fd.workingColorSpace}function Uq(){function a(n,r){f(n,r);h=b.requestAnimationFrame(a)}let b=null,e=!1,f=null,h=null;return{start:function(){!0!==e&&null!==f&&(h=b.requestAnimationFrame(a),e=!0)},
stop:function(){b.cancelAnimationFrame(h);e=!1},setAnimationLoop:function(n){f=n},setContext:function(n){b=n}}}function Zx(a){const b=new WeakMap;return{get:function(e){e.isInterleavedBufferAttribute&&(e=e.data);return b.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const f=b.get(e);f&&(a.deleteBuffer(f.buffer),b.delete(e))},update:function(e,f){if(e.isGLBufferAttribute)f=b.get(e),(!f||f.version<e.version)&&b.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,
version:e.version});else{e.isInterleavedBufferAttribute&&(e=e.data);var h=b.get(e);if(void 0===h){h=b.set;var n=e,r=e.array,t=e.usage,w=r.byteLength,x=a.createBuffer();a.bindBuffer(f,x);a.bufferData(f,r,t);e.onUploadCallback();if(r instanceof Float32Array)f=a.FLOAT;else if(r instanceof Uint16Array)f=e.isFloat16BufferAttribute?a.HALF_FLOAT:a.UNSIGNED_SHORT;else if(r instanceof Int16Array)f=a.SHORT;else if(r instanceof Uint32Array)f=a.UNSIGNED_INT;else if(r instanceof Int32Array)f=a.INT;else if(r instanceof
Int8Array)f=a.BYTE;else if(r instanceof Uint8Array)f=a.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)f=a.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);h.call(b,n,{buffer:x,type:f,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,size:w})}else if(h.version<e.version){if(h.size!==e.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");
n=e;r=n.array;w=n._updateRange;x=n.updateRanges;a.bindBuffer(f,h.buffer);-1===w.count&&0===x.length&&a.bufferSubData(f,0,r);if(0!==x.length){for(let y=0,z=x.length;y<z;y++)t=x[y],a.bufferSubData(f,t.start*r.BYTES_PER_ELEMENT,r,t.start,t.count);n.clearUpdateRanges()}-1!==w.count&&(a.bufferSubData(f,w.offset*r.BYTES_PER_ELEMENT,r,w.offset,w.count),w.count=-1);n.onUploadCallback();h.version=e.version}}}}}function $x(a,b,e,f,h,n,r){function t(db,bb){db.getRGB(Nk,Tq(a));f.buffers.color.setClear(Nk.r,Nk.g,
Nk.b,bb,r)}const w=new Tb(0);let x=!0===n?0:1,y,z,ab=null,eb=0,cb=null;return{getClearColor:function(){return w},setClearColor:function(db,bb=1){w.set(db);x=bb;t(w,x)},getClearAlpha:function(){return x},setClearAlpha:function(db){x=db;t(w,x)},render:function(db,bb){let gb=!1,kb=!0===bb.isScene?bb.background:null;kb&&kb.isTexture&&(kb=(0<bb.backgroundBlurriness?e:b).get(kb));null===kb?t(w,x):kb&&kb.isColor&&(t(kb,1),gb=!0);const qb=a.xr.getEnvironmentBlendMode();"additive"===qb?f.buffers.color.setClear(0,
0,0,1,r):"alpha-blend"===qb&&f.buffers.color.setClear(0,0,0,0,r);(a.autoClear||gb)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil);if(kb&&(kb.isCubeTexture||306===kb.mapping)){void 0===z&&(z=new Bd(new Sg(1,1,1),new Of({name:"BackgroundCubeMaterial",uniforms:zj(Pf.backgroundCube.uniforms),vertexShader:Pf.backgroundCube.vertexShader,fragmentShader:Pf.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),z.geometry.deleteAttribute("normal"),z.geometry.deleteAttribute("uv"),
z.onBeforeRender=function(ob,pb,ub){this.matrixWorld.copyPosition(ub.matrixWorld)},Object.defineProperty(z.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),h.update(z));If.copy(bb.backgroundRotation);If.x*=-1;If.y*=-1;If.z*=-1;kb.isCubeTexture&&!1===kb.isRenderTargetTexture&&(If.y*=-1,If.z*=-1);z.material.uniforms.envMap.value=kb;z.material.uniforms.flipEnvMap.value=kb.isCubeTexture&&!1===kb.isRenderTargetTexture?-1:1;z.material.uniforms.backgroundBlurriness.value=bb.backgroundBlurriness;
z.material.uniforms.backgroundIntensity.value=bb.backgroundIntensity;z.material.uniforms.backgroundRotation.value.setFromMatrix4(ay.makeRotationFromEuler(If));z.material.toneMapped="srgb"!==Fd.getTransfer(kb.colorSpace);if(ab!==kb||eb!==kb.version||cb!==a.toneMapping)z.material.needsUpdate=!0,ab=kb,eb=kb.version,cb=a.toneMapping;z.layers.enableAll();db.unshift(z,z.geometry,z.material,0,0,null)}else if(kb&&kb.isTexture){void 0===y&&(y=new Bd(new Df(2,2),new Of({name:"BackgroundMaterial",uniforms:zj(Pf.background.uniforms),
vertexShader:Pf.background.vertexShader,fragmentShader:Pf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),y.geometry.deleteAttribute("normal"),Object.defineProperty(y.material,"map",{get:function(){return this.uniforms.t2D.value}}),h.update(y));y.material.uniforms.t2D.value=kb;y.material.uniforms.backgroundIntensity.value=bb.backgroundIntensity;y.material.toneMapped="srgb"!==Fd.getTransfer(kb.colorSpace);!0===kb.matrixAutoUpdate&&kb.updateMatrix();y.material.uniforms.uvTransform.value.copy(kb.matrix);
if(ab!==kb||eb!==kb.version||cb!==a.toneMapping)y.material.needsUpdate=!0,ab=kb,eb=kb.version,cb=a.toneMapping;y.layers.enableAll();db.unshift(y,y.geometry,y.material,0,0,null)}}}}function by(a,b){function e(cb){const db=[],bb=[],gb=[];for(let kb=0;kb<x;kb++)db[kb]=0,bb[kb]=0,gb[kb]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:db,enabledAttributes:bb,attributeDivisors:gb,object:cb,attributes:{},index:null}}function f(){const cb=ab.newAttributes;for(let db=0,bb=cb.length;db<bb;db++)cb[db]=
0}function h(cb){n(cb,0)}function n(cb,db){const bb=ab.enabledAttributes,gb=ab.attributeDivisors;ab.newAttributes[cb]=1;0===bb[cb]&&(a.enableVertexAttribArray(cb),bb[cb]=1);gb[cb]!==db&&(a.vertexAttribDivisor(cb,db),gb[cb]=db)}function r(){const cb=ab.newAttributes,db=ab.enabledAttributes;for(let bb=0,gb=db.length;bb<gb;bb++)db[bb]!==cb[bb]&&(a.disableVertexAttribArray(bb),db[bb]=0)}function t(){w();eb=!0;ab!==z&&(ab=z,a.bindVertexArray(ab.object))}function w(){z.geometry=null;z.program=null;z.wireframe=
!1}const x=a.getParameter(a.MAX_VERTEX_ATTRIBS),y={},z=e(null);let ab=z,eb=!1;return{setup:function(cb,db,bb,gb,kb){var qb=!0===db.wireframe;var ob=y[gb.id];void 0===ob&&(ob={},y[gb.id]=ob);var pb=ob[bb.id];void 0===pb&&(pb={},ob[bb.id]=pb);ob=pb[qb];void 0===ob&&(ob=e(a.createVertexArray()),pb[qb]=ob);qb=ob;ab!==qb&&(ab=qb,a.bindVertexArray(ab.object));a:{qb=ab.attributes;pb=gb.attributes;ob=0;var ub=bb.getAttributes();for(wb in ub)if(0<=ub[wb].location){var rb=qb[wb],Ab=pb[wb];void 0===Ab&&("instanceMatrix"===
wb&&cb.instanceMatrix&&(Ab=cb.instanceMatrix),"instanceColor"===wb&&cb.instanceColor&&(Ab=cb.instanceColor));if(void 0===rb||rb.attribute!==Ab||Ab&&rb.data!==Ab.data){var wb=!0;break a}ob++}wb=ab.attributesNum!==ob||ab.index!==kb?!0:!1}if(wb){qb={};pb=gb.attributes;ob=0;ub=bb.getAttributes();for(var Cb in ub)0<=ub[Cb].location&&(rb=pb[Cb],void 0===rb&&("instanceMatrix"===Cb&&cb.instanceMatrix&&(rb=cb.instanceMatrix),"instanceColor"===Cb&&cb.instanceColor&&(rb=cb.instanceColor)),Ab={},(Ab.attribute=
rb)&&rb.data&&(Ab.data=rb.data),qb[Cb]=Ab,ob++);ab.attributes=qb;ab.attributesNum=ob;ab.index=kb}null!==kb&&b.update(kb,a.ELEMENT_ARRAY_BUFFER);if(wb||eb){eb=!1;f();Cb=gb.attributes;bb=bb.getAttributes();db=db.defaultAttributeValues;for(const Yb in bb)if(wb=bb[Yb],0<=wb.location){var Fb=Cb[Yb];void 0===Fb&&("instanceMatrix"===Yb&&cb.instanceMatrix&&(Fb=cb.instanceMatrix),"instanceColor"===Yb&&cb.instanceColor&&(Fb=cb.instanceColor));if(void 0!==Fb){if(qb=Fb.normalized,pb=Fb.itemSize,ub=b.get(Fb),
void 0!==ub){var Ob=ub.buffer;ob=ub.type;ub=ub.bytesPerElement;rb=ob===a.INT||ob===a.UNSIGNED_INT||1013===Fb.gpuType;if(Fb.isInterleavedBufferAttribute){var Gb=Fb.data;Ab=Gb.stride;Fb=Fb.offset;if(Gb.isInstancedInterleavedBuffer){for(var Nb=0;Nb<wb.locationSize;Nb++)n(wb.location+Nb,Gb.meshPerAttribute);!0!==cb.isInstancedMesh&&void 0===gb._maxInstanceCount&&(gb._maxInstanceCount=Gb.meshPerAttribute*Gb.count)}else for(Gb=0;Gb<wb.locationSize;Gb++)h(wb.location+Gb);a.bindBuffer(a.ARRAY_BUFFER,Ob);
for(let Sb=0;Sb<wb.locationSize;Sb++){Ob=wb.location+Sb;Gb=pb/wb.locationSize;Nb=ob;var Rb=qb,Pb=Ab*ub,wd=(Fb+pb/wb.locationSize*Sb)*ub;!0===rb?a.vertexAttribIPointer(Ob,Gb,Nb,Pb,wd):a.vertexAttribPointer(Ob,Gb,Nb,Rb,Pb,wd)}}else{if(Fb.isInstancedBufferAttribute){for(Ab=0;Ab<wb.locationSize;Ab++)n(wb.location+Ab,Fb.meshPerAttribute);!0!==cb.isInstancedMesh&&void 0===gb._maxInstanceCount&&(gb._maxInstanceCount=Fb.meshPerAttribute*Fb.count)}else for(Ab=0;Ab<wb.locationSize;Ab++)h(wb.location+Ab);a.bindBuffer(a.ARRAY_BUFFER,
Ob);for(Pb=0;Pb<wb.locationSize;Pb++)Ab=wb.location+Pb,Fb=pb/wb.locationSize,Ob=ob,Gb=qb,Nb=pb*ub,Rb=pb/wb.locationSize*Pb*ub,!0===rb?a.vertexAttribIPointer(Ab,Fb,Ob,Nb,Rb):a.vertexAttribPointer(Ab,Fb,Ob,Gb,Nb,Rb)}}}else if(void 0!==db&&(qb=db[Yb],void 0!==qb))switch(qb.length){case 2:a.vertexAttrib2fv(wb.location,qb);break;case 3:a.vertexAttrib3fv(wb.location,qb);break;case 4:a.vertexAttrib4fv(wb.location,qb);break;default:a.vertexAttrib1fv(wb.location,qb)}}r();null!==kb&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
b.get(kb).buffer)}},reset:t,resetDefaultState:w,dispose:function(){t();for(const cb in y){const db=y[cb];for(const bb in db){const gb=db[bb];for(const kb in gb)a.deleteVertexArray(gb[kb].object),delete gb[kb];delete db[bb]}delete y[cb]}},releaseStatesOfGeometry:function(cb){if(void 0!==y[cb.id]){var db=y[cb.id];for(const bb in db){const gb=db[bb];for(const kb in gb)a.deleteVertexArray(gb[kb].object),delete gb[kb];delete db[bb]}delete y[cb.id]}},releaseStatesOfProgram:function(cb){for(const db in y){const bb=
y[db];if(void 0===bb[cb.id])continue;const gb=bb[cb.id];for(const kb in gb)a.deleteVertexArray(gb[kb].object),delete gb[kb];delete bb[cb.id]}},initAttributes:f,enableAttribute:h,disableUnusedAttributes:r}}function cy(a,b,e){let f;this.setMode=function(h){f=h};this.render=function(h,n){a.drawArrays(f,h,n);e.update(n,f,1)};this.renderInstances=function(h,n,r){0!==r&&(a.drawArraysInstanced(f,h,n,r),e.update(n,f,r))};this.renderMultiDraw=function(h,n,r){if(0!==r){var t=b.get("WEBGL_multi_draw");if(null===
t)for(t=0;t<r;t++)this.render(h[t],n[t]);else{t.multiDrawArraysWEBGL(f,h,0,n,0,r);h=0;for(t=0;t<r;t++)h+=n[t];e.update(h,f,1)}}}}function dy(a,b,e){function f(bb){if("highp"===bb){if(0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision)return"highp";bb="mediump"}return"mediump"===bb&&0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision?
"mediump":"lowp"}let h,n=void 0!==e.precision?e.precision:"highp";var r=f(n);r!==n&&(console.warn("THREE.WebGLRenderer:",n,"not supported, using",r,"instead."),n=r);e=!0===e.logarithmicDepthBuffer;r=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS);const t=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=a.getParameter(a.MAX_TEXTURE_SIZE),x=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),y=a.getParameter(a.MAX_VERTEX_ATTRIBS),z=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),ab=a.getParameter(a.MAX_VARYING_VECTORS),
eb=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),cb=0<t,db=a.getParameter(a.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==h)return h;if(!0===b.has("EXT_texture_filter_anisotropic")){const bb=b.get("EXT_texture_filter_anisotropic");h=a.getParameter(bb.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else h=0;return h},getMaxPrecision:f,precision:n,logarithmicDepthBuffer:e,maxTextures:r,maxVertexTextures:t,maxTextureSize:w,maxCubemapSize:x,maxAttributes:y,maxVertexUniforms:z,maxVaryings:ab,
maxFragmentUniforms:eb,vertexTextures:cb,maxSamples:db}}function ey(a){function b(y,z,ab,eb){const cb=null!==y?y.length:0;let db=null;if(0!==cb){db=x.value;if(!0!==eb||null===db){eb=ab+4*cb;z=z.matrixWorldInverse;w.getNormalMatrix(z);if(null===db||db.length<eb)db=new Float32Array(eb);for(let bb=0,gb=ab;bb!==cb;++bb,gb+=4)t.copy(y[bb]).applyMatrix4(z,w),t.normal.toArray(db,gb),db[gb+3]=t.constant}x.value=db;x.needsUpdate=!0}e.numPlanes=cb;e.numIntersection=0;return db}const e=this;let f=null,h=0,n=
!1,r=!1;const t=new yg,w=new qd,x={value:null,needsUpdate:!1};this.uniform=x;this.numIntersection=this.numPlanes=0;this.init=function(y,z){const ab=0!==y.length||z||0!==h||n;n=z;h=y.length;return ab};this.beginShadows=function(){r=!0;b(null)};this.endShadows=function(){r=!1};this.setGlobalState=function(y,z){f=b(y,z,0)};this.setState=function(y,z,ab){const eb=y.clippingPlanes,cb=y.clipIntersection;var db=y.clipShadows;y=a.get(y);if(!n||null===eb||0===eb.length||r&&!db)r?b(null):(x.value!==f&&(x.value=
f,x.needsUpdate=0<h),e.numPlanes=h,e.numIntersection=0);else{db=r?0:h;const bb=4*db;let gb=y.clippingState||null;x.value=gb;gb=b(eb,z,bb,ab);for(z=0;z!==bb;++z)gb[z]=f[z];y.clippingState=gb;this.numIntersection=cb?this.numPlanes:0;this.numPlanes+=db}}}function fy(a){function b(h,n){303===n?h.mapping=301:304===n&&(h.mapping=302);return h}function e(h){h=h.target;h.removeEventListener("dispose",e);const n=f.get(h);void 0!==n&&(f.delete(h),n.dispose())}let f=new WeakMap;return{get:function(h){if(h&&
h.isTexture){var n=h.mapping;if(303===n||304===n)return f.has(h)?(n=f.get(h).texture,b(n,h.mapping)):(n=h.image)&&0<n.height?(n=new Vq(n.height),n.fromEquirectangularTexture(a,h),f.set(h,n),h.addEventListener("dispose",e),b(n.texture,h.mapping)):null}return h},dispose:function(){f=new WeakMap}}}function Wq(a,b,e){a=new Qf(a,b,e);a.texture.mapping=306;a.texture.name="PMREM.cubeUv";a.scissorTest=!0;return a}function Ok(a,b,e,f,h){a.viewport.set(b,e,f,h);a.scissor.set(b,e,f,h)}function Xq(){return new Of({name:"EquirectangularToCubeUV",
uniforms:{envMap:{value:null}},vertexShader:$m(),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 Yq(){return new Of({name:"CubemapToCubeUV",
uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:$m(),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 $m(){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 gy(a){function b(h){h=h.target;h.removeEventListener("dispose",b);const n=e.get(h);void 0!==n&&(e.delete(h),n.dispose())}let e=new WeakMap,f=null;return{get:function(h){if(h&&h.isTexture){var n=h.mapping;const w=303===n||304===n;var r=301===n||302===n;if(w||r){n=e.get(h);var t=void 0!==n?n.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==t)return null===f&&(f=new ap(a)),n=w?f.fromEquirectangular(h,n):f.fromCubemap(h,n),n.texture.pmremVersion=h.pmremVersion,e.set(h,n),n.texture;
if(void 0!==n)return n.texture;n=h.image;if(!(t=w&&n&&0<n.height)){if(r=r&&n){r=0;for(t=0;6>t;t++)void 0!==n[t]&&r++;r=6===r}t=r}return t?(null===f&&(f=new ap(a)),n=w?f.fromEquirectangular(h):f.fromCubemap(h),n.texture.pmremVersion=h.pmremVersion,e.set(h,n),h.addEventListener("dispose",b),n.texture):null}}return h},dispose:function(){e=new WeakMap;null!==f&&(f.dispose(),f=null)}}}function hy(a){function b(f){if(void 0!==e[f])return e[f];let h;switch(f){case "WEBGL_depth_texture":h=a.getExtension("WEBGL_depth_texture")||
a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case "EXT_texture_filter_anisotropic":h=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":h=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;
case "WEBGL_compressed_texture_pvrtc":h=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:h=a.getExtension(f)}return e[f]=h}const e={};return{has:function(f){return null!==b(f)},init:function(){b("EXT_color_buffer_float");b("WEBGL_clip_cull_distance");b("OES_texture_float_linear");b("EXT_color_buffer_half_float");b("WEBGL_multisampled_render_to_texture");b("WEBGL_render_shared_exponent")},get:function(f){const h=b(f);null===h&&
console.warn("THREE.WebGLRenderer: "+f+" extension not supported.");return h}}}function iy(a,b,e,f){function h(w){w=w.target;null!==w.index&&b.remove(w.index);for(var x in w.attributes)b.remove(w.attributes[x]);for(var y in w.morphAttributes){x=w.morphAttributes[y];for(let z=0,ab=x.length;z<ab;z++)b.remove(x[z])}w.removeEventListener("dispose",h);delete r[w.id];if(y=t.get(w))b.remove(y),t.delete(w);f.releaseStatesOfGeometry(w);!0===w.isInstancedBufferGeometry&&delete w._maxInstanceCount;e.memory.geometries--}
function n(w){var x=[],y=w.index,z=w.attributes.position;if(null!==y){z=y.array;y=y.version;for(let cb=0,db=z.length;cb<db;cb+=3){var ab=z[cb+0],eb=z[cb+1];const bb=z[cb+2];x.push(ab,eb,eb,bb,bb,ab)}}else if(void 0!==z){ab=z.array;y=z.version;for(let cb=0,db=ab.length/3-1;cb<db;cb+=3)z=cb+0,ab=cb+1,eb=cb+2,x.push(z,ab,ab,eb,eb,z)}else return;x=new (Nq(x)?bp:cp)(x,1);x.version=y;(y=t.get(w))&&b.remove(y);t.set(w,x)}const r={},t=new WeakMap;return{get:function(w,x){if(!0===r[x.id])return x;x.addEventListener("dispose",
h);r[x.id]=!0;e.memory.geometries++;return x},update:function(w){var x=w.attributes;for(const y in x)b.update(x[y],a.ARRAY_BUFFER);w=w.morphAttributes;for(const y in w){x=w[y];for(let z=0,ab=x.length;z<ab;z++)b.update(x[z],a.ARRAY_BUFFER)}},getWireframeAttribute:function(w){const x=t.get(w);if(x){const y=w.index;null!==y&&x.version<y.version&&n(w)}else n(w);return t.get(w)}}}function jy(a,b,e){let f,h,n;this.setMode=function(r){f=r};this.setIndex=function(r){h=r.type;n=r.bytesPerElement};this.render=
function(r,t){a.drawElements(f,t,h,r*n);e.update(t,f,1)};this.renderInstances=function(r,t,w){0!==w&&(a.drawElementsInstanced(f,t,h,r*n,w),e.update(t,f,w))};this.renderMultiDraw=function(r,t,w){if(0!==w){var x=b.get("WEBGL_multi_draw");if(null===x)for(x=0;x<w;x++)this.render(r[x]/n,t[x]);else{x.multiDrawElementsWEBGL(f,t,0,h,r,0,w);r=0;for(x=0;x<w;x++)r+=t[x];e.update(r,f,1)}}}}function ky(a){const b={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:b,programs:null,
autoReset:!0,reset:function(){b.calls=0;b.triangles=0;b.points=0;b.lines=0},update:function(e,f,h){b.calls++;switch(f){case a.TRIANGLES:b.triangles+=e/3*h;break;case a.LINES:b.lines+=e/2*h;break;case a.LINE_STRIP:b.lines+=h*(e-1);break;case a.LINE_LOOP:b.lines+=h*e;break;case a.POINTS:b.points+=h*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",f)}}}}function ly(a,b,e){const f=new WeakMap,h=new Md;return{update:function(n,r,t){const w=n.morphTargetInfluences;var x=r.morphAttributes.position||
r.morphAttributes.normal||r.morphAttributes.color;x=void 0!==x?x.length:0;var y=f.get(r);if(void 0===y||y.count!==x){void 0!==y&&y.texture.dispose();y=void 0!==r.morphAttributes.position;const ab=void 0!==r.morphAttributes.normal,eb=void 0!==r.morphAttributes.color,cb=r.morphAttributes.position||[],db=r.morphAttributes.normal||[],bb=r.morphAttributes.color||[];var z=0;!0===y&&(z=1);!0===ab&&(z=2);!0===eb&&(z=3);let gb=r.attributes.position.count*z,kb=1;gb>b.maxTextureSize&&(kb=Math.ceil(gb/b.maxTextureSize),
gb=b.maxTextureSize);const qb=new Float32Array(gb*kb*4*x),ob=new Pk(qb,gb,kb,x);ob.type=1015;ob.needsUpdate=!0;z*=4;for(let ub=0;ub<x;ub++){const rb=cb[ub],Ab=db[ub],wb=bb[ub],Cb=gb*kb*4*ub;for(let Fb=0;Fb<rb.count;Fb++){const Ob=Fb*z;!0===y&&(h.fromBufferAttribute(rb,Fb),qb[Cb+Ob+0]=h.x,qb[Cb+Ob+1]=h.y,qb[Cb+Ob+2]=h.z,qb[Cb+Ob+3]=0);!0===ab&&(h.fromBufferAttribute(Ab,Fb),qb[Cb+Ob+4]=h.x,qb[Cb+Ob+5]=h.y,qb[Cb+Ob+6]=h.z,qb[Cb+Ob+7]=0);!0===eb&&(h.fromBufferAttribute(wb,Fb),qb[Cb+Ob+8]=h.x,qb[Cb+Ob+
9]=h.y,qb[Cb+Ob+10]=h.z,qb[Cb+Ob+11]=4===wb.itemSize?h.w:1)}}y={count:x,texture:ob,size:new Lb(gb,kb)};f.set(r,y);function pb(){ob.dispose();f.delete(r);r.removeEventListener("dispose",pb)}r.addEventListener("dispose",pb)}if(!0===n.isInstancedMesh&&null!==n.morphTexture)t.getUniforms().setValue(a,"morphTexture",n.morphTexture,e);else{n=0;for(x=0;x<w.length;x++)n+=w[x];n=r.morphTargetsRelative?1:1-n;t.getUniforms().setValue(a,"morphTargetBaseInfluence",n);t.getUniforms().setValue(a,"morphTargetInfluences",
w)}t.getUniforms().setValue(a,"morphTargetsTexture",y.texture,e);t.getUniforms().setValue(a,"morphTargetsTextureSize",y.size)}}}function my(a,b,e,f){function h(r){r=r.target;r.removeEventListener("dispose",h);e.remove(r.instanceMatrix);null!==r.instanceColor&&e.remove(r.instanceColor)}let n=new WeakMap;return{update:function(r){const t=f.render.frame,w=b.get(r,r.geometry);n.get(w)!==t&&(b.update(w),n.set(w,t));r.isInstancedMesh&&(!1===r.hasEventListener("dispose",h)&&r.addEventListener("dispose",
h),n.get(r)!==t&&(e.update(r.instanceMatrix,a.ARRAY_BUFFER),null!==r.instanceColor&&e.update(r.instanceColor,a.ARRAY_BUFFER),n.set(r,t)));r.isSkinnedMesh&&(r=r.skeleton,n.get(r)!==t&&(r.update(),n.set(r,t)));return w},dispose:function(){n=new WeakMap}}}function Aj(a,b,e){const f=a[0];if(0>=f||0<f)return a;const h=b*e;let n=Zq[h];void 0===n&&(n=new Float32Array(h),Zq[h]=n);if(0!==b){f.toArray(n,0);for(let r=1,t=0;r!==b;++r)t+=e,a[r].toArray(n,t)}return n}function df(a,b){if(a.length!==b.length)return!1;
for(let e=0,f=a.length;e<f;e++)if(a[e]!==b[e])return!1;return!0}function ef(a,b){for(let e=0,f=b.length;e<f;e++)a[e]=b[e]}function Qk(a,b){let e=$q[b];void 0===e&&(e=new Int32Array(b),$q[b]=e);for(let f=0;f!==b;++f)e[f]=a.allocateTextureUnit();return e}function ny(a,b){const e=this.cache;e[0]!==b&&(a.uniform1f(this.addr,b),e[0]=b)}function oy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y)a.uniform2f(this.addr,b.x,b.y),e[0]=b.x,e[1]=b.y}else df(e,b)||(a.uniform2fv(this.addr,b),
ef(e,b))}function py(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z)a.uniform3f(this.addr,b.x,b.y,b.z),e[0]=b.x,e[1]=b.y,e[2]=b.z}else if(void 0!==b.r){if(e[0]!==b.r||e[1]!==b.g||e[2]!==b.b)a.uniform3f(this.addr,b.r,b.g,b.b),e[0]=b.r,e[1]=b.g,e[2]=b.b}else df(e,b)||(a.uniform3fv(this.addr,b),ef(e,b))}function qy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z||e[3]!==b.w)a.uniform4f(this.addr,b.x,b.y,b.z,b.w),e[0]=b.x,e[1]=b.y,e[2]=b.z,
e[3]=b.w}else df(e,b)||(a.uniform4fv(this.addr,b),ef(e,b))}function ry(a,b){const e=this.cache,f=b.elements;void 0===f?df(e,b)||(a.uniformMatrix2fv(this.addr,!1,b),ef(e,b)):df(e,f)||(av.set(f),a.uniformMatrix2fv(this.addr,!1,av),ef(e,f))}function sy(a,b){const e=this.cache,f=b.elements;void 0===f?df(e,b)||(a.uniformMatrix3fv(this.addr,!1,b),ef(e,b)):df(e,f)||(bv.set(f),a.uniformMatrix3fv(this.addr,!1,bv),ef(e,f))}function ty(a,b){const e=this.cache,f=b.elements;void 0===f?df(e,b)||(a.uniformMatrix4fv(this.addr,
!1,b),ef(e,b)):df(e,f)||(cv.set(f),a.uniformMatrix4fv(this.addr,!1,cv),ef(e,f))}function uy(a,b){const e=this.cache;e[0]!==b&&(a.uniform1i(this.addr,b),e[0]=b)}function vy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y)a.uniform2i(this.addr,b.x,b.y),e[0]=b.x,e[1]=b.y}else df(e,b)||(a.uniform2iv(this.addr,b),ef(e,b))}function wy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z)a.uniform3i(this.addr,b.x,b.y,b.z),e[0]=b.x,e[1]=b.y,e[2]=b.z}else df(e,
b)||(a.uniform3iv(this.addr,b),ef(e,b))}function xy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z||e[3]!==b.w)a.uniform4i(this.addr,b.x,b.y,b.z,b.w),e[0]=b.x,e[1]=b.y,e[2]=b.z,e[3]=b.w}else df(e,b)||(a.uniform4iv(this.addr,b),ef(e,b))}function yy(a,b){const e=this.cache;e[0]!==b&&(a.uniform1ui(this.addr,b),e[0]=b)}function zy(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y)a.uniform2ui(this.addr,b.x,b.y),e[0]=b.x,e[1]=b.y}else df(e,b)||(a.uniform2uiv(this.addr,
b),ef(e,b))}function Ay(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z)a.uniform3ui(this.addr,b.x,b.y,b.z),e[0]=b.x,e[1]=b.y,e[2]=b.z}else df(e,b)||(a.uniform3uiv(this.addr,b),ef(e,b))}function By(a,b){const e=this.cache;if(void 0!==b.x){if(e[0]!==b.x||e[1]!==b.y||e[2]!==b.z||e[3]!==b.w)a.uniform4ui(this.addr,b.x,b.y,b.z,b.w),e[0]=b.x,e[1]=b.y,e[2]=b.z,e[3]=b.w}else df(e,b)||(a.uniform4uiv(this.addr,b),ef(e,b))}function Cy(a,b,e){const f=this.cache,h=e.allocateTextureUnit();
f[0]!==h&&(a.uniform1i(this.addr,h),f[0]=h);a=this.type===a.SAMPLER_2D_SHADOW?dv:ev;e.setTexture2D(b||a,h)}function Dy(a,b,e){const f=this.cache,h=e.allocateTextureUnit();f[0]!==h&&(a.uniform1i(this.addr,h),f[0]=h);e.setTexture3D(b||fv,h)}function Ey(a,b,e){const f=this.cache,h=e.allocateTextureUnit();f[0]!==h&&(a.uniform1i(this.addr,h),f[0]=h);e.setTextureCube(b||gv,h)}function Fy(a,b,e){const f=this.cache,h=e.allocateTextureUnit();f[0]!==h&&(a.uniform1i(this.addr,h),f[0]=h);e.setTexture2DArray(b||
hv,h)}function Gy(a){switch(a){case 5126:return ny;case 35664:return oy;case 35665:return py;case 35666:return qy;case 35674:return ry;case 35675:return sy;case 35676:return ty;case 5124:case 35670:return uy;case 35667:case 35671:return vy;case 35668:case 35672:return wy;case 35669:case 35673:return xy;case 5125:return yy;case 36294:return zy;case 36295:return Ay;case 36296:return By;case 35678:case 36198:case 36298:case 36306:case 35682:return Cy;case 35679:case 36299:case 36307:return Dy;case 35680:case 36300:case 36308:case 36293:return Ey;
case 36289:case 36303:case 36311:case 36292:return Fy}}function Hy(a,b){a.uniform1fv(this.addr,b)}function Iy(a,b){b=Aj(b,this.size,2);a.uniform2fv(this.addr,b)}function Jy(a,b){b=Aj(b,this.size,3);a.uniform3fv(this.addr,b)}function Ky(a,b){b=Aj(b,this.size,4);a.uniform4fv(this.addr,b)}function Ly(a,b){b=Aj(b,this.size,4);a.uniformMatrix2fv(this.addr,!1,b)}function My(a,b){b=Aj(b,this.size,9);a.uniformMatrix3fv(this.addr,!1,b)}function Ny(a,b){b=Aj(b,this.size,16);a.uniformMatrix4fv(this.addr,!1,
b)}function Oy(a,b){a.uniform1iv(this.addr,b)}function Py(a,b){a.uniform2iv(this.addr,b)}function Qy(a,b){a.uniform3iv(this.addr,b)}function Ry(a,b){a.uniform4iv(this.addr,b)}function Sy(a,b){a.uniform1uiv(this.addr,b)}function Ty(a,b){a.uniform2uiv(this.addr,b)}function Uy(a,b){a.uniform3uiv(this.addr,b)}function Vy(a,b){a.uniform4uiv(this.addr,b)}function Wy(a,b,e){const f=this.cache,h=b.length,n=Qk(e,h);df(f,n)||(a.uniform1iv(this.addr,n),ef(f,n));for(a=0;a!==h;++a)e.setTexture2D(b[a]||ev,n[a])}
function Xy(a,b,e){const f=this.cache,h=b.length,n=Qk(e,h);df(f,n)||(a.uniform1iv(this.addr,n),ef(f,n));for(a=0;a!==h;++a)e.setTexture3D(b[a]||fv,n[a])}function Yy(a,b,e){const f=this.cache,h=b.length,n=Qk(e,h);df(f,n)||(a.uniform1iv(this.addr,n),ef(f,n));for(a=0;a!==h;++a)e.setTextureCube(b[a]||gv,n[a])}function Zy(a,b,e){const f=this.cache,h=b.length,n=Qk(e,h);df(f,n)||(a.uniform1iv(this.addr,n),ef(f,n));for(a=0;a!==h;++a)e.setTexture2DArray(b[a]||hv,n[a])}function $y(a){switch(a){case 5126:return Hy;
case 35664:return Iy;case 35665:return Jy;case 35666:return Ky;case 35674:return Ly;case 35675:return My;case 35676:return Ny;case 5124:case 35670:return Oy;case 35667:case 35671:return Py;case 35668:case 35672:return Qy;case 35669:case 35673:return Ry;case 5125:return Sy;case 36294:return Ty;case 36295:return Uy;case 36296:return Vy;case 35678:case 36198:case 36298:case 36306:case 35682:return Wy;case 35679:case 36299:case 36307:return Xy;case 35680:case 36300:case 36308:case 36293:return Yy;case 36289:case 36303:case 36311:case 36292:return Zy}}
function iv(a,b,e){b=a.createShader(b);a.shaderSource(b,e);a.compileShader(b);return b}function jv(a,b,e){var f=a.getShaderParameter(b,a.COMPILE_STATUS),h=a.getShaderInfoLog(b).trim();if(f&&""===h)return"";if(f=/ERROR: 0:(\d+)/.exec(h)){e=e.toUpperCase()+"\n\n"+h+"\n\n";h=parseInt(f[1]);a=a.getShaderSource(b).split("\n");b=[];var n=Math.max(h-6,0);for(f=Math.min(h+6,a.length);n<f;n++){const r=n+1;b.push(`${r===h?">":" "} ${r}: ${a[n]}`)}e+=b.join("\n")}else e=h;return e}function az(a,b){a:{const e=
Fd.getPrimaries(Fd.workingColorSpace),f=Fd.getPrimaries(b);let h;e===f?h="":"p3"===e&&"rec709"===f?h="LinearDisplayP3ToLinearSRGB":"rec709"===e&&"p3"===f&&(h="LinearSRGBToLinearDisplayP3");switch(b){case "srgb-linear":case "display-p3-linear":b=[h,"LinearTransferOETF"];break a;case "srgb":case "display-p3":b=[h,"sRGBTransferOETF"];break a;default:console.warn("THREE.WebGLProgram: Unsupported color space:",b),b=[h,"LinearTransferOETF"]}}return`vec4 ${a}( vec4 value ) { return ${b[0]}( ${b[1]}( value ) ); }`}
function bz(a,b){switch(b){case 1:b="Linear";break;case 2:b="Reinhard";break;case 3:b="OptimizedCineon";break;case 4:b="ACESFilmic";break;case 6:b="AgX";break;case 7:b="Neutral";break;case 5:b="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",b),b="Linear"}return"vec3 "+a+"( vec3 color ) { return "+b+"ToneMapping( color ); }"}function cz(a){const b=[];for(const e in a){const f=a[e];!1!==f&&b.push("#define "+e+" "+f)}return b.join("\n")}function gk(a){return""!==a}
function kv(a,b){const e=b.numSpotLightShadows+b.numSpotLightMaps-b.numSpotLightShadowsWithMaps;return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,b.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,b.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,b.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,
b.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,b.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,b.numPointLightShadows)}function lv(a,b){return a.replace(/NUM_CLIPPING_PLANES/g,b.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,b.numClippingPlanes-b.numClipIntersection)}function dp(a,b){a=vd[b];if(void 0===a){const e=dz.get(b);if(void 0!==e)a=vd[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',b,e);else throw Error("Can not resolve #include <"+
b+">");}return a.replace(ep,dp)}function mv(a,b,e,f){a="";for(b=parseInt(b);b<parseInt(e);b++)a+=f.replace(/\[\s*i\s*\]/g,"[ "+b+" ]").replace(/UNROLLED_LOOP_INDEX/g,b);return a}function nv(a){let b=`precision ${a.precision} float;
	precision ${a.precision} int;
	precision ${a.precision} sampler2D;
	precision ${a.precision} samplerCube;
	precision ${a.precision} sampler3D;
	precision ${a.precision} sampler2DArray;
	precision ${a.precision} sampler2DShadow;
	precision ${a.precision} samplerCubeShadow;
	precision ${a.precision} sampler2DArrayShadow;
	precision ${a.precision} isampler2D;
	precision ${a.precision} isampler3D;
	precision ${a.precision} isamplerCube;
	precision ${a.precision} isampler2DArray;
	precision ${a.precision} usampler2D;
	precision ${a.precision} usampler3D;
	precision ${a.precision} usamplerCube;
	precision ${a.precision} usampler2DArray;
	`;"highp"===a.precision?b+="\n#define HIGH_PRECISION":"mediump"===a.precision?b+="\n#define MEDIUM_PRECISION":"lowp"===a.precision&&(b+="\n#define LOW_PRECISION");return b}function ez(a){let b="SHADOWMAP_TYPE_BASIC";1===a.shadowMapType?b="SHADOWMAP_TYPE_PCF":2===a.shadowMapType?b="SHADOWMAP_TYPE_PCF_SOFT":3===a.shadowMapType&&(b="SHADOWMAP_TYPE_VSM");return b}function fz(a){let b="ENVMAP_TYPE_CUBE";if(a.envMap)switch(a.envMapMode){case 301:case 302:b="ENVMAP_TYPE_CUBE";break;case 306:b="ENVMAP_TYPE_CUBE_UV"}return b}
function gz(a){let b="ENVMAP_MODE_REFLECTION";if(a.envMap)switch(a.envMapMode){case 302:b="ENVMAP_MODE_REFRACTION"}return b}function hz(a){let b="ENVMAP_BLENDING_NONE";if(a.envMap)switch(a.combine){case 0:b="ENVMAP_BLENDING_MULTIPLY";break;case 1:b="ENVMAP_BLENDING_MIX";break;case 2:b="ENVMAP_BLENDING_ADD"}return b}function iz(a){a=a.envMapCubeUVHeight;if(null===a)return null;const b=Math.log2(a)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,b),112)),texelHeight:1/a,maxMip:b}}function jz(a,b,e,f){function h(Ab){if(a.debug.checkShaderErrors){var wb=
n.getProgramInfoLog(bb).trim(),Cb=n.getShaderInfoLog(qb).trim(),Fb=n.getShaderInfoLog(ob).trim(),Ob=!0,Gb=!0;if(!1===n.getProgramParameter(bb,n.LINK_STATUS))if(Ob=!1,"function"===typeof a.debug.onShaderError)a.debug.onShaderError(n,bb,qb,ob);else{const Nb=jv(n,qb,"vertex"),Rb=jv(n,ob,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(bb,n.VALIDATE_STATUS)+"\n\nMaterial Name: "+Ab.name+"\nMaterial Type: "+Ab.type+"\n\nProgram Info Log: "+
wb+"\n"+Nb+"\n"+Rb)}else if(""!==wb)console.warn("THREE.WebGLProgram: Program Info Log:",wb);else if(""===Cb||""===Fb)Gb=!1;Gb&&(Ab.diagnostics={runnable:Ob,programLog:wb,vertexShader:{log:Cb,prefix:gb},fragmentShader:{log:Fb,prefix:kb}})}n.deleteShader(qb);n.deleteShader(ob);pb=new Rk(n,bb);Ab={};wb=n.getProgramParameter(bb,n.ACTIVE_ATTRIBUTES);for(Cb=0;Cb<wb;Cb++)Fb=n.getActiveAttrib(bb,Cb),Ob=Fb.name,Gb=1,Fb.type===n.FLOAT_MAT2&&(Gb=2),Fb.type===n.FLOAT_MAT3&&(Gb=3),Fb.type===n.FLOAT_MAT4&&(Gb=
4),Ab[Ob]={type:Fb.type,location:n.getAttribLocation(bb,Ob),locationSize:Gb};ub=Ab}const n=a.getContext();var r=e.defines;let t=e.vertexShader;var w=e.fragmentShader;const x=ez(e),y=fz(e),z=gz(e),ab=hz(e),eb=iz(e),cb=[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gk).join("\n"),db=cz(r),bb=n.createProgram();let gb,kb;r=e.glslVersion?"#version "+e.glslVersion+"\n":"";e.isRawShaderMaterial?
(gb=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,db].filter(gk).join("\n"),0<gb.length&&(gb+="\n"),kb=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,db].filter(gk).join("\n"),0<kb.length&&(kb+="\n")):(gb=[nv(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,db,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":
"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+z:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?
"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?
"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":
"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?
"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:
"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:
"",e.vertexTangents&&!1===e.flatShading?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&!1===e.flatShading?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":
"",0<e.morphTargetsCount?"#define MORPHTARGETS_TEXTURE":"",0<e.morphTargetsCount?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",0<e.morphTargetsCount?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+x:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",0<e.numLightProbes?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":
"",e.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(gk).join("\n"),
kb=[nv(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,db,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+y:"",e.envMap?"#define "+z:"",e.envMap?"#define "+ab:"",eb?"#define CUBEUV_TEXEL_WIDTH "+eb.texelWidth:"",eb?"#define CUBEUV_TEXEL_HEIGHT "+eb.texelHeight:"",eb?"#define CUBEUV_MAX_MIP "+
eb.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",
e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?
"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&!1===e.flatShading?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?
"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+x:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",
0<e.numLightProbes?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==e.toneMapping?"#define TONE_MAPPING":"",0!==e.toneMapping?vd.tonemapping_pars_fragment:"",0!==e.toneMapping?bz("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",
vd.colorspace_pars_fragment,az("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"","\n"].filter(gk).join("\n"));t=t.replace(ep,dp);t=kv(t,e);t=lv(t,e);w=w.replace(ep,dp);w=kv(w,e);w=lv(w,e);t=t.replace(ov,mv);w=w.replace(ov,mv);!0!==e.isRawShaderMaterial&&(r="#version 300 es\n",gb=[cb,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+gb,kb=["#define varying in","300 es"===e.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;",
"300 es"===e.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+kb);w=r+kb+w;const qb=iv(n,n.VERTEX_SHADER,r+gb+
t),ob=iv(n,n.FRAGMENT_SHADER,w);n.attachShader(bb,qb);n.attachShader(bb,ob);void 0!==e.index0AttributeName?n.bindAttribLocation(bb,0,e.index0AttributeName):!0===e.morphTargets&&n.bindAttribLocation(bb,0,"position");n.linkProgram(bb);let pb;this.getUniforms=function(){void 0===pb&&h(this);return pb};let ub;this.getAttributes=function(){void 0===ub&&h(this);return ub};let rb=!1===e.rendererExtensionParallelShaderCompile;this.isReady=function(){!1===rb&&(rb=n.getProgramParameter(bb,37297));return rb};
this.destroy=function(){f.releaseStatesOfProgram(this);n.deleteProgram(bb);this.program=void 0};this.type=e.shaderType;this.name=e.shaderName;this.id=kz++;this.cacheKey=b;this.usedTimes=1;this.program=bb;this.vertexShader=qb;this.fragmentShader=ob;return this}function lz(a,b,e,f,h,n,r){function t(bb){y.add(bb);return 0===bb?"uv":`uv${bb}`}const w=new Sk,x=new mz,y=new Set,z=[],ab=h.logarithmicDepthBuffer,eb=h.vertexTextures;let cb=h.precision;const db={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"};return{getParameters:function(bb,gb,kb,qb,ob){const pb=qb.fog,ub=ob.geometry;qb=bb.isMeshStandardMaterial?qb.environment:null;const rb=(qb=(bb.isMeshStandardMaterial?
e:b).get(bb.envMap||qb))&&306===qb.mapping?qb.image.height:null,Ab=db[bb.type];null!==bb.precision&&(cb=h.getMaxPrecision(bb.precision),cb!==bb.precision&&console.warn("THREE.WebGLProgram.getParameters:",bb.precision,"not supported, using",cb,"instead."));var wb=ub.morphAttributes.position||ub.morphAttributes.normal||ub.morphAttributes.color;wb=void 0!==wb?wb.length:0;let Cb=0;void 0!==ub.morphAttributes.position&&(Cb=1);void 0!==ub.morphAttributes.normal&&(Cb=2);void 0!==ub.morphAttributes.color&&
(Cb=3);let Fb;let Ob,Gb;if(Ab){var Nb=Pf[Ab];Fb=Nb.vertexShader;Nb=Nb.fragmentShader}else Fb=bb.vertexShader,Nb=bb.fragmentShader,x.update(bb),Ob=x.getVertexShaderID(bb),Gb=x.getFragmentShaderID(bb);const Rb=a.getRenderTarget(),Pb=!0===ob.isInstancedMesh,wd=!0===ob.isBatchedMesh,Yb=!!bb.map,Sb=!!bb.matcap,hb=!!qb,ib=!!bb.aoMap,nb=!!bb.lightMap,tb=!!bb.bumpMap,sb=!!bb.normalMap,zb=!!bb.displacementMap,Jb=!!bb.emissiveMap,Db=!!bb.metalnessMap,yb=!!bb.roughnessMap,lb=0<bb.anisotropy,Eb=0<bb.clearcoat,
Bb=0<bb.iridescence,Qb=0<bb.sheen,Mb=0<bb.transmission,Wb=lb&&!!bb.anisotropyMap,Dd=Eb&&!!bb.clearcoatMap,Td=Eb&&!!bb.clearcoatNormalMap,hf=Eb&&!!bb.clearcoatRoughnessMap,Jd=Bb&&!!bb.iridescenceMap,Cf=Bb&&!!bb.iridescenceThicknessMap,pf=Qb&&!!bb.sheenColorMap,Bj=Qb&&!!bb.sheenRoughnessMap,Tg=!!bb.specularMap,Cj=!!bb.specularColorMap,Rf=!!bb.specularIntensityMap,Dj=Mb&&!!bb.transmissionMap,Kb=Mb&&!!bb.thicknessMap,$d=!!bb.gradientMap,Jf=!!bb.alphaMap,Gd=0<bb.alphaTest,Ef=!!bb.alphaHash,Ld=!!bb.extensions;
let Pd=0;!bb.toneMapped||null!==Rb&&!0!==Rb.isXRRenderTarget||(Pd=a.toneMapping);bb={shaderID:Ab,shaderType:bb.type,shaderName:bb.name,vertexShader:Fb,fragmentShader:Nb,defines:bb.defines,customVertexShaderID:Ob,customFragmentShaderID:Gb,isRawShaderMaterial:!0===bb.isRawShaderMaterial,glslVersion:bb.glslVersion,precision:cb,batching:wd,instancing:Pb,instancingColor:Pb&&null!==ob.instanceColor,instancingMorph:Pb&&null!==ob.morphTexture,supportsVertexTextures:eb,outputColorSpace:null===Rb?a.outputColorSpace:
!0===Rb.isXRRenderTarget?Rb.texture.colorSpace:"srgb-linear",alphaToCoverage:!!bb.alphaToCoverage,map:Yb,matcap:Sb,envMap:hb,envMapMode:hb&&qb.mapping,envMapCubeUVHeight:rb,aoMap:ib,lightMap:nb,bumpMap:tb,normalMap:sb,displacementMap:eb&&zb,emissiveMap:Jb,normalMapObjectSpace:sb&&1===bb.normalMapType,normalMapTangentSpace:sb&&0===bb.normalMapType,metalnessMap:Db,roughnessMap:yb,anisotropy:lb,anisotropyMap:Wb,clearcoat:Eb,clearcoatMap:Dd,clearcoatNormalMap:Td,clearcoatRoughnessMap:hf,iridescence:Bb,
iridescenceMap:Jd,iridescenceThicknessMap:Cf,sheen:Qb,sheenColorMap:pf,sheenRoughnessMap:Bj,specularMap:Tg,specularColorMap:Cj,specularIntensityMap:Rf,transmission:Mb,transmissionMap:Dj,thicknessMap:Kb,gradientMap:$d,opaque:!1===bb.transparent&&1===bb.blending&&!1===bb.alphaToCoverage,alphaMap:Jf,alphaTest:Gd,alphaHash:Ef,combine:bb.combine,mapUv:Yb&&t(bb.map.channel),aoMapUv:ib&&t(bb.aoMap.channel),lightMapUv:nb&&t(bb.lightMap.channel),bumpMapUv:tb&&t(bb.bumpMap.channel),normalMapUv:sb&&t(bb.normalMap.channel),
displacementMapUv:zb&&t(bb.displacementMap.channel),emissiveMapUv:Jb&&t(bb.emissiveMap.channel),metalnessMapUv:Db&&t(bb.metalnessMap.channel),roughnessMapUv:yb&&t(bb.roughnessMap.channel),anisotropyMapUv:Wb&&t(bb.anisotropyMap.channel),clearcoatMapUv:Dd&&t(bb.clearcoatMap.channel),clearcoatNormalMapUv:Td&&t(bb.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:hf&&t(bb.clearcoatRoughnessMap.channel),iridescenceMapUv:Jd&&t(bb.iridescenceMap.channel),iridescenceThicknessMapUv:Cf&&t(bb.iridescenceThicknessMap.channel),
sheenColorMapUv:pf&&t(bb.sheenColorMap.channel),sheenRoughnessMapUv:Bj&&t(bb.sheenRoughnessMap.channel),specularMapUv:Tg&&t(bb.specularMap.channel),specularColorMapUv:Cj&&t(bb.specularColorMap.channel),specularIntensityMapUv:Rf&&t(bb.specularIntensityMap.channel),transmissionMapUv:Dj&&t(bb.transmissionMap.channel),thicknessMapUv:Kb&&t(bb.thicknessMap.channel),alphaMapUv:Jf&&t(bb.alphaMap.channel),vertexTangents:!!ub.attributes.tangent&&(sb||lb),vertexColors:bb.vertexColors,vertexAlphas:!0===bb.vertexColors&&
!!ub.attributes.color&&4===ub.attributes.color.itemSize,pointsUvs:!0===ob.isPoints&&!!ub.attributes.uv&&(Yb||Jf),fog:!!pb,useFog:!0===bb.fog,fogExp2:!!pb&&pb.isFogExp2,flatShading:!0===bb.flatShading,sizeAttenuation:!0===bb.sizeAttenuation,logarithmicDepthBuffer:ab,skinning:!0===ob.isSkinnedMesh,morphTargets:void 0!==ub.morphAttributes.position,morphNormals:void 0!==ub.morphAttributes.normal,morphColors:void 0!==ub.morphAttributes.color,morphTargetsCount:wb,morphTextureStride:Cb,numDirLights:gb.directional.length,
numPointLights:gb.point.length,numSpotLights:gb.spot.length,numSpotLightMaps:gb.spotLightMap.length,numRectAreaLights:gb.rectArea.length,numHemiLights:gb.hemi.length,numDirLightShadows:gb.directionalShadowMap.length,numPointLightShadows:gb.pointShadowMap.length,numSpotLightShadows:gb.spotShadowMap.length,numSpotLightShadowsWithMaps:gb.numSpotLightShadowsWithMaps,numLightProbes:gb.numLightProbes,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:bb.dithering,shadowMapEnabled:a.shadowMap.enabled&&
0<kb.length,shadowMapType:a.shadowMap.type,toneMapping:Pd,useLegacyLights:a._useLegacyLights,decodeVideoTexture:Yb&&!0===bb.map.isVideoTexture&&"srgb"===Fd.getTransfer(bb.map.colorSpace),premultipliedAlpha:bb.premultipliedAlpha,doubleSided:2===bb.side,flipSided:1===bb.side,useDepthPacking:0<=bb.depthPacking,depthPacking:bb.depthPacking||0,index0AttributeName:bb.index0AttributeName,extensionClipCullDistance:Ld&&!0===bb.extensions.clipCullDistance&&f.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ld&&
!0===bb.extensions.multiDraw&&f.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:f.has("KHR_parallel_shader_compile"),customProgramCacheKey:bb.customProgramCacheKey()};bb.vertexUv1s=y.has(1);bb.vertexUv2s=y.has(2);bb.vertexUv3s=y.has(3);y.clear();return bb},getProgramCacheKey:function(bb){const gb=[];bb.shaderID?gb.push(bb.shaderID):(gb.push(bb.customVertexShaderID),gb.push(bb.customFragmentShaderID));if(void 0!==bb.defines)for(const kb in bb.defines)gb.push(kb),gb.push(bb.defines[kb]);
!1===bb.isRawShaderMaterial&&(gb.push(bb.precision),gb.push(bb.outputColorSpace),gb.push(bb.envMapMode),gb.push(bb.envMapCubeUVHeight),gb.push(bb.mapUv),gb.push(bb.alphaMapUv),gb.push(bb.lightMapUv),gb.push(bb.aoMapUv),gb.push(bb.bumpMapUv),gb.push(bb.normalMapUv),gb.push(bb.displacementMapUv),gb.push(bb.emissiveMapUv),gb.push(bb.metalnessMapUv),gb.push(bb.roughnessMapUv),gb.push(bb.anisotropyMapUv),gb.push(bb.clearcoatMapUv),gb.push(bb.clearcoatNormalMapUv),gb.push(bb.clearcoatRoughnessMapUv),gb.push(bb.iridescenceMapUv),
gb.push(bb.iridescenceThicknessMapUv),gb.push(bb.sheenColorMapUv),gb.push(bb.sheenRoughnessMapUv),gb.push(bb.specularMapUv),gb.push(bb.specularColorMapUv),gb.push(bb.specularIntensityMapUv),gb.push(bb.transmissionMapUv),gb.push(bb.thicknessMapUv),gb.push(bb.combine),gb.push(bb.fogExp2),gb.push(bb.sizeAttenuation),gb.push(bb.morphTargetsCount),gb.push(bb.morphAttributeCount),gb.push(bb.numDirLights),gb.push(bb.numPointLights),gb.push(bb.numSpotLights),gb.push(bb.numSpotLightMaps),gb.push(bb.numHemiLights),
gb.push(bb.numRectAreaLights),gb.push(bb.numDirLightShadows),gb.push(bb.numPointLightShadows),gb.push(bb.numSpotLightShadows),gb.push(bb.numSpotLightShadowsWithMaps),gb.push(bb.numLightProbes),gb.push(bb.shadowMapType),gb.push(bb.toneMapping),gb.push(bb.numClippingPlanes),gb.push(bb.numClipIntersection),gb.push(bb.depthPacking),w.disableAll(),bb.supportsVertexTextures&&w.enable(0),bb.instancing&&w.enable(1),bb.instancingColor&&w.enable(2),bb.instancingMorph&&w.enable(3),bb.matcap&&w.enable(4),bb.envMap&&
w.enable(5),bb.normalMapObjectSpace&&w.enable(6),bb.normalMapTangentSpace&&w.enable(7),bb.clearcoat&&w.enable(8),bb.iridescence&&w.enable(9),bb.alphaTest&&w.enable(10),bb.vertexColors&&w.enable(11),bb.vertexAlphas&&w.enable(12),bb.vertexUv1s&&w.enable(13),bb.vertexUv2s&&w.enable(14),bb.vertexUv3s&&w.enable(15),bb.vertexTangents&&w.enable(16),bb.anisotropy&&w.enable(17),bb.alphaHash&&w.enable(18),bb.batching&&w.enable(19),gb.push(w.mask),w.disableAll(),bb.fog&&w.enable(0),bb.useFog&&w.enable(1),bb.flatShading&&
w.enable(2),bb.logarithmicDepthBuffer&&w.enable(3),bb.skinning&&w.enable(4),bb.morphTargets&&w.enable(5),bb.morphNormals&&w.enable(6),bb.morphColors&&w.enable(7),bb.premultipliedAlpha&&w.enable(8),bb.shadowMapEnabled&&w.enable(9),bb.useLegacyLights&&w.enable(10),bb.doubleSided&&w.enable(11),bb.flipSided&&w.enable(12),bb.useDepthPacking&&w.enable(13),bb.dithering&&w.enable(14),bb.transmission&&w.enable(15),bb.sheen&&w.enable(16),bb.opaque&&w.enable(17),bb.pointsUvs&&w.enable(18),bb.decodeVideoTexture&&
w.enable(19),bb.alphaToCoverage&&w.enable(20),gb.push(w.mask),gb.push(a.outputColorSpace));gb.push(bb.customProgramCacheKey);return gb.join()},getUniforms:function(bb){const gb=db[bb.type];return gb?pv.clone(Pf[gb].uniforms):bb.uniforms},acquireProgram:function(bb,gb){let kb;for(let qb=0,ob=z.length;qb<ob;qb++){const pb=z[qb];if(pb.cacheKey===gb){kb=pb;++kb.usedTimes;break}}void 0===kb&&(kb=new jz(a,gb,bb,n),z.push(kb));return kb},releaseProgram:function(bb){0===--bb.usedTimes&&(z[z.indexOf(bb)]=
z[z.length-1],z.pop(),bb.destroy())},releaseShaderCache:function(bb){x.remove(bb)},programs:z,dispose:function(){x.dispose()}}}function nz(){let a=new WeakMap;return{get:function(b){let e=a.get(b);void 0===e&&(e={},a.set(b,e));return e},remove:function(b){a.delete(b)},update:function(b,e,f){a.get(b)[e]=f},dispose:function(){a=new WeakMap}}}function oz(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.material.id!==b.material.id?
a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function qv(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function rv(){function a(r,t,w,x,y,z){let ab=b[e];void 0===ab?(ab={id:r.id,object:r,geometry:t,material:w,groupOrder:x,renderOrder:r.renderOrder,z:y,group:z},b[e]=ab):(ab.id=r.id,ab.object=r,ab.geometry=t,ab.material=w,ab.groupOrder=x,ab.renderOrder=r.renderOrder,ab.z=y,ab.group=z);
e++;return ab}const b=[];let e=0;const f=[],h=[],n=[];return{opaque:f,transmissive:h,transparent:n,init:function(){e=0;f.length=0;h.length=0;n.length=0},push:function(r,t,w,x,y,z){r=a(r,t,w,x,y,z);0<w.transmission?h.push(r):!0===w.transparent?n.push(r):f.push(r)},unshift:function(r,t,w,x,y,z){r=a(r,t,w,x,y,z);0<w.transmission?h.unshift(r):!0===w.transparent?n.unshift(r):f.unshift(r)},finish:function(){for(let r=e,t=b.length;r<t;r++){const w=b[r];if(null===w.id)break;w.id=null;w.object=null;w.geometry=
null;w.material=null;w.group=null}},sort:function(r,t){1<f.length&&f.sort(r||oz);1<h.length&&h.sort(t||qv);1<n.length&&n.sort(t||qv)}}}function pz(){let a=new WeakMap;return{get:function(b,e){const f=a.get(b);void 0===f?(e=new rv,a.set(b,[e])):e>=f.length?(e=new rv,f.push(e)):e=f[e];return e},dispose:function(){a=new WeakMap}}}function qz(){const a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];let e;switch(b.type){case "DirectionalLight":e={direction:new mb,color:new Tb};break;case "SpotLight":e=
{position:new mb,direction:new mb,color:new Tb,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case "PointLight":e={position:new mb,color:new Tb,distance:0,decay:0};break;case "HemisphereLight":e={direction:new mb,skyColor:new Tb,groundColor:new Tb};break;case "RectAreaLight":e={color:new Tb,position:new mb,halfWidth:new mb,halfHeight:new mb}}return a[b.id]=e}}}function rz(){const a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];let e;switch(b.type){case "DirectionalLight":e={shadowBias:0,
shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lb};break;case "SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lb};break;case "PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lb,shadowCameraNear:1,shadowCameraFar:1E3}}return a[b.id]=e}}}function sz(a,b){return(b.castShadow?2:0)-(a.castShadow?2:0)+(b.map?1:0)-(a.map?1:0)}function tz(a){const b=new qz,e=rz(),f={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 t=0;9>t;t++)f.probe.push(new mb);
const h=new mb,n=new gd,r=new gd;return{setup:function(t,w){let x=0,y=0,z=0;for(var ab=0;9>ab;ab++)f.probe[ab].set(0,0,0);let eb=ab=0,cb=0,db=0,bb=0,gb=0,kb=0,qb=0,ob=0,pb=0,ub=0;t.sort(sz);w=!0===w?Math.PI:1;for(let Ob=0,Gb=t.length;Ob<Gb;Ob++){var rb=t[Ob],Ab=rb.color,wb=rb.intensity,Cb=rb.distance,Fb=rb.shadow&&rb.shadow.map?rb.shadow.map.texture:null;if(rb.isAmbientLight)x+=Ab.r*wb*w,y+=Ab.g*wb*w,z+=Ab.b*wb*w;else if(rb.isLightProbe){for(Fb=0;9>Fb;Fb++)f.probe[Fb].addScaledVector(rb.sh.coefficients[Fb],
wb);ub++}else if(rb.isDirectionalLight)wb=b.get(rb),wb.color.copy(rb.color).multiplyScalar(rb.intensity*w),rb.castShadow&&(Ab=rb.shadow,Cb=e.get(rb),Cb.shadowBias=Ab.bias,Cb.shadowNormalBias=Ab.normalBias,Cb.shadowRadius=Ab.radius,Cb.shadowMapSize=Ab.mapSize,f.directionalShadow[ab]=Cb,f.directionalShadowMap[ab]=Fb,f.directionalShadowMatrix[ab]=rb.shadow.matrix,gb++),f.directional[ab]=wb,ab++;else if(rb.isSpotLight){const Nb=b.get(rb);Nb.position.setFromMatrixPosition(rb.matrixWorld);Nb.color.copy(Ab).multiplyScalar(wb*
w);Nb.distance=Cb;Nb.coneCos=Math.cos(rb.angle);Nb.penumbraCos=Math.cos(rb.angle*(1-rb.penumbra));Nb.decay=rb.decay;f.spot[cb]=Nb;wb=rb.shadow;rb.map&&(f.spotLightMap[ob]=rb.map,ob++,wb.updateMatrices(rb),rb.castShadow&&pb++);f.spotLightMatrix[cb]=wb.matrix;rb.castShadow&&(rb=e.get(rb),rb.shadowBias=wb.bias,rb.shadowNormalBias=wb.normalBias,rb.shadowRadius=wb.radius,rb.shadowMapSize=wb.mapSize,f.spotShadow[cb]=rb,f.spotShadowMap[cb]=Fb,qb++);cb++}else rb.isRectAreaLight?(Fb=b.get(rb),Fb.color.copy(Ab).multiplyScalar(wb),
Fb.halfWidth.set(.5*rb.width,0,0),Fb.halfHeight.set(0,.5*rb.height,0),f.rectArea[db]=Fb,db++):rb.isPointLight?(wb=b.get(rb),wb.color.copy(rb.color).multiplyScalar(rb.intensity*w),wb.distance=rb.distance,wb.decay=rb.decay,rb.castShadow&&(Ab=rb.shadow,Cb=e.get(rb),Cb.shadowBias=Ab.bias,Cb.shadowNormalBias=Ab.normalBias,Cb.shadowRadius=Ab.radius,Cb.shadowMapSize=Ab.mapSize,Cb.shadowCameraNear=Ab.camera.near,Cb.shadowCameraFar=Ab.camera.far,f.pointShadow[eb]=Cb,f.pointShadowMap[eb]=Fb,f.pointShadowMatrix[eb]=
rb.shadow.matrix,kb++),f.point[eb]=wb,eb++):rb.isHemisphereLight&&(Fb=b.get(rb),Fb.skyColor.copy(rb.color).multiplyScalar(wb*w),Fb.groundColor.copy(rb.groundColor).multiplyScalar(wb*w),f.hemi[bb]=Fb,bb++)}0<db&&(!0===a.has("OES_texture_float_linear")?(f.rectAreaLTC1=Ub.LTC_FLOAT_1,f.rectAreaLTC2=Ub.LTC_FLOAT_2):(f.rectAreaLTC1=Ub.LTC_HALF_1,f.rectAreaLTC2=Ub.LTC_HALF_2));f.ambient[0]=x;f.ambient[1]=y;f.ambient[2]=z;t=f.hash;if(t.directionalLength!==ab||t.pointLength!==eb||t.spotLength!==cb||t.rectAreaLength!==
db||t.hemiLength!==bb||t.numDirectionalShadows!==gb||t.numPointShadows!==kb||t.numSpotShadows!==qb||t.numSpotMaps!==ob||t.numLightProbes!==ub)f.directional.length=ab,f.spot.length=cb,f.rectArea.length=db,f.point.length=eb,f.hemi.length=bb,f.directionalShadow.length=gb,f.directionalShadowMap.length=gb,f.pointShadow.length=kb,f.pointShadowMap.length=kb,f.spotShadow.length=qb,f.spotShadowMap.length=qb,f.directionalShadowMatrix.length=gb,f.pointShadowMatrix.length=kb,f.spotLightMatrix.length=qb+ob-pb,
f.spotLightMap.length=ob,f.numSpotLightShadowsWithMaps=pb,f.numLightProbes=ub,t.directionalLength=ab,t.pointLength=eb,t.spotLength=cb,t.rectAreaLength=db,t.hemiLength=bb,t.numDirectionalShadows=gb,t.numPointShadows=kb,t.numSpotShadows=qb,t.numSpotMaps=ob,t.numLightProbes=ub,f.version=uz++},setupView:function(t,w){let x=0,y=0,z=0,ab=0,eb=0;w=w.matrixWorldInverse;for(let db=0,bb=t.length;db<bb;db++){const gb=t[db];if(gb.isDirectionalLight){var cb=f.directional[x];cb.direction.setFromMatrixPosition(gb.matrixWorld);
h.setFromMatrixPosition(gb.target.matrixWorld);cb.direction.sub(h);cb.direction.transformDirection(w);x++}else gb.isSpotLight?(cb=f.spot[z],cb.position.setFromMatrixPosition(gb.matrixWorld),cb.position.applyMatrix4(w),cb.direction.setFromMatrixPosition(gb.matrixWorld),h.setFromMatrixPosition(gb.target.matrixWorld),cb.direction.sub(h),cb.direction.transformDirection(w),z++):gb.isRectAreaLight?(cb=f.rectArea[ab],cb.position.setFromMatrixPosition(gb.matrixWorld),cb.position.applyMatrix4(w),r.identity(),
n.copy(gb.matrixWorld),n.premultiply(w),r.extractRotation(n),cb.halfWidth.set(.5*gb.width,0,0),cb.halfHeight.set(0,.5*gb.height,0),cb.halfWidth.applyMatrix4(r),cb.halfHeight.applyMatrix4(r),ab++):gb.isPointLight?(cb=f.point[y],cb.position.setFromMatrixPosition(gb.matrixWorld),cb.position.applyMatrix4(w),y++):gb.isHemisphereLight&&(cb=f.hemi[eb],cb.direction.setFromMatrixPosition(gb.matrixWorld),cb.direction.transformDirection(w),eb++)}},state:f}}function sv(a){const b=new tz(a),e=[],f=[];return{init:function(){e.length=
0;f.length=0},state:{lightsArray:e,shadowsArray:f,lights:b,transmissionRenderTarget:null},setupLights:function(h){b.setup(e,h)},setupLightsView:function(h){b.setupView(e,h)},pushLight:function(h){e.push(h)},pushShadow:function(h){f.push(h)}}}function vz(a){let b=new WeakMap;return{get:function(e,f=0){const h=b.get(e);void 0===h?(f=new sv(a),b.set(e,[f])):f>=h.length?(f=new sv(a),h.push(f)):f=h[f];return f},dispose:function(){b=new WeakMap}}}function wz(a,b,e){function f(ob,pb,ub,rb){ob=!0===ub.isPointLight?
ob.customDistanceMaterial:ob.customDepthMaterial;if(void 0===ob&&(ob=!0===ub.isPointLight?z:y,a.localClippingEnabled&&!0===pb.clipShadows&&Array.isArray(pb.clippingPlanes)&&0!==pb.clippingPlanes.length||pb.displacementMap&&0!==pb.displacementScale||pb.alphaMap&&0<pb.alphaTest||pb.map&&0<pb.alphaTest)){var Ab=ob.uuid;const wb=pb.uuid;let Cb=ab[Ab];void 0===Cb&&(Cb={},ab[Ab]=Cb);Ab=Cb[wb];void 0===Ab&&(Ab=ob.clone(),Cb[wb]=Ab,pb.addEventListener("dispose",n));ob=Ab}ob.visible=pb.visible;ob.wireframe=
pb.wireframe;ob.side=3===rb?null!==pb.shadowSide?pb.shadowSide:pb.side:null!==pb.shadowSide?pb.shadowSide:cb[pb.side];ob.alphaMap=pb.alphaMap;ob.alphaTest=pb.alphaTest;ob.map=pb.map;ob.clipShadows=pb.clipShadows;ob.clippingPlanes=pb.clippingPlanes;ob.clipIntersection=pb.clipIntersection;ob.displacementMap=pb.displacementMap;ob.displacementScale=pb.displacementScale;ob.displacementBias=pb.displacementBias;ob.wireframeLinewidth=pb.wireframeLinewidth;ob.linewidth=pb.linewidth;!0===ub.isPointLight&&!0===
ob.isMeshDistanceMaterial&&(a.properties.get(ob).light=ub);return ob}function h(ob,pb,ub,rb,Ab){if(!1!==ob.visible){if(ob.layers.test(pb.layers)&&(ob.isMesh||ob.isLine||ob.isPoints)&&(ob.castShadow||ob.receiveShadow&&3===Ab)&&(!ob.frustumCulled||r.intersectsObject(ob))){ob.modelViewMatrix.multiplyMatrices(ub.matrixWorldInverse,ob.matrixWorld);const Fb=b.update(ob);var wb=ob.material;if(Array.isArray(wb)){const Ob=Fb.groups;for(let Gb=0,Nb=Ob.length;Gb<Nb;Gb++){const Rb=Ob[Gb];var Cb=wb[Rb.materialIndex];
Cb&&Cb.visible&&(Cb=f(ob,Cb,rb,Ab),ob.onBeforeShadow(a,ob,pb,ub,Fb,Cb,Rb),a.renderBufferDirect(ub,null,Fb,Cb,ob,Rb),ob.onAfterShadow(a,ob,pb,ub,Fb,Cb,Rb))}}else wb.visible&&(wb=f(ob,wb,rb,Ab),ob.onBeforeShadow(a,ob,pb,ub,Fb,wb,null),a.renderBufferDirect(ub,null,Fb,wb,ob,null),ob.onAfterShadow(a,ob,pb,ub,Fb,wb,null))}ob=ob.children;for(let Fb=0,Ob=ob.length;Fb<Ob;Fb++)h(ob[Fb],pb,ub,rb,Ab)}}function n(ob){ob.target.removeEventListener("dispose",n);for(const pb in ab){const ub=ab[pb],rb=ob.target.uuid;
rb in ub&&(ub[rb].dispose(),delete ub[rb])}}let r=new hk;const t=new Lb,w=new Lb,x=new Md,y=new fp({depthPacking:3201}),z=new gp,ab={},eb=e.maxTextureSize,cb={[0]:1,[1]:0,[2]:2},db=new Of({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Lb},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}"}),
bb=db.clone();bb.defines.HORIZONTAL_PASS=1;e=new md;e.setAttribute("position",new Hd(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const gb=new Bd(e,db),kb=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;let qb=this.type=1;this.render=function(ob,pb,ub){if(!1!==kb.enabled&&(!1!==kb.autoUpdate||!1!==kb.needsUpdate)&&0!==ob.length){var rb=a.getRenderTarget(),Ab=a.getActiveCubeFace(),wb=a.getActiveMipmapLevel(),Cb=a.state;Cb.setBlending(0);Cb.buffers.color.setClear(1,1,1,1);Cb.buffers.depth.setTest(!0);
Cb.setScissorTest(!1);var Fb=3!==qb&&3===this.type,Ob=3===qb&&3!==this.type;for(let Pb=0,wd=ob.length;Pb<wd;Pb++){var Gb=ob[Pb];const Yb=Gb.shadow;if(void 0===Yb)console.warn("THREE.WebGLShadowMap:",Gb,"has no shadow.");else if(!1!==Yb.autoUpdate||!1!==Yb.needsUpdate){t.copy(Yb.mapSize);var Nb=Yb.getFrameExtents();t.multiply(Nb);w.copy(Yb.mapSize);if(t.x>eb||t.y>eb)t.x>eb&&(w.x=Math.floor(eb/Nb.x),t.x=w.x*Nb.x,Yb.mapSize.x=w.x),t.y>eb&&(w.y=Math.floor(eb/Nb.y),t.y=w.y*Nb.y,Yb.mapSize.y=w.y);if(null===
Yb.map||!0===Fb||!0===Ob)Nb=3!==this.type?{minFilter:1003,magFilter:1003}:{},null!==Yb.map&&Yb.map.dispose(),Yb.map=new Qf(t.x,t.y,Nb),Yb.map.texture.name=Gb.name+".shadowMap",Yb.camera.updateProjectionMatrix();a.setRenderTarget(Yb.map);a.clear();Nb=Yb.getViewportCount();for(var Rb=0;Rb<Nb;Rb++){const Sb=Yb.getViewport(Rb);x.set(w.x*Sb.x,w.y*Sb.y,w.x*Sb.z,w.y*Sb.w);Cb.viewport(x);Yb.updateMatrices(Gb,Rb);r=Yb.getFrustum();h(pb,ub,Yb.camera,Gb,this.type)}!0!==Yb.isPointLightShadow&&3===this.type&&
(Gb=Yb,Nb=ub,Rb=b.update(gb),db.defines.VSM_SAMPLES!==Gb.blurSamples&&(db.defines.VSM_SAMPLES=Gb.blurSamples,bb.defines.VSM_SAMPLES=Gb.blurSamples,db.needsUpdate=!0,bb.needsUpdate=!0),null===Gb.mapPass&&(Gb.mapPass=new Qf(t.x,t.y)),db.uniforms.shadow_pass.value=Gb.map.texture,db.uniforms.resolution.value=Gb.mapSize,db.uniforms.radius.value=Gb.radius,a.setRenderTarget(Gb.mapPass),a.clear(),a.renderBufferDirect(Nb,null,Rb,db,gb,null),bb.uniforms.shadow_pass.value=Gb.mapPass.texture,bb.uniforms.resolution.value=
Gb.mapSize,bb.uniforms.radius.value=Gb.radius,a.setRenderTarget(Gb.map),a.clear(),a.renderBufferDirect(Nb,null,Rb,bb,gb,null));Yb.needsUpdate=!1}}qb=this.type;kb.needsUpdate=!1;a.setRenderTarget(rb,Ab,wb)}}}function xz(a){function b(lb,Eb,Bb,Qb){const Mb=new Uint8Array(4),Wb=a.createTexture();a.bindTexture(lb,Wb);a.texParameteri(lb,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(lb,a.TEXTURE_MAG_FILTER,a.NEAREST);for(let Dd=0;Dd<Bb;Dd++)lb===a.TEXTURE_3D||lb===a.TEXTURE_2D_ARRAY?a.texImage3D(Eb,0,
a.RGBA,1,1,Qb,0,a.RGBA,a.UNSIGNED_BYTE,Mb):a.texImage2D(Eb+Dd,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,Mb);return Wb}function e(lb){!0!==eb[lb]&&(a.enable(lb),eb[lb]=!0)}function f(lb){!1!==eb[lb]&&(a.disable(lb),eb[lb]=!1)}function h(lb,Eb,Bb,Qb,Mb,Wb,Dd,Td,hf,Jd){if(0===lb)!0===kb&&(f(a.BLEND),kb=!1);else if(!1===kb&&(e(a.BLEND),kb=!0),5!==lb){if(lb!==qb||Jd!==Ob){if(100!==ob||100!==rb)a.blendEquation(a.FUNC_ADD),rb=ob=100;if(Jd)switch(lb){case 1:a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,
a.ONE_MINUS_SRC_ALPHA);break;case 2:a.blendFunc(a.ONE,a.ONE);break;case 3:a.blendFuncSeparate(a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ZERO,a.ONE);break;case 4:a.blendFuncSeparate(a.ZERO,a.SRC_COLOR,a.ZERO,a.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",lb)}else switch(lb){case 1:a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA);break;case 2:a.blendFunc(a.SRC_ALPHA,a.ONE);break;case 3:a.blendFuncSeparate(a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ZERO,a.ONE);
break;case 4:a.blendFunc(a.ZERO,a.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",lb)}wb=Ab=ub=pb=null;Cb.set(0,0,0);Fb=0;qb=lb;Ob=Jd}}else{Mb=Mb||Eb;Wb=Wb||Bb;Dd=Dd||Qb;if(Eb!==ob||Mb!==rb)a.blendEquationSeparate(Db[Eb],Db[Mb]),ob=Eb,rb=Mb;if(Bb!==pb||Qb!==ub||Wb!==Ab||Dd!==wb)a.blendFuncSeparate(yb[Bb],yb[Qb],yb[Wb],yb[Dd]),pb=Bb,ub=Qb,Ab=Wb,wb=Dd;if(!1===Td.equals(Cb)||hf!==Fb)a.blendColor(Td.r,Td.g,Td.b,hf),Cb.copy(Td),Fb=hf;qb=lb;Ob=!1}}function n(lb){Gb!==lb&&(lb?
a.frontFace(a.CW):a.frontFace(a.CCW),Gb=lb)}function r(lb){0!==lb?(e(a.CULL_FACE),lb!==Nb&&(1===lb?a.cullFace(a.BACK):2===lb?a.cullFace(a.FRONT):a.cullFace(a.FRONT_AND_BACK))):f(a.CULL_FACE);Nb=lb}function t(lb,Eb,Bb){if(lb){if(e(a.POLYGON_OFFSET_FILL),Pb!==Eb||wd!==Bb)a.polygonOffset(Eb,Bb),Pb=Eb,wd=Bb}else f(a.POLYGON_OFFSET_FILL)}const w=new function(){let lb=!1;const Eb=new Md;let Bb=null;const Qb=new Md(0,0,0,0);return{setMask:function(Mb){Bb===Mb||lb||(a.colorMask(Mb,Mb,Mb,Mb),Bb=Mb)},setLocked:function(Mb){lb=
Mb},setClear:function(Mb,Wb,Dd,Td,hf){!0===hf&&(Mb*=Td,Wb*=Td,Dd*=Td);Eb.set(Mb,Wb,Dd,Td);!1===Qb.equals(Eb)&&(a.clearColor(Mb,Wb,Dd,Td),Qb.copy(Eb))},reset:function(){lb=!1;Bb=null;Qb.set(-1,0,0,0)}}},x=new function(){let lb=!1,Eb=null,Bb=null,Qb=null;return{setTest:function(Mb){Mb?e(a.DEPTH_TEST):f(a.DEPTH_TEST)},setMask:function(Mb){Eb===Mb||lb||(a.depthMask(Mb),Eb=Mb)},setFunc:function(Mb){if(Bb!==Mb){switch(Mb){case 0:a.depthFunc(a.NEVER);break;case 1:a.depthFunc(a.ALWAYS);break;case 2:a.depthFunc(a.LESS);
break;case 3:a.depthFunc(a.LEQUAL);break;case 4:a.depthFunc(a.EQUAL);break;case 5:a.depthFunc(a.GEQUAL);break;case 6:a.depthFunc(a.GREATER);break;case 7:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}Bb=Mb}},setLocked:function(Mb){lb=Mb},setClear:function(Mb){Qb!==Mb&&(a.clearDepth(Mb),Qb=Mb)},reset:function(){lb=!1;Qb=Bb=Eb=null}}},y=new function(){let lb=!1,Eb=null,Bb=null,Qb=null,Mb=null,Wb=null,Dd=null,Td=null,hf=null;return{setTest:function(Jd){lb||(Jd?e(a.STENCIL_TEST):f(a.STENCIL_TEST))},
setMask:function(Jd){Eb===Jd||lb||(a.stencilMask(Jd),Eb=Jd)},setFunc:function(Jd,Cf,pf){if(Bb!==Jd||Qb!==Cf||Mb!==pf)a.stencilFunc(Jd,Cf,pf),Bb=Jd,Qb=Cf,Mb=pf},setOp:function(Jd,Cf,pf){if(Wb!==Jd||Dd!==Cf||Td!==pf)a.stencilOp(Jd,Cf,pf),Wb=Jd,Dd=Cf,Td=pf},setLocked:function(Jd){lb=Jd},setClear:function(Jd){hf!==Jd&&(a.clearStencil(Jd),hf=Jd)},reset:function(){lb=!1;hf=Td=Dd=Wb=Mb=Qb=Bb=Eb=null}}},z=new WeakMap,ab=new WeakMap;let eb={},cb={},db=new WeakMap,bb=[],gb=null,kb=!1,qb=null,ob=null,pb=null,
ub=null,rb=null,Ab=null,wb=null,Cb=new Tb(0,0,0),Fb=0,Ob=!1,Gb=null,Nb=null,Rb=null,Pb=null,wd=null;const Yb=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Sb=!1;var hb=0;hb=a.getParameter(a.VERSION);-1!==hb.indexOf("WebGL")?(hb=parseFloat(/^WebGL (\d)/.exec(hb)[1]),Sb=1<=hb):-1!==hb.indexOf("OpenGL ES")&&(hb=parseFloat(/^OpenGL ES (\d)/.exec(hb)[1]),Sb=2<=hb);let ib=null,nb={};hb=a.getParameter(a.SCISSOR_BOX);const tb=a.getParameter(a.VIEWPORT),sb=(new Md).fromArray(hb),zb=(new Md).fromArray(tb),
Jb={};Jb[a.TEXTURE_2D]=b(a.TEXTURE_2D,a.TEXTURE_2D,1);Jb[a.TEXTURE_CUBE_MAP]=b(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6);Jb[a.TEXTURE_2D_ARRAY]=b(a.TEXTURE_2D_ARRAY,a.TEXTURE_2D_ARRAY,1,1);Jb[a.TEXTURE_3D]=b(a.TEXTURE_3D,a.TEXTURE_3D,1,1);w.setClear(0,0,0,1);x.setClear(1);y.setClear(0);e(a.DEPTH_TEST);x.setFunc(3);n(!1);r(1);e(a.CULL_FACE);h(0);const Db={[100]:a.FUNC_ADD,[101]:a.FUNC_SUBTRACT,[102]:a.FUNC_REVERSE_SUBTRACT};Db[103]=a.MIN;Db[104]=a.MAX;const yb={[200]:a.ZERO,[201]:a.ONE,[202]:a.SRC_COLOR,
[204]:a.SRC_ALPHA,[210]:a.SRC_ALPHA_SATURATE,[208]:a.DST_COLOR,[206]:a.DST_ALPHA,[203]:a.ONE_MINUS_SRC_COLOR,[205]:a.ONE_MINUS_SRC_ALPHA,[209]:a.ONE_MINUS_DST_COLOR,[207]:a.ONE_MINUS_DST_ALPHA,[211]:a.CONSTANT_COLOR,[212]:a.ONE_MINUS_CONSTANT_COLOR,[213]:a.CONSTANT_ALPHA,[214]:a.ONE_MINUS_CONSTANT_ALPHA};return{buffers:{color:w,depth:x,stencil:y},enable:e,disable:f,bindFramebuffer:function(lb,Eb){return cb[lb]!==Eb?(a.bindFramebuffer(lb,Eb),cb[lb]=Eb,lb===a.DRAW_FRAMEBUFFER&&(cb[a.FRAMEBUFFER]=Eb),
lb===a.FRAMEBUFFER&&(cb[a.DRAW_FRAMEBUFFER]=Eb),!0):!1},drawBuffers:function(lb,Eb){let Bb=bb,Qb=!1;if(lb){if(Bb=db.get(Eb),void 0===Bb&&(Bb=[],db.set(Eb,Bb)),lb=lb.textures,Bb.length!==lb.length||Bb[0]!==a.COLOR_ATTACHMENT0){for(let Mb=0,Wb=lb.length;Mb<Wb;Mb++)Bb[Mb]=a.COLOR_ATTACHMENT0+Mb;Bb.length=lb.length;Qb=!0}}else Bb[0]!==a.BACK&&(Bb[0]=a.BACK,Qb=!0);Qb&&a.drawBuffers(Bb)},useProgram:function(lb){return gb!==lb?(a.useProgram(lb),gb=lb,!0):!1},setBlending:h,setMaterial:function(lb,Eb){2===
lb.side?f(a.CULL_FACE):e(a.CULL_FACE);let Bb=1===lb.side;Eb&&(Bb=!Bb);n(Bb);1===lb.blending&&!1===lb.transparent?h(0):h(lb.blending,lb.blendEquation,lb.blendSrc,lb.blendDst,lb.blendEquationAlpha,lb.blendSrcAlpha,lb.blendDstAlpha,lb.blendColor,lb.blendAlpha,lb.premultipliedAlpha);x.setFunc(lb.depthFunc);x.setTest(lb.depthTest);x.setMask(lb.depthWrite);w.setMask(lb.colorWrite);Eb=lb.stencilWrite;y.setTest(Eb);Eb&&(y.setMask(lb.stencilWriteMask),y.setFunc(lb.stencilFunc,lb.stencilRef,lb.stencilFuncMask),
y.setOp(lb.stencilFail,lb.stencilZFail,lb.stencilZPass));t(lb.polygonOffset,lb.polygonOffsetFactor,lb.polygonOffsetUnits);!0===lb.alphaToCoverage?e(a.SAMPLE_ALPHA_TO_COVERAGE):f(a.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:n,setCullFace:r,setLineWidth:function(lb){lb!==Rb&&(Sb&&a.lineWidth(lb),Rb=lb)},setPolygonOffset:t,setScissorTest:function(lb){lb?e(a.SCISSOR_TEST):f(a.SCISSOR_TEST)},activeTexture:function(lb){void 0===lb&&(lb=a.TEXTURE0+Yb-1);ib!==lb&&(a.activeTexture(lb),ib=lb)},bindTexture:function(lb,
Eb,Bb){void 0===Bb&&(Bb=null===ib?a.TEXTURE0+Yb-1:ib);let Qb=nb[Bb];void 0===Qb&&(Qb={type:void 0,texture:void 0},nb[Bb]=Qb);if(Qb.type!==lb||Qb.texture!==Eb)ib!==Bb&&(a.activeTexture(Bb),ib=Bb),a.bindTexture(lb,Eb||Jb[lb]),Qb.type=lb,Qb.texture=Eb},unbindTexture:function(){const lb=nb[ib];void 0!==lb&&void 0!==lb.type&&(a.bindTexture(lb.type,null),lb.type=void 0,lb.texture=void 0)},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",
lb)}},compressedTexImage3D:function(){try{a.compressedTexImage3D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},texImage2D:function(){try{a.texImage2D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},texImage3D:function(){try{a.texImage3D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},updateUBOMapping:function(lb,Eb){let Bb=ab.get(Eb);void 0===Bb&&(Bb=new WeakMap,ab.set(Eb,Bb));let Qb=Bb.get(lb);void 0===Qb&&(Qb=a.getUniformBlockIndex(Eb,
lb.name),Bb.set(lb,Qb))},uniformBlockBinding:function(lb,Eb){const Bb=ab.get(Eb).get(lb);z.get(Eb)!==Bb&&(a.uniformBlockBinding(Eb,Bb,lb.__bindingPointIndex),z.set(Eb,Bb))},texStorage2D:function(){try{a.texStorage2D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},texStorage3D:function(){try{a.texStorage3D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},texSubImage2D:function(){try{a.texSubImage2D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",
lb)}},texSubImage3D:function(){try{a.texSubImage3D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},compressedTexSubImage2D:function(){try{a.compressedTexSubImage2D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},compressedTexSubImage3D:function(){try{a.compressedTexSubImage3D.apply(a,arguments)}catch(lb){console.error("THREE.WebGLState:",lb)}},scissor:function(lb){!1===sb.equals(lb)&&(a.scissor(lb.x,lb.y,lb.z,lb.w),sb.copy(lb))},viewport:function(lb){!1===
zb.equals(lb)&&(a.viewport(lb.x,lb.y,lb.z,lb.w),zb.copy(lb))},reset:function(){a.disable(a.BLEND);a.disable(a.CULL_FACE);a.disable(a.DEPTH_TEST);a.disable(a.POLYGON_OFFSET_FILL);a.disable(a.SCISSOR_TEST);a.disable(a.STENCIL_TEST);a.disable(a.SAMPLE_ALPHA_TO_COVERAGE);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.ONE,a.ZERO);a.blendFuncSeparate(a.ONE,a.ZERO,a.ONE,a.ZERO);a.blendColor(0,0,0,0);a.colorMask(!0,!0,!0,!0);a.clearColor(0,0,0,0);a.depthMask(!0);a.depthFunc(a.LESS);a.clearDepth(1);a.stencilMask(4294967295);
a.stencilFunc(a.ALWAYS,0,4294967295);a.stencilOp(a.KEEP,a.KEEP,a.KEEP);a.clearStencil(0);a.cullFace(a.BACK);a.frontFace(a.CCW);a.polygonOffset(0,0);a.activeTexture(a.TEXTURE0);a.bindFramebuffer(a.FRAMEBUFFER,null);a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null);a.bindFramebuffer(a.READ_FRAMEBUFFER,null);a.useProgram(null);a.lineWidth(1);a.scissor(0,0,a.canvas.width,a.canvas.height);a.viewport(0,0,a.canvas.width,a.canvas.height);eb={};ib=null;nb={};cb={};db=new WeakMap;bb=[];gb=null;kb=!1;wb=Ab=rb=ub=pb=
ob=qb=null;Cb=new Tb(0,0,0);Fb=0;Ob=!1;wd=Pb=Rb=Nb=Gb=null;sb.set(0,0,a.canvas.width,a.canvas.height);zb.set(0,0,a.canvas.width,a.canvas.height);w.reset();x.reset();y.reset()}}}function yz(a,b,e,f,h,n,r){function t(hb,ib,nb){var tb=1;const sb=Ab(hb);if(sb.width>nb||sb.height>nb)tb=nb/Math.max(sb.width,sb.height);if(1>tb){if("undefined"!==typeof HTMLImageElement&&hb instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&hb instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&
hb instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&hb instanceof VideoFrame)return nb=Math.floor(tb*sb.width),tb=Math.floor(tb*sb.height),void 0===Gb&&(Gb=Rb?new OffscreenCanvas(nb,tb):wj("canvas")),ib=ib?Rb?new OffscreenCanvas(nb,tb):wj("canvas"):Gb,ib.width=nb,ib.height=tb,ib.getContext("2d").drawImage(hb,0,0,nb,tb),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+sb.width+"x"+sb.height+") to ("+nb+"x"+tb+")."),ib;"data"in hb&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+
sb.width+"x"+sb.height+").")}return hb}function w(hb){return hb.generateMipmaps&&1003!==hb.minFilter&&1006!==hb.minFilter}function x(hb,ib,nb,tb,sb=!1){if(null!==hb){if(void 0!==a[hb])return a[hb];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+hb+"'")}hb=ib;ib===a.RED&&(nb===a.FLOAT&&(hb=a.R32F),nb===a.HALF_FLOAT&&(hb=a.R16F),nb===a.UNSIGNED_BYTE&&(hb=a.R8));ib===a.RED_INTEGER&&(nb===a.UNSIGNED_BYTE&&(hb=a.R8UI),nb===a.UNSIGNED_SHORT&&(hb=a.R16UI),nb===a.UNSIGNED_INT&&
(hb=a.R32UI),nb===a.BYTE&&(hb=a.R8I),nb===a.SHORT&&(hb=a.R16I),nb===a.INT&&(hb=a.R32I));ib===a.RG&&(nb===a.FLOAT&&(hb=a.RG32F),nb===a.HALF_FLOAT&&(hb=a.RG16F),nb===a.UNSIGNED_BYTE&&(hb=a.RG8));ib===a.RG_INTEGER&&(nb===a.UNSIGNED_BYTE&&(hb=a.RG8UI),nb===a.UNSIGNED_SHORT&&(hb=a.RG16UI),nb===a.UNSIGNED_INT&&(hb=a.RG32UI),nb===a.BYTE&&(hb=a.RG8I),nb===a.SHORT&&(hb=a.RG16I),nb===a.INT&&(hb=a.RG32I));ib===a.RGB&&nb===a.UNSIGNED_INT_5_9_9_9_REV&&(hb=a.RGB9_E5);ib===a.RGBA&&(ib=sb?"linear":Fd.getTransfer(tb),
nb===a.FLOAT&&(hb=a.RGBA32F),nb===a.HALF_FLOAT&&(hb=a.RGBA16F),nb===a.UNSIGNED_BYTE&&(hb="srgb"===ib?a.SRGB8_ALPHA8:a.RGBA8),nb===a.UNSIGNED_SHORT_4_4_4_4&&(hb=a.RGBA4),nb===a.UNSIGNED_SHORT_5_5_5_1&&(hb=a.RGB5_A1));hb!==a.R16F&&hb!==a.R32F&&hb!==a.RG16F&&hb!==a.RG32F&&hb!==a.RGBA16F&&hb!==a.RGBA32F||b.get("EXT_color_buffer_float");return hb}function y(hb,ib){return!0===w(hb)||hb.isFramebufferTexture&&1003!==hb.minFilter&&1006!==hb.minFilter?Math.log2(Math.max(ib.width,ib.height))+1:void 0!==hb.mipmaps&&
0<hb.mipmaps.length?hb.mipmaps.length:hb.isCompressedTexture&&Array.isArray(hb.image)?ib.mipmaps.length:1}function z(hb){hb=hb.target;hb.removeEventListener("dispose",z);var ib=f.get(hb);if(void 0!==ib.__webglInit){var nb=hb.source,tb=Nb.get(nb);tb&&(ib=tb[ib.__cacheKey],ib.usedTimes--,0===ib.usedTimes&&eb(hb),0===Object.keys(tb).length&&Nb.delete(nb));f.remove(hb)}hb.isVideoTexture&&Ob.delete(hb)}function ab(hb){hb=hb.target;hb.removeEventListener("dispose",ab);var ib=f.get(hb);hb.depthTexture&&
hb.depthTexture.dispose();if(hb.isWebGLCubeRenderTarget)for(var nb=0;6>nb;nb++){if(Array.isArray(ib.__webglFramebuffer[nb]))for(let tb=0;tb<ib.__webglFramebuffer[nb].length;tb++)a.deleteFramebuffer(ib.__webglFramebuffer[nb][tb]);else a.deleteFramebuffer(ib.__webglFramebuffer[nb]);ib.__webglDepthbuffer&&a.deleteRenderbuffer(ib.__webglDepthbuffer[nb])}else{if(Array.isArray(ib.__webglFramebuffer))for(nb=0;nb<ib.__webglFramebuffer.length;nb++)a.deleteFramebuffer(ib.__webglFramebuffer[nb]);else a.deleteFramebuffer(ib.__webglFramebuffer);
ib.__webglDepthbuffer&&a.deleteRenderbuffer(ib.__webglDepthbuffer);ib.__webglMultisampledFramebuffer&&a.deleteFramebuffer(ib.__webglMultisampledFramebuffer);if(ib.__webglColorRenderbuffer)for(nb=0;nb<ib.__webglColorRenderbuffer.length;nb++)ib.__webglColorRenderbuffer[nb]&&a.deleteRenderbuffer(ib.__webglColorRenderbuffer[nb]);ib.__webglDepthRenderbuffer&&a.deleteRenderbuffer(ib.__webglDepthRenderbuffer)}ib=hb.textures;for(let tb=0,sb=ib.length;tb<sb;tb++)nb=f.get(ib[tb]),nb.__webglTexture&&(a.deleteTexture(nb.__webglTexture),
r.memory.textures--),f.remove(ib[tb]);f.remove(hb)}function eb(hb){const ib=f.get(hb);a.deleteTexture(ib.__webglTexture);delete Nb.get(hb.source)[ib.__cacheKey];r.memory.textures--}function cb(hb,ib){const nb=f.get(hb);if(hb.isVideoTexture){var tb=r.render.frame;Ob.get(hb)!==tb&&(Ob.set(hb,tb),hb.update())}if(!1===hb.isRenderTargetTexture&&0<hb.version&&nb.__version!==hb.version)if(tb=hb.image,null===tb)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===
tb.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{gb(nb,hb,ib);return}e.bindTexture(a.TEXTURE_2D,nb.__webglTexture,a.TEXTURE0+ib)}function db(hb,ib){1015!==ib.type||!1!==b.has("OES_texture_float_linear")||1006!==ib.magFilter&&1007!==ib.magFilter&&1005!==ib.magFilter&&1008!==ib.magFilter&&1006!==ib.minFilter&&1007!==ib.minFilter&&1005!==ib.minFilter&&1008!==ib.minFilter||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");
a.texParameteri(hb,a.TEXTURE_WRAP_S,wd[ib.wrapS]);a.texParameteri(hb,a.TEXTURE_WRAP_T,wd[ib.wrapT]);hb!==a.TEXTURE_3D&&hb!==a.TEXTURE_2D_ARRAY||a.texParameteri(hb,a.TEXTURE_WRAP_R,wd[ib.wrapR]);a.texParameteri(hb,a.TEXTURE_MAG_FILTER,Yb[ib.magFilter]);a.texParameteri(hb,a.TEXTURE_MIN_FILTER,Yb[ib.minFilter]);ib.compareFunction&&(a.texParameteri(hb,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(hb,a.TEXTURE_COMPARE_FUNC,Sb[ib.compareFunction]));if(!0===b.has("EXT_texture_filter_anisotropic")&&
!(1003===ib.magFilter||1005!==ib.minFilter&&1008!==ib.minFilter||1015===ib.type&&!1===b.has("OES_texture_float_linear"))&&(1<ib.anisotropy||f.get(ib).__currentAnisotropy)){const nb=b.get("EXT_texture_filter_anisotropic");a.texParameterf(hb,nb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ib.anisotropy,h.getMaxAnisotropy()));f.get(ib).__currentAnisotropy=ib.anisotropy}}function bb(hb,ib){let nb=!1;void 0===hb.__webglInit&&(hb.__webglInit=!0,ib.addEventListener("dispose",z));var tb=ib.source;let sb=Nb.get(tb);
void 0===sb&&(sb={},Nb.set(tb,sb));tb=[];tb.push(ib.wrapS);tb.push(ib.wrapT);tb.push(ib.wrapR||0);tb.push(ib.magFilter);tb.push(ib.minFilter);tb.push(ib.anisotropy);tb.push(ib.internalFormat);tb.push(ib.format);tb.push(ib.type);tb.push(ib.generateMipmaps);tb.push(ib.premultiplyAlpha);tb.push(ib.flipY);tb.push(ib.unpackAlignment);tb.push(ib.colorSpace);tb=tb.join();if(tb!==hb.__cacheKey){void 0===sb[tb]&&(sb[tb]={texture:a.createTexture(),usedTimes:0},r.memory.textures++,nb=!0);sb[tb].usedTimes++;
const zb=sb[hb.__cacheKey];void 0!==zb&&(sb[hb.__cacheKey].usedTimes--,0===zb.usedTimes&&eb(ib));hb.__cacheKey=tb;hb.__webglTexture=sb[tb].texture}return nb}function gb(hb,ib,nb){let tb=a.TEXTURE_2D;if(ib.isDataArrayTexture||ib.isCompressedArrayTexture)tb=a.TEXTURE_2D_ARRAY;ib.isData3DTexture&&(tb=a.TEXTURE_3D);var sb=bb(hb,ib);const zb=ib.source;e.bindTexture(tb,hb.__webglTexture,a.TEXTURE0+nb);const Jb=f.get(zb);if(zb.version!==Jb.__version||!0===sb){e.activeTexture(a.TEXTURE0+nb);nb=Fd.getPrimaries(Fd.workingColorSpace);
var Db=""===ib.colorSpace?null:Fd.getPrimaries(ib.colorSpace);nb=""===ib.colorSpace||nb===Db?a.NONE:a.BROWSER_DEFAULT_WEBGL;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,ib.flipY);a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ib.premultiplyAlpha);a.pixelStorei(a.UNPACK_ALIGNMENT,ib.unpackAlignment);a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,nb);var yb=t(ib.image,!1,h.maxTextureSize);yb=rb(ib,yb);nb=n.convert(ib.format,ib.colorSpace);Db=n.convert(ib.type);let Bb=x(ib.internalFormat,nb,Db,ib.colorSpace,
ib.isVideoTexture);db(tb,ib);var lb=ib.mipmaps,Eb=!0!==ib.isVideoTexture&&36196!==Bb;const Qb=void 0===Jb.__version||!0===sb,Mb=zb.dataReady;sb=y(ib,yb);if(ib.isDepthTexture)Bb=a.DEPTH_COMPONENT16,1015===ib.type?Bb=a.DEPTH_COMPONENT32F:1014===ib.type?Bb=a.DEPTH_COMPONENT24:1020===ib.type&&(Bb=a.DEPTH24_STENCIL8),Qb&&(Eb?e.texStorage2D(a.TEXTURE_2D,1,Bb,yb.width,yb.height):e.texImage2D(a.TEXTURE_2D,0,Bb,yb.width,yb.height,0,nb,Db,null));else if(ib.isDataTexture)if(0<lb.length){Eb&&Qb&&e.texStorage2D(a.TEXTURE_2D,
sb,Bb,lb[0].width,lb[0].height);for(let Wb=0,Dd=lb.length;Wb<Dd;Wb++)sb=lb[Wb],Eb?Mb&&e.texSubImage2D(a.TEXTURE_2D,Wb,0,0,sb.width,sb.height,nb,Db,sb.data):e.texImage2D(a.TEXTURE_2D,Wb,Bb,sb.width,sb.height,0,nb,Db,sb.data);ib.generateMipmaps=!1}else Eb?(Qb&&e.texStorage2D(a.TEXTURE_2D,sb,Bb,yb.width,yb.height),Mb&&e.texSubImage2D(a.TEXTURE_2D,0,0,0,yb.width,yb.height,nb,Db,yb.data)):e.texImage2D(a.TEXTURE_2D,0,Bb,yb.width,yb.height,0,nb,Db,yb.data);else if(ib.isCompressedTexture)if(ib.isCompressedArrayTexture){Eb&&
Qb&&e.texStorage3D(a.TEXTURE_2D_ARRAY,sb,Bb,lb[0].width,lb[0].height,yb.depth);for(let Wb=0,Dd=lb.length;Wb<Dd;Wb++)sb=lb[Wb],1023!==ib.format?null!==nb?Eb?Mb&&e.compressedTexSubImage3D(a.TEXTURE_2D_ARRAY,Wb,0,0,0,sb.width,sb.height,yb.depth,nb,sb.data,0,0):e.compressedTexImage3D(a.TEXTURE_2D_ARRAY,Wb,Bb,sb.width,sb.height,yb.depth,0,sb.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Eb?Mb&&e.texSubImage3D(a.TEXTURE_2D_ARRAY,
Wb,0,0,0,sb.width,sb.height,yb.depth,nb,Db,sb.data):e.texImage3D(a.TEXTURE_2D_ARRAY,Wb,Bb,sb.width,sb.height,yb.depth,0,nb,Db,sb.data)}else{Eb&&Qb&&e.texStorage2D(a.TEXTURE_2D,sb,Bb,lb[0].width,lb[0].height);for(let Wb=0,Dd=lb.length;Wb<Dd;Wb++)sb=lb[Wb],1023!==ib.format?null!==nb?Eb?Mb&&e.compressedTexSubImage2D(a.TEXTURE_2D,Wb,0,0,sb.width,sb.height,nb,sb.data):e.compressedTexImage2D(a.TEXTURE_2D,Wb,Bb,sb.width,sb.height,0,sb.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):
Eb?Mb&&e.texSubImage2D(a.TEXTURE_2D,Wb,0,0,sb.width,sb.height,nb,Db,sb.data):e.texImage2D(a.TEXTURE_2D,Wb,Bb,sb.width,sb.height,0,nb,Db,sb.data)}else if(ib.isDataArrayTexture)Eb?(Qb&&e.texStorage3D(a.TEXTURE_2D_ARRAY,sb,Bb,yb.width,yb.height,yb.depth),Mb&&e.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,0,yb.width,yb.height,yb.depth,nb,Db,yb.data)):e.texImage3D(a.TEXTURE_2D_ARRAY,0,Bb,yb.width,yb.height,yb.depth,0,nb,Db,yb.data);else if(ib.isData3DTexture)Eb?(Qb&&e.texStorage3D(a.TEXTURE_3D,sb,Bb,yb.width,
yb.height,yb.depth),Mb&&e.texSubImage3D(a.TEXTURE_3D,0,0,0,0,yb.width,yb.height,yb.depth,nb,Db,yb.data)):e.texImage3D(a.TEXTURE_3D,0,Bb,yb.width,yb.height,yb.depth,0,nb,Db,yb.data);else if(ib.isFramebufferTexture){if(Qb)if(Eb)e.texStorage2D(a.TEXTURE_2D,sb,Bb,yb.width,yb.height);else for(lb=yb.width,yb=yb.height,Eb=0;Eb<sb;Eb++)e.texImage2D(a.TEXTURE_2D,Eb,Bb,lb,yb,0,nb,Db,null),lb>>=1,yb>>=1}else if(0<lb.length){Eb&&Qb&&(yb=Ab(lb[0]),e.texStorage2D(a.TEXTURE_2D,sb,Bb,yb.width,yb.height));for(let Wb=
0,Dd=lb.length;Wb<Dd;Wb++)sb=lb[Wb],Eb?Mb&&e.texSubImage2D(a.TEXTURE_2D,Wb,0,0,nb,Db,sb):e.texImage2D(a.TEXTURE_2D,Wb,Bb,nb,Db,sb);ib.generateMipmaps=!1}else Eb?(Qb&&(lb=Ab(yb),e.texStorage2D(a.TEXTURE_2D,sb,Bb,lb.width,lb.height)),Mb&&e.texSubImage2D(a.TEXTURE_2D,0,0,0,nb,Db,yb)):e.texImage2D(a.TEXTURE_2D,0,Bb,nb,Db,yb);w(ib)&&a.generateMipmap(tb);Jb.__version=zb.version;if(ib.onUpdate)ib.onUpdate(ib)}hb.__version=ib.version}function kb(hb,ib,nb,tb,sb,zb){const Jb=n.convert(nb.format,nb.colorSpace),
Db=n.convert(nb.type),yb=x(nb.internalFormat,Jb,Db,nb.colorSpace);if(!f.get(ib).__hasExternalTextures){const lb=Math.max(1,ib.width>>zb),Eb=Math.max(1,ib.height>>zb);sb===a.TEXTURE_3D||sb===a.TEXTURE_2D_ARRAY?e.texImage3D(sb,zb,yb,lb,Eb,ib.depth,0,Jb,Db,null):e.texImage2D(sb,zb,yb,lb,Eb,0,Jb,Db,null)}e.bindFramebuffer(a.FRAMEBUFFER,hb);ub(ib)?wb.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,tb,sb,f.get(nb).__webglTexture,0,pb(ib)):(sb===a.TEXTURE_2D||sb>=a.TEXTURE_CUBE_MAP_POSITIVE_X&&sb<=a.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&
a.framebufferTexture2D(a.FRAMEBUFFER,tb,sb,f.get(nb).__webglTexture,zb);e.bindFramebuffer(a.FRAMEBUFFER,null)}function qb(hb,ib,nb){a.bindRenderbuffer(a.RENDERBUFFER,hb);if(ib.depthBuffer&&!ib.stencilBuffer){var tb=a.DEPTH_COMPONENT24;nb||ub(ib)?((nb=ib.depthTexture)&&nb.isDepthTexture&&(1015===nb.type?tb=a.DEPTH_COMPONENT32F:1014===nb.type&&(tb=a.DEPTH_COMPONENT24)),nb=pb(ib),ub(ib)?wb.renderbufferStorageMultisampleEXT(a.RENDERBUFFER,nb,tb,ib.width,ib.height):a.renderbufferStorageMultisample(a.RENDERBUFFER,
nb,tb,ib.width,ib.height)):a.renderbufferStorage(a.RENDERBUFFER,tb,ib.width,ib.height);a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,hb)}else if(ib.depthBuffer&&ib.stencilBuffer)tb=pb(ib),nb&&!1===ub(ib)?a.renderbufferStorageMultisample(a.RENDERBUFFER,tb,a.DEPTH24_STENCIL8,ib.width,ib.height):ub(ib)?wb.renderbufferStorageMultisampleEXT(a.RENDERBUFFER,tb,a.DEPTH24_STENCIL8,ib.width,ib.height):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,ib.width,ib.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,
a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,hb);else for(hb=ib.textures,tb=0;tb<hb.length;tb++){var sb=hb[tb],zb=n.convert(sb.format,sb.colorSpace);const Jb=n.convert(sb.type);sb=x(sb.internalFormat,zb,Jb,sb.colorSpace);zb=pb(ib);nb&&!1===ub(ib)?a.renderbufferStorageMultisample(a.RENDERBUFFER,zb,sb,ib.width,ib.height):ub(ib)?wb.renderbufferStorageMultisampleEXT(a.RENDERBUFFER,zb,sb,ib.width,ib.height):a.renderbufferStorage(a.RENDERBUFFER,sb,ib.width,ib.height)}a.bindRenderbuffer(a.RENDERBUFFER,null)}
function ob(hb){var ib=f.get(hb),nb=!0===hb.isWebGLCubeRenderTarget;if(hb.depthTexture&&!ib.__autoAllocateDepthBuffer){if(nb)throw Error("target.depthTexture not supported in Cube render targets");ib=ib.__webglFramebuffer;if(hb&&hb.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");e.bindFramebuffer(a.FRAMEBUFFER,ib);if(!hb.depthTexture||!hb.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");f.get(hb.depthTexture).__webglTexture&&
hb.depthTexture.image.width===hb.width&&hb.depthTexture.image.height===hb.height||(hb.depthTexture.image.width=hb.width,hb.depthTexture.image.height=hb.height,hb.depthTexture.needsUpdate=!0);cb(hb.depthTexture,0);ib=f.get(hb.depthTexture).__webglTexture;nb=pb(hb);if(1026===hb.depthTexture.format)ub(hb)?wb.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,ib,0,nb):a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,ib,0);else if(1027===hb.depthTexture.format)ub(hb)?
wb.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,ib,0,nb):a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,ib,0);else throw Error("Unknown depthTexture format");}else if(nb)for(ib.__webglDepthbuffer=[],nb=0;6>nb;nb++)e.bindFramebuffer(a.FRAMEBUFFER,ib.__webglFramebuffer[nb]),ib.__webglDepthbuffer[nb]=a.createRenderbuffer(),qb(ib.__webglDepthbuffer[nb],hb,!1);else e.bindFramebuffer(a.FRAMEBUFFER,ib.__webglFramebuffer),ib.__webglDepthbuffer=
a.createRenderbuffer(),qb(ib.__webglDepthbuffer,hb,!1);e.bindFramebuffer(a.FRAMEBUFFER,null)}function pb(hb){return Math.min(h.maxSamples,hb.samples)}function ub(hb){const ib=f.get(hb);return 0<hb.samples&&!0===b.has("WEBGL_multisampled_render_to_texture")&&!1!==ib.__useRenderToTexture}function rb(hb,ib){const nb=hb.colorSpace,tb=hb.format,sb=hb.type;if(!0===hb.isCompressedTexture||!0===hb.isVideoTexture)return ib;"srgb-linear"!==nb&&""!==nb&&("srgb"===Fd.getTransfer(nb)?(1023!==tb||1009!==sb)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):
console.error("THREE.WebGLTextures: Unsupported texture color space:",nb));return ib}function Ab(hb){"undefined"!==typeof HTMLImageElement&&hb instanceof HTMLImageElement?(Fb.width=hb.naturalWidth||hb.width,Fb.height=hb.naturalHeight||hb.height):"undefined"!==typeof VideoFrame&&hb instanceof VideoFrame?(Fb.width=hb.displayWidth,Fb.height=hb.displayHeight):(Fb.width=hb.width,Fb.height=hb.height);return Fb}const wb=b.has("WEBGL_multisampled_render_to_texture")?b.get("WEBGL_multisampled_render_to_texture"):
null,Cb="undefined"===typeof navigator?!1:/OculusBrowser/g.test(navigator.userAgent),Fb=new Lb,Ob=new WeakMap;let Gb;const Nb=new WeakMap;let Rb=!1;try{Rb="undefined"!==typeof OffscreenCanvas&&null!==(new OffscreenCanvas(1,1)).getContext("2d")}catch(hb){}let Pb=0;const wd={[1E3]:a.REPEAT,[1001]:a.CLAMP_TO_EDGE,[1002]:a.MIRRORED_REPEAT},Yb={[1003]:a.NEAREST,[1004]:a.NEAREST_MIPMAP_NEAREST,[1005]:a.NEAREST_MIPMAP_LINEAR,[1006]:a.LINEAR,[1007]:a.LINEAR_MIPMAP_NEAREST,[1008]:a.LINEAR_MIPMAP_LINEAR},Sb=
{[512]:a.NEVER,[519]:a.ALWAYS,[513]:a.LESS,[515]:a.LEQUAL,[514]:a.EQUAL,[518]:a.GEQUAL,[516]:a.GREATER,[517]:a.NOTEQUAL};this.allocateTextureUnit=function(){const hb=Pb;hb>=h.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+hb+" texture units while this GPU supports only "+h.maxTextures);Pb+=1;return hb};this.resetTextureUnits=function(){Pb=0};this.setTexture2D=cb;this.setTexture2DArray=function(hb,ib){const nb=f.get(hb);0<hb.version&&nb.__version!==hb.version?gb(nb,hb,ib):e.bindTexture(a.TEXTURE_2D_ARRAY,
nb.__webglTexture,a.TEXTURE0+ib)};this.setTexture3D=function(hb,ib){const nb=f.get(hb);0<hb.version&&nb.__version!==hb.version?gb(nb,hb,ib):e.bindTexture(a.TEXTURE_3D,nb.__webglTexture,a.TEXTURE0+ib)};this.setTextureCube=function(hb,ib){const nb=f.get(hb);if(0<hb.version&&nb.__version!==hb.version){if(6===hb.image.length){var tb=bb(nb,hb),sb=hb.source;e.bindTexture(a.TEXTURE_CUBE_MAP,nb.__webglTexture,a.TEXTURE0+ib);var zb=f.get(sb);if(sb.version!==zb.__version||!0===tb){e.activeTexture(a.TEXTURE0+
ib);ib=Fd.getPrimaries(Fd.workingColorSpace);var Jb=""===hb.colorSpace?null:Fd.getPrimaries(hb.colorSpace);ib=""===hb.colorSpace||ib===Jb?a.NONE:a.BROWSER_DEFAULT_WEBGL;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,hb.flipY);a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,hb.premultiplyAlpha);a.pixelStorei(a.UNPACK_ALIGNMENT,hb.unpackAlignment);a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,ib);var Db=hb.isCompressedTexture||hb.image[0].isCompressedTexture,yb=hb.image[0]&&hb.image[0].isDataTexture;ib=[];
for(Jb=0;6>Jb;Jb++)ib[Jb]=Db||yb?yb?hb.image[Jb].image:hb.image[Jb]:t(hb.image[Jb],!0,h.maxCubemapSize),ib[Jb]=rb(hb,ib[Jb]);var lb=ib[0];Jb=n.convert(hb.format,hb.colorSpace);const Qb=n.convert(hb.type),Mb=x(hb.internalFormat,Jb,Qb,hb.colorSpace),Wb=!0!==hb.isVideoTexture;var Eb=void 0===zb.__version||!0===tb;tb=sb.dataReady;var Bb=y(hb,lb);db(a.TEXTURE_CUBE_MAP,hb);if(Db)for(Wb&&Eb&&e.texStorage2D(a.TEXTURE_CUBE_MAP,Bb,Mb,lb.width,lb.height),yb=0;6>yb;yb++)for(Db=ib[yb].mipmaps,Bb=0;Bb<Db.length;Bb++)lb=
Db[Bb],1023!==hb.format?null!==Jb?Wb?tb&&e.compressedTexSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+yb,Bb,0,0,lb.width,lb.height,Jb,lb.data):e.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+yb,Bb,Mb,lb.width,lb.height,0,lb.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Wb?tb&&e.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+yb,Bb,0,0,lb.width,lb.height,Jb,Qb,lb.data):e.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+yb,Bb,Mb,lb.width,lb.height,
0,Jb,Qb,lb.data);else for(Db=hb.mipmaps,Wb&&Eb&&(0<Db.length&&Bb++,lb=Ab(ib[0]),e.texStorage2D(a.TEXTURE_CUBE_MAP,Bb,Mb,lb.width,lb.height)),Bb=0;6>Bb;Bb++)if(yb)for(Wb?tb&&e.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,0,0,0,ib[Bb].width,ib[Bb].height,Jb,Qb,ib[Bb].data):e.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,0,Mb,ib[Bb].width,ib[Bb].height,0,Jb,Qb,ib[Bb].data),lb=0;lb<Db.length;lb++)Eb=Db[lb].image[Bb].image,Wb?tb&&e.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,lb+1,0,0,Eb.width,Eb.height,
Jb,Qb,Eb.data):e.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,lb+1,Mb,Eb.width,Eb.height,0,Jb,Qb,Eb.data);else for(Wb?tb&&e.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,0,0,0,Jb,Qb,ib[Bb]):e.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,0,Mb,Jb,Qb,ib[Bb]),lb=0;lb<Db.length;lb++)Eb=Db[lb],Wb?tb&&e.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,lb+1,0,0,Jb,Qb,Eb.image[Bb]):e.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+Bb,lb+1,Mb,Jb,Qb,Eb.image[Bb]);w(hb)&&a.generateMipmap(a.TEXTURE_CUBE_MAP);zb.__version=
sb.version;if(hb.onUpdate)hb.onUpdate(hb)}nb.__version=hb.version}}else e.bindTexture(a.TEXTURE_CUBE_MAP,nb.__webglTexture,a.TEXTURE0+ib)};this.rebindTextures=function(hb,ib,nb){const tb=f.get(hb);void 0!==ib&&kb(tb.__webglFramebuffer,hb,hb.texture,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,0);void 0!==nb&&ob(hb)};this.setupRenderTarget=function(hb){var ib=hb.texture;const nb=f.get(hb);var tb=f.get(ib);hb.addEventListener("dispose",ab);var sb=hb.textures;const zb=!0===hb.isWebGLCubeRenderTarget,Jb=1<sb.length;
Jb||(void 0===tb.__webglTexture&&(tb.__webglTexture=a.createTexture()),tb.__version=ib.version,r.memory.textures++);if(zb){nb.__webglFramebuffer=[];for(var Db=0;6>Db;Db++)if(ib.mipmaps&&0<ib.mipmaps.length){nb.__webglFramebuffer[Db]=[];for(var yb=0;yb<ib.mipmaps.length;yb++)nb.__webglFramebuffer[Db][yb]=a.createFramebuffer()}else nb.__webglFramebuffer[Db]=a.createFramebuffer()}else{if(ib.mipmaps&&0<ib.mipmaps.length)for(nb.__webglFramebuffer=[],Db=0;Db<ib.mipmaps.length;Db++)nb.__webglFramebuffer[Db]=
a.createFramebuffer();else nb.__webglFramebuffer=a.createFramebuffer();if(Jb)for(let Eb=0,Bb=sb.length;Eb<Bb;Eb++)Db=f.get(sb[Eb]),void 0===Db.__webglTexture&&(Db.__webglTexture=a.createTexture(),r.memory.textures++);if(0<hb.samples&&!1===ub(hb)){nb.__webglMultisampledFramebuffer=a.createFramebuffer();nb.__webglColorRenderbuffer=[];e.bindFramebuffer(a.FRAMEBUFFER,nb.__webglMultisampledFramebuffer);for(Db=0;Db<sb.length;Db++){yb=sb[Db];nb.__webglColorRenderbuffer[Db]=a.createRenderbuffer();a.bindRenderbuffer(a.RENDERBUFFER,
nb.__webglColorRenderbuffer[Db]);var lb=n.convert(yb.format,yb.colorSpace);const Eb=n.convert(yb.type);yb=x(yb.internalFormat,lb,Eb,yb.colorSpace,!0===hb.isXRRenderTarget);lb=pb(hb);a.renderbufferStorageMultisample(a.RENDERBUFFER,lb,yb,hb.width,hb.height);a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+Db,a.RENDERBUFFER,nb.__webglColorRenderbuffer[Db])}a.bindRenderbuffer(a.RENDERBUFFER,null);hb.depthBuffer&&(nb.__webglDepthRenderbuffer=a.createRenderbuffer(),qb(nb.__webglDepthRenderbuffer,
hb,!0));e.bindFramebuffer(a.FRAMEBUFFER,null)}}if(zb){e.bindTexture(a.TEXTURE_CUBE_MAP,tb.__webglTexture);db(a.TEXTURE_CUBE_MAP,ib);for(sb=0;6>sb;sb++)if(ib.mipmaps&&0<ib.mipmaps.length)for(tb=0;tb<ib.mipmaps.length;tb++)kb(nb.__webglFramebuffer[sb][tb],hb,ib,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+sb,tb);else kb(nb.__webglFramebuffer[sb],hb,ib,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+sb,0);w(ib)&&a.generateMipmap(a.TEXTURE_CUBE_MAP)}else if(Jb)for(let Eb=0,Bb=sb.length;Eb<Bb;Eb++)ib=
sb[Eb],tb=f.get(ib),e.bindTexture(a.TEXTURE_2D,tb.__webglTexture),db(a.TEXTURE_2D,ib),kb(nb.__webglFramebuffer,hb,ib,a.COLOR_ATTACHMENT0+Eb,a.TEXTURE_2D,0),w(ib)&&a.generateMipmap(a.TEXTURE_2D);else{sb=a.TEXTURE_2D;if(hb.isWebGL3DRenderTarget||hb.isWebGLArrayRenderTarget)sb=hb.isWebGL3DRenderTarget?a.TEXTURE_3D:a.TEXTURE_2D_ARRAY;e.bindTexture(sb,tb.__webglTexture);db(sb,ib);if(ib.mipmaps&&0<ib.mipmaps.length)for(tb=0;tb<ib.mipmaps.length;tb++)kb(nb.__webglFramebuffer[tb],hb,ib,a.COLOR_ATTACHMENT0,
sb,tb);else kb(nb.__webglFramebuffer,hb,ib,a.COLOR_ATTACHMENT0,sb,0);w(ib)&&a.generateMipmap(sb)}e.unbindTexture();hb.depthBuffer&&ob(hb)};this.updateRenderTargetMipmap=function(hb){const ib=hb.textures;for(let tb=0,sb=ib.length;tb<sb;tb++){var nb=ib[tb];if(w(nb)){const zb=hb.isWebGLCubeRenderTarget?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D;nb=f.get(nb).__webglTexture;e.bindTexture(zb,nb);a.generateMipmap(zb);e.unbindTexture()}}};this.updateMultisampleRenderTarget=function(hb){if(0<hb.samples&&!1===ub(hb)){const sb=
hb.textures;var ib=hb.width;const zb=hb.height;let Jb=a.COLOR_BUFFER_BIT;const Db=[],yb=hb.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT,lb=f.get(hb),Eb=1<sb.length;if(Eb)for(var nb=0;nb<sb.length;nb++)e.bindFramebuffer(a.FRAMEBUFFER,lb.__webglMultisampledFramebuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+nb,a.RENDERBUFFER,null),e.bindFramebuffer(a.FRAMEBUFFER,lb.__webglFramebuffer),a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0+nb,a.TEXTURE_2D,null,
0);e.bindFramebuffer(a.READ_FRAMEBUFFER,lb.__webglMultisampledFramebuffer);e.bindFramebuffer(a.DRAW_FRAMEBUFFER,lb.__webglFramebuffer);for(nb=0;nb<sb.length;nb++){Db.push(a.COLOR_ATTACHMENT0+nb);hb.depthBuffer&&Db.push(yb);var tb=void 0!==lb.__ignoreDepthValues?lb.__ignoreDepthValues:!1;!1===tb&&(hb.depthBuffer&&(Jb|=a.DEPTH_BUFFER_BIT),hb.stencilBuffer&&!0!==lb.__isTransmissionRenderTarget&&(Jb|=a.STENCIL_BUFFER_BIT));Eb&&a.framebufferRenderbuffer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,
lb.__webglColorRenderbuffer[nb]);!0===tb&&(a.invalidateFramebuffer(a.READ_FRAMEBUFFER,[yb]),a.invalidateFramebuffer(a.DRAW_FRAMEBUFFER,[yb]));Eb&&(tb=f.get(sb[nb]).__webglTexture,a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,tb,0));a.blitFramebuffer(0,0,ib,zb,0,0,ib,zb,Jb,a.NEAREST);Cb&&a.invalidateFramebuffer(a.READ_FRAMEBUFFER,Db)}e.bindFramebuffer(a.READ_FRAMEBUFFER,null);e.bindFramebuffer(a.DRAW_FRAMEBUFFER,null);if(Eb)for(hb=0;hb<sb.length;hb++)e.bindFramebuffer(a.FRAMEBUFFER,
lb.__webglMultisampledFramebuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+hb,a.RENDERBUFFER,lb.__webglColorRenderbuffer[hb]),ib=f.get(sb[hb]).__webglTexture,e.bindFramebuffer(a.FRAMEBUFFER,lb.__webglFramebuffer),a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0+hb,a.TEXTURE_2D,ib,0);e.bindFramebuffer(a.DRAW_FRAMEBUFFER,lb.__webglMultisampledFramebuffer)}};this.setupDepthRenderbuffer=ob;this.setupFrameBufferTexture=kb;this.useMultisampledRTT=ub}function tv(a,b){return{convert:function(e,
f=""){const h=Fd.getTransfer(f);if(1009===e)return a.UNSIGNED_BYTE;if(1017===e)return a.UNSIGNED_SHORT_4_4_4_4;if(1018===e)return a.UNSIGNED_SHORT_5_5_5_1;if(35902===e)return a.UNSIGNED_INT_5_9_9_9_REV;if(1010===e)return a.BYTE;if(1011===e)return a.SHORT;if(1012===e)return a.UNSIGNED_SHORT;if(1013===e)return a.INT;if(1014===e)return a.UNSIGNED_INT;if(1015===e)return a.FLOAT;if(1016===e)return a.HALF_FLOAT;if(1021===e)return a.ALPHA;if(1022===e)return a.RGB;if(1023===e)return a.RGBA;if(1024===e)return a.LUMINANCE;
if(1025===e)return a.LUMINANCE_ALPHA;if(1026===e)return a.DEPTH_COMPONENT;if(1027===e)return a.DEPTH_STENCIL;if(1028===e)return a.RED;if(1029===e)return a.RED_INTEGER;if(1030===e)return a.RG;if(1031===e)return a.RG_INTEGER;if(1033===e)return a.RGBA_INTEGER;if(33776===e||33777===e||33778===e||33779===e)if("srgb"===h)if(f=b.get("WEBGL_compressed_texture_s3tc_srgb"),null!==f){if(33776===e)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===e)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===e)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
if(33779===e)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=b.get("WEBGL_compressed_texture_s3tc"),null!==f){if(33776===e)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(35840===e||35841===e||35842===e||35843===e)if(f=b.get("WEBGL_compressed_texture_pvrtc"),null!==f){if(35840===e)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
if(35841===e)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(36196===e)return f=b.get("WEBGL_compressed_texture_etc1"),null!==f?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===e||37496===e)if(f=b.get("WEBGL_compressed_texture_etc"),null!==f){if(37492===e)return"srgb"===h?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(37496===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e)if(f=b.get("WEBGL_compressed_texture_astc"),null!==f){if(37808===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;
if(37816===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;
if(37821===e)return"srgb"===h?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(36492===e||36494===e||36495===e)if(f=b.get("EXT_texture_compression_bptc"),null!==f){if(36492===e)return"srgb"===h?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===e)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===e)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(36283===e||36284===e||36285===e||36286===e)if(f=b.get("EXT_texture_compression_rgtc"),
null!==f){if(36492===e)return f.COMPRESSED_RED_RGTC1_EXT;if(36284===e)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===e)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===e)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return 1020===e?a.UNSIGNED_INT_24_8:void 0!==a[e]?a[e]:null}}}function zz(a,b){function e(h,n){!0===h.matrixAutoUpdate&&h.updateMatrix();n.value.copy(h.matrix)}function f(h,n){h.opacity.value=n.opacity;n.color&&h.diffuse.value.copy(n.color);n.emissive&&h.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity);
n.map&&(h.map.value=n.map,e(n.map,h.mapTransform));n.alphaMap&&(h.alphaMap.value=n.alphaMap,e(n.alphaMap,h.alphaMapTransform));n.bumpMap&&(h.bumpMap.value=n.bumpMap,e(n.bumpMap,h.bumpMapTransform),h.bumpScale.value=n.bumpScale,1===n.side&&(h.bumpScale.value*=-1));n.normalMap&&(h.normalMap.value=n.normalMap,e(n.normalMap,h.normalMapTransform),h.normalScale.value.copy(n.normalScale),1===n.side&&h.normalScale.value.negate());n.displacementMap&&(h.displacementMap.value=n.displacementMap,e(n.displacementMap,
h.displacementMapTransform),h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias);n.emissiveMap&&(h.emissiveMap.value=n.emissiveMap,e(n.emissiveMap,h.emissiveMapTransform));n.specularMap&&(h.specularMap.value=n.specularMap,e(n.specularMap,h.specularMapTransform));0<n.alphaTest&&(h.alphaTest.value=n.alphaTest);var r=b.get(n);const t=r.envMap;r=r.envMapRotation;t&&(h.envMap.value=t,Kf.copy(r),Kf.x*=-1,Kf.y*=-1,Kf.z*=-1,t.isCubeTexture&&!1===t.isRenderTargetTexture&&
(Kf.y*=-1,Kf.z*=-1),h.envMapRotation.value.setFromMatrix4(Az.makeRotationFromEuler(Kf)),h.flipEnvMap.value=t.isCubeTexture&&!1===t.isRenderTargetTexture?-1:1,h.reflectivity.value=n.reflectivity,h.ior.value=n.ior,h.refractionRatio.value=n.refractionRatio);n.lightMap&&(h.lightMap.value=n.lightMap,h.lightMapIntensity.value=n.lightMapIntensity*(!0===a._useLegacyLights?Math.PI:1),e(n.lightMap,h.lightMapTransform));n.aoMap&&(h.aoMap.value=n.aoMap,h.aoMapIntensity.value=n.aoMapIntensity,e(n.aoMap,h.aoMapTransform))}
return{refreshFogUniforms:function(h,n){n.color.getRGB(h.fogColor.value,Tq(a));n.isFog?(h.fogNear.value=n.near,h.fogFar.value=n.far):n.isFogExp2&&(h.fogDensity.value=n.density)},refreshMaterialUniforms:function(h,n,r,t,w){n.isMeshBasicMaterial?f(h,n):n.isMeshLambertMaterial?f(h,n):n.isMeshToonMaterial?(f(h,n),n.gradientMap&&(h.gradientMap.value=n.gradientMap)):n.isMeshPhongMaterial?(f(h,n),h.specular.value.copy(n.specular),h.shininess.value=Math.max(n.shininess,1E-4)):n.isMeshStandardMaterial?(f(h,
n),h.metalness.value=n.metalness,n.metalnessMap&&(h.metalnessMap.value=n.metalnessMap,e(n.metalnessMap,h.metalnessMapTransform)),h.roughness.value=n.roughness,n.roughnessMap&&(h.roughnessMap.value=n.roughnessMap,e(n.roughnessMap,h.roughnessMapTransform)),n.envMap&&(h.envMapIntensity.value=n.envMapIntensity),n.isMeshPhysicalMaterial&&(h.ior.value=n.ior,0<n.sheen&&(h.sheenColor.value.copy(n.sheenColor).multiplyScalar(n.sheen),h.sheenRoughness.value=n.sheenRoughness,n.sheenColorMap&&(h.sheenColorMap.value=
n.sheenColorMap,e(n.sheenColorMap,h.sheenColorMapTransform)),n.sheenRoughnessMap&&(h.sheenRoughnessMap.value=n.sheenRoughnessMap,e(n.sheenRoughnessMap,h.sheenRoughnessMapTransform))),0<n.clearcoat&&(h.clearcoat.value=n.clearcoat,h.clearcoatRoughness.value=n.clearcoatRoughness,n.clearcoatMap&&(h.clearcoatMap.value=n.clearcoatMap,e(n.clearcoatMap,h.clearcoatMapTransform)),n.clearcoatRoughnessMap&&(h.clearcoatRoughnessMap.value=n.clearcoatRoughnessMap,e(n.clearcoatRoughnessMap,h.clearcoatRoughnessMapTransform)),
n.clearcoatNormalMap&&(h.clearcoatNormalMap.value=n.clearcoatNormalMap,e(n.clearcoatNormalMap,h.clearcoatNormalMapTransform),h.clearcoatNormalScale.value.copy(n.clearcoatNormalScale),1===n.side&&h.clearcoatNormalScale.value.negate())),0<n.iridescence&&(h.iridescence.value=n.iridescence,h.iridescenceIOR.value=n.iridescenceIOR,h.iridescenceThicknessMinimum.value=n.iridescenceThicknessRange[0],h.iridescenceThicknessMaximum.value=n.iridescenceThicknessRange[1],n.iridescenceMap&&(h.iridescenceMap.value=
n.iridescenceMap,e(n.iridescenceMap,h.iridescenceMapTransform)),n.iridescenceThicknessMap&&(h.iridescenceThicknessMap.value=n.iridescenceThicknessMap,e(n.iridescenceThicknessMap,h.iridescenceThicknessMapTransform))),0<n.transmission&&(h.transmission.value=n.transmission,h.transmissionSamplerMap.value=w.texture,h.transmissionSamplerSize.value.set(w.width,w.height),n.transmissionMap&&(h.transmissionMap.value=n.transmissionMap,e(n.transmissionMap,h.transmissionMapTransform)),h.thickness.value=n.thickness,
n.thicknessMap&&(h.thicknessMap.value=n.thicknessMap,e(n.thicknessMap,h.thicknessMapTransform)),h.attenuationDistance.value=n.attenuationDistance,h.attenuationColor.value.copy(n.attenuationColor)),0<n.anisotropy&&(h.anisotropyVector.value.set(n.anisotropy*Math.cos(n.anisotropyRotation),n.anisotropy*Math.sin(n.anisotropyRotation)),n.anisotropyMap&&(h.anisotropyMap.value=n.anisotropyMap,e(n.anisotropyMap,h.anisotropyMapTransform))),h.specularIntensity.value=n.specularIntensity,h.specularColor.value.copy(n.specularColor),
n.specularColorMap&&(h.specularColorMap.value=n.specularColorMap,e(n.specularColorMap,h.specularColorMapTransform)),n.specularIntensityMap&&(h.specularIntensityMap.value=n.specularIntensityMap,e(n.specularIntensityMap,h.specularIntensityMapTransform)))):n.isMeshMatcapMaterial?(f(h,n),n.matcap&&(h.matcap.value=n.matcap)):n.isMeshDepthMaterial?f(h,n):n.isMeshDistanceMaterial?(f(h,n),n=b.get(n).light,h.referencePosition.value.setFromMatrixPosition(n.matrixWorld),h.nearDistance.value=n.shadow.camera.near,
h.farDistance.value=n.shadow.camera.far):n.isMeshNormalMaterial?f(h,n):n.isLineBasicMaterial?(h.diffuse.value.copy(n.color),h.opacity.value=n.opacity,n.map&&(h.map.value=n.map,e(n.map,h.mapTransform)),n.isLineDashedMaterial&&(h.dashSize.value=n.dashSize,h.totalSize.value=n.dashSize+n.gapSize,h.scale.value=n.scale)):n.isPointsMaterial?(h.diffuse.value.copy(n.color),h.opacity.value=n.opacity,h.size.value=n.size*r,h.scale.value=.5*t,n.map&&(h.map.value=n.map,e(n.map,h.uvTransform)),n.alphaMap&&(h.alphaMap.value=
n.alphaMap,e(n.alphaMap,h.alphaMapTransform)),0<n.alphaTest&&(h.alphaTest.value=n.alphaTest)):n.isSpriteMaterial?(h.diffuse.value.copy(n.color),h.opacity.value=n.opacity,h.rotation.value=n.rotation,n.map&&(h.map.value=n.map,e(n.map,h.mapTransform)),n.alphaMap&&(h.alphaMap.value=n.alphaMap,e(n.alphaMap,h.alphaMapTransform)),0<n.alphaTest&&(h.alphaTest.value=n.alphaTest)):n.isShadowMaterial?(h.color.value.copy(n.color),h.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Bz(a,
b,e,f){function h(z){var ab=z.uniforms;let eb=0;for(let cb=0,db=ab.length;cb<db;cb++){const bb=Array.isArray(ab[cb])?ab[cb]:[ab[cb]];for(let gb=0,kb=bb.length;gb<kb;gb++){const qb=bb[gb],ob=Array.isArray(qb.value)?qb.value:[qb.value];for(let pb=0,ub=ob.length;pb<ub;pb++){const rb=n(ob[pb]),Ab=eb%16;0!==Ab&&16-Ab<rb.boundary&&(eb+=16-Ab);qb.__data=new Float32Array(rb.storage/Float32Array.BYTES_PER_ELEMENT);qb.__offset=eb;eb+=rb.storage}}}ab=eb%16;0<ab&&(eb+=16-ab);z.__size=eb;z.__cache={};return this}
function n(z){const ab={boundary:0,storage:0};"number"===typeof z||"boolean"===typeof z?(ab.boundary=4,ab.storage=4):z.isVector2?(ab.boundary=8,ab.storage=8):z.isVector3||z.isColor?(ab.boundary=16,ab.storage=12):z.isVector4?(ab.boundary=16,ab.storage=16):z.isMatrix3?(ab.boundary=48,ab.storage=48):z.isMatrix4?(ab.boundary=64,ab.storage=64):z.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",
z);return ab}function r(z){z=z.target;z.removeEventListener("dispose",r);x.splice(x.indexOf(z.__bindingPointIndex),1);a.deleteBuffer(t[z.id]);delete t[z.id];delete w[z.id]}let t={},w={},x=[];const y=a.getParameter(a.MAX_UNIFORM_BUFFER_BINDINGS);return{bind:function(z,ab){f.uniformBlockBinding(z,ab.program)},update:function(z,ab){var eb=t[z.id];if(void 0===eb){h(z);a:{for(eb=0;eb<y;eb++)if(-1===x.indexOf(eb)){x.push(eb);break a}console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.");
eb=0}z.__bindingPointIndex=eb;var cb=a.createBuffer(),db=z.__size,bb=z.usage;a.bindBuffer(a.UNIFORM_BUFFER,cb);a.bufferData(a.UNIFORM_BUFFER,db,bb);a.bindBuffer(a.UNIFORM_BUFFER,null);a.bindBufferBase(a.UNIFORM_BUFFER,eb,cb);eb=cb;t[z.id]=eb;z.addEventListener("dispose",r)}f.updateUBOMapping(z,ab.program);ab=b.render.frame;if(w[z.id]!==ab){eb=z.uniforms;cb=z.__cache;a.bindBuffer(a.UNIFORM_BUFFER,t[z.id]);for(let ob=0,pb=eb.length;ob<pb;ob++){db=Array.isArray(eb[ob])?eb[ob]:[eb[ob]];for(let ub=0,rb=
db.length;ub<rb;ub++){bb=db[ub];a:{var gb=bb.value;var kb=ob+"_"+ub;if(void 0===cb[kb])cb[kb]="number"===typeof gb||"boolean"===typeof gb?gb:gb.clone(),gb=!0;else{var qb=cb[kb];if("number"===typeof gb||"boolean"===typeof gb){if(qb!==gb){cb[kb]=gb;gb=!0;break a}}else if(!1===qb.equals(gb)){qb.copy(gb);gb=!0;break a}gb=!1}}if(!0===gb){gb=bb.__offset;kb=Array.isArray(bb.value)?bb.value:[bb.value];qb=0;for(let Ab=0;Ab<kb.length;Ab++){const wb=kb[Ab],Cb=n(wb);"number"===typeof wb||"boolean"===typeof wb?
(bb.__data[0]=wb,a.bufferSubData(a.UNIFORM_BUFFER,gb+qb,bb.__data)):wb.isMatrix3?(bb.__data[0]=wb.elements[0],bb.__data[1]=wb.elements[1],bb.__data[2]=wb.elements[2],bb.__data[3]=0,bb.__data[4]=wb.elements[3],bb.__data[5]=wb.elements[4],bb.__data[6]=wb.elements[5],bb.__data[7]=0,bb.__data[8]=wb.elements[6],bb.__data[9]=wb.elements[7],bb.__data[10]=wb.elements[8],bb.__data[11]=0):(wb.toArray(bb.__data,qb),qb+=Cb.storage/Float32Array.BYTES_PER_ELEMENT)}a.bufferSubData(a.UNIFORM_BUFFER,gb,bb.__data)}}}a.bindBuffer(a.UNIFORM_BUFFER,
null);w[z.id]=ab}},dispose:function(){for(const z in t)a.deleteBuffer(t[z]);x=[];t={};w={}}}}function Tk(a,b,e,f,h,n){Ej.subVectors(a,e).addScalar(.5).multiply(f);void 0!==h?(ik.x=n*Ej.x-h*Ej.y,ik.y=h*Ej.x+n*Ej.y):ik.copy(Ej);a.copy(b);a.x+=ik.x;a.y+=ik.y;a.applyMatrix4(uv)}function Cz(a,b){return a.z-b.z}function Dz(a,b){return b.z-a.z}function Ez(a,b,e=0){const f=b.itemSize;if(a.isInterleavedBufferAttribute||a.array.constructor!==b.array.constructor){const h=a.count;for(let n=0;n<h;n++)for(let r=
0;r<f;r++)b.setComponent(n+e,r,a.getComponent(n,r))}else b.array.set(a.array,e*f);b.needsUpdate=!0}function vv(a,b,e,f,h,n,r){const t=hp.distanceSqToPoint(a);t<e&&(e=new mb,hp.closestPointToPoint(a,e),e.applyMatrix4(f),a=h.ray.origin.distanceTo(e),a<h.near||a>h.far||n.push({distance:a,distanceToRay:Math.sqrt(t),point:e,index:b,face:null,object:r}))}function ip(){let a=0,b=0,e=0,f=0;return{initCatmullRom:function(h,n,r,t,w){h=w*(r-h);t=w*(t-n);a=n;b=h;e=-3*n+3*r-2*h-t;f=2*n-2*r+h+t},initNonuniformCatmullRom:function(h,
n,r,t,w,x,y){h=((n-h)/w-(r-h)/(w+x)+(r-n)/x)*x;t=((r-n)/x-(t-n)/(x+y)+(t-r)/y)*x;a=n;b=h;e=-3*n+3*r-2*h-t;f=2*n-2*r+h+t},calc:function(h){const n=h*h;return a+b*h+e*n+f*n*h}}}function wv(a,b,e,f,h){b=.5*(f-b);h=.5*(h-e);const n=a*a;return(2*e-2*f+b+h)*a*n+(-3*e+3*f-2*b-h)*n+b*a+e}function jk(a,b,e,f){const h=1-a;return h*h*b+2*(1-a)*a*e+a*a*f}function kk(a,b,e,f,h){const n=1-a,r=1-a;return n*n*n*b+3*r*r*a*e+3*(1-a)*a*a*f+a*a*a*h}function xv(a,b,e,f,h){let n,r=0;for(let t=b,w=e-f;t<e;t+=f)r+=(a[w]-
a[t])*(a[t+1]+a[w+1]),w=t;if(h===0<r)for(h=b;h<e;h+=f)n=yv(h,a[h],a[h+1],n);else for(h=e-f;h>=b;h-=f)n=yv(h,a[h],a[h+1],n);n&&Uk(n,n.next)&&(lk(n),n=n.next);return n}function Ug(a,b){if(!a)return a;b||(b=a);let e;do if(e=!1,a.steiner||!Uk(a,a.next)&&0!==Vd(a.prev,a,a.next))a=a.next;else{lk(a);a=b=a.prev;if(a===a.next)break;e=!0}while(e||a!==b);return b}function mk(a,b,e,f,h,n,r){if(a){if(!r&&n){var t=a,w=t;do 0===w.z&&(w.z=jp(w.x,w.y,f,h,n)),w.prevZ=w.prev,w=w.nextZ=w.next;while(w!==t);w.prevZ.nextZ=
null;w.prevZ=null;t=w;var x,y,z,ab,eb=1;do{w=t;var cb=t=null;for(y=0;w;){y++;var db=w;for(x=z=0;x<eb&&(z++,db=db.nextZ,db);x++);for(ab=eb;0<z||0<ab&&db;)0!==z&&(0===ab||!db||w.z<=db.z)?(x=w,w=w.nextZ,z--):(x=db,db=db.nextZ,ab--),cb?cb.nextZ=x:t=x,x.prevZ=cb,cb=x;w=db}cb.nextZ=null;eb*=2}while(1<y)}for(t=a;a.prev!==a.next;){w=a.prev;db=a.next;if(n)cb=Fz(a,f,h,n);else a:{var bb=a;cb=bb.prev;ab=bb.next;if(0<=Vd(cb,bb,ab)){cb=!1;break a}y=cb.x;z=bb.x;eb=ab.x;x=cb.y;bb=bb.y;const gb=ab.y,kb=y<z?y<eb?y:
eb:z<eb?z:eb,qb=x<bb?x<gb?x:gb:bb<gb?bb:gb,ob=y>z?y>eb?y:eb:z>eb?z:eb,pb=x>bb?x>gb?x:gb:bb>gb?bb:gb;for(ab=ab.next;ab!==cb;){if(ab.x>=kb&&ab.x<=ob&&ab.y>=qb&&ab.y<=pb&&Fj(y,x,z,bb,eb,gb,ab.x,ab.y)&&0<=Vd(ab.prev,ab,ab.next)){cb=!1;break a}ab=ab.next}cb=!0}if(cb)b.push(w.i/e|0),b.push(a.i/e|0),b.push(db.i/e|0),lk(a),t=a=db.next;else if(a=db,a===t){if(r)if(1===r){a=Ug(a);r=b;t=e;w=a;do db=w.prev,cb=w.next.next,!Uk(db,cb)&&zv(db,w,w.next,cb)&&nk(db,cb)&&nk(cb,db)&&(r.push(db.i/t|0),r.push(w.i/t|0),r.push(cb.i/
t|0),lk(w),lk(w.next),w=a=cb),w=w.next;while(w!==a);a=Ug(w);mk(a,b,e,f,h,n,2)}else{if(2===r)a:{r=a;do{for(t=r.next.next;t!==r.prev;){if(w=r.i!==t.i){w=r;db=t;if(cb=w.next.i!==db.i&&w.prev.i!==db.i){b:{cb=w;do{if(cb.i!==w.i&&cb.next.i!==w.i&&cb.i!==db.i&&cb.next.i!==db.i&&zv(cb,cb.next,w,db)){cb=!0;break b}cb=cb.next}while(cb!==w);cb=!1}cb=!cb}if(cb){if(cb=nk(w,db)&&nk(db,w)){cb=w;y=!1;z=(w.x+db.x)/2;eb=(w.y+db.y)/2;do cb.y>eb!==cb.next.y>eb&&cb.next.y!==cb.y&&z<(cb.next.x-cb.x)*(eb-cb.y)/(cb.next.y-
cb.y)+cb.x&&(y=!y),cb=cb.next;while(cb!==w);cb=y}cb=cb&&(Vd(w.prev,w,db.prev)||Vd(w,db.prev,db))||Uk(w,db)&&0<Vd(w.prev,w,w.next)&&0<Vd(db.prev,db,db.next)}w=cb}if(w){a=Av(r,t);r=Ug(r,r.next);a=Ug(a,a.next);mk(r,b,e,f,h,n,0);mk(a,b,e,f,h,n,0);break a}t=t.next}r=r.next}while(r!==a)}}else mk(Ug(a),b,e,f,h,n,1);break}}}}function Fz(a,b,e,f){const h=a.prev,n=a.next;if(0<=Vd(h,a,n))return!1;const r=h.x,t=a.x,w=n.x,x=h.y,y=a.y,z=n.y,ab=r<t?r<w?r:w:t<w?t:w,eb=x<y?x<z?x:z:y<z?y:z,cb=r>t?r>w?r:w:t>w?t:w,db=
x>y?x>z?x:z:y>z?y:z,bb=jp(ab,eb,b,e,f);b=jp(cb,db,b,e,f);e=a.prevZ;for(a=a.nextZ;e&&e.z>=bb&&a&&a.z<=b;){if(e.x>=ab&&e.x<=cb&&e.y>=eb&&e.y<=db&&e!==h&&e!==n&&Fj(r,x,t,y,w,z,e.x,e.y)&&0<=Vd(e.prev,e,e.next))return!1;e=e.prevZ;if(a.x>=ab&&a.x<=cb&&a.y>=eb&&a.y<=db&&a!==h&&a!==n&&Fj(r,x,t,y,w,z,a.x,a.y)&&0<=Vd(a.prev,a,a.next))return!1;a=a.nextZ}for(;e&&e.z>=bb;){if(e.x>=ab&&e.x<=cb&&e.y>=eb&&e.y<=db&&e!==h&&e!==n&&Fj(r,x,t,y,w,z,e.x,e.y)&&0<=Vd(e.prev,e,e.next))return!1;e=e.prevZ}for(;a&&a.z<=b;){if(a.x>=
ab&&a.x<=cb&&a.y>=eb&&a.y<=db&&a!==h&&a!==n&&Fj(r,x,t,y,w,z,a.x,a.y)&&0<=Vd(a.prev,a,a.next))return!1;a=a.nextZ}return!0}function Gz(a,b){return a.x-b.x}function jp(a,b,e,f,h){a=(a-e)*h|0;b=(b-f)*h|0;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function Fj(a,b,e,f,h,n,r,t){return(h-r)*(b-t)>=(a-r)*(n-t)&&(a-r)*(f-t)>=(e-r)*(b-t)&&(e-r)*(n-t)>=(h-r)*(f-t)}function Vd(a,
b,e){return(b.y-a.y)*(e.x-b.x)-(b.x-a.x)*(e.y-b.y)}function Uk(a,b){return a.x===b.x&&a.y===b.y}function zv(a,b,e,f){const h=Vk(Vd(a,b,e)),n=Vk(Vd(a,b,f)),r=Vk(Vd(e,f,a)),t=Vk(Vd(e,f,b));return h!==n&&r!==t||0===h&&Wk(a,e,b)||0===n&&Wk(a,f,b)||0===r&&Wk(e,a,f)||0===t&&Wk(e,b,f)?!0:!1}function Wk(a,b,e){return b.x<=Math.max(a.x,e.x)&&b.x>=Math.min(a.x,e.x)&&b.y<=Math.max(a.y,e.y)&&b.y>=Math.min(a.y,e.y)}function Vk(a){return 0<a?1:0>a?-1:0}function nk(a,b){return 0>Vd(a.prev,a,a.next)?0<=Vd(a,b,a.next)&&
0<=Vd(a,a.prev,b):0>Vd(a,b,a.prev)||0>Vd(a,a.next,b)}function Av(a,b){const e=new kp(a.i,a.x,a.y),f=new kp(b.i,b.x,b.y),h=a.next,n=b.prev;a.next=b;b.prev=a;e.next=h;h.prev=e;f.next=e;e.prev=f;n.next=f;f.prev=n;return f}function yv(a,b,e,f){a=new kp(a,b,e);f?(a.next=f.next,a.prev=f,f.next.prev=a,f.next=a):(a.prev=a,a.next=a);return a}function lk(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function kp(a,b,e){this.i=a;this.x=b;this.y=e;this.next=
this.prev=null;this.z=0;this.nextZ=this.prevZ=null;this.steiner=!1}function Bv(a){const b=a.length;2<b&&a[b-1].equals(a[0])&&a.pop()}function Cv(a,b){for(let e=0;e<b.length;e++)a.push(b[e].x),a.push(b[e].y)}function Dv(a,b,e){const f=`${a.x},${a.y},${a.z}-${b.x},${b.y},${b.z}`;a=`${b.x},${b.y},${b.z}-${a.x},${a.y},${a.z}`;if(!0===e.has(f)||!0===e.has(a))return!1;e.add(f);e.add(a);return!0}function Vg(a,b,e){return!a||!e&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)}
function Ev(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)}function Fv(a){const b=a.length,e=Array(b);for(let f=0;f!==b;++f)e[f]=f;e.sort(function(f,h){return a[f]-a[h]});return e}function lp(a,b,e){const f=a.length,h=new a.constructor(f);for(let n=0,r=0;r!==f;++n){const t=e[n]*b;for(let w=0;w!==b;++w)h[r++]=a[t+w]}return h}function mp(a,b,e,f){let h=1,n=a[0];for(;void 0!==n&&void 0===n[f];)n=a[h++];if(void 0!==n){var r=n[f];if(void 0!==r)if(Array.isArray(r)){do r=n[f],void 0!==r&&(b.push(n.time),
e.push.apply(e,r)),n=a[h++];while(void 0!==n)}else if(void 0!==r.toArray){do r=n[f],void 0!==r&&(b.push(n.time),r.toArray(e,e.length)),n=a[h++];while(void 0!==n)}else{do r=n[f],void 0!==r&&(b.push(n.time),e.push(r)),n=a[h++];while(void 0!==n)}}}function Hz(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return Wg;case "vector":case "vector2":case "vector3":case "vector4":return Xg;case "color":return np;case "quaternion":return zg;case "bool":case "boolean":return Yg;
case "string":return Zg}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function Gv(){return("undefined"===typeof performance?Date:performance).now()}function Hv(a,b){return a.distance-b.distance}function op(a,b,e,f){a.layers.test(b.layers)&&a.raycast(b,e);if(!0===f){a=a.children;for(let h=0,n=a.length;h<n;h++)op(a[h],b,e,!0)}}function Iv(a){const b=[];!0===a.isBone&&b.push(a);for(let e=0;e<a.children.length;e++)b.push.apply(b,Iv(a.children[e]));return b}function Yd(a,b,e,f,h,n,r){Xk.set(h,
n,r).unproject(f);a=b[a];if(void 0!==a){e=e.getAttribute("position");for(let t=0,w=a.length;t<w;t++)e.setXYZ(a[t],Xk.x,Xk.y,Xk.z)}}function Jv(){var a="perspective",b=["Webkit","Moz","O","ms","Ms"],e;for(e=0;e<b.length;e++)"undefined"!==typeof document.documentElement.style[b[e]+"Perspective"]&&(a=b[e]+"Perspective");"undefined"!==typeof document.documentElement.style[a]?"webkitPerspective"in document.documentElement.style?(a=document.createElement("style"),b=document.createElement("div"),e=document.head||
document.getElementsByTagName("head")[0],a.textContent="@media (-webkit-transform-3d) {#ggswhtml5{height:5px}}",e.appendChild(a),b.id="ggswhtml5",document.documentElement.appendChild(b),e=5===b.offsetHeight,a.parentNode.removeChild(a),b.parentNode.removeChild(b)):e=!0:e=!1;return e}function Kv(){let a;if(a=!!window.WebGLRenderingContext)try{let b=document.createElement("canvas");b.width=100;b.height=100;let e=b.getContext("webgl");e||(e=b.getContext("experimental-webgl"));a=!!e}catch(b){a=!1}return a}
function Lv(a,b){if(0===b)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(2===b||1===b){var e=a.getIndex();if(null===e){var f=[];e=a.getAttribute("position");if(void 0!==e){for(var h=0;h<e.count;h++)f.push(h);a.setIndex(f);e=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}h=e.count-2;f=[];if(2===b)for(b=1;b<=h;b++)f.push(e.getX(0)),
f.push(e.getX(b)),f.push(e.getX(b+1));else for(b=0;b<h;b++)0===b%2?(f.push(e.getX(b)),f.push(e.getX(b+1)),f.push(e.getX(b+2))):(f.push(e.getX(b+2)),f.push(e.getX(b+1)),f.push(e.getX(b)));f.length/3!==h&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");a=a.clone();a.setIndex(f);a.clearGroups();return a}console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",b);return a}function Iz(){let a={};return{get:function(b){return a[b]},
add:function(b,e){a[b]=e},remove:function(b){delete a[b]},Ey:function(){a={}}}}function Jz(a){void 0===a.DefaultMaterial&&(a.DefaultMaterial=new Gj({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0}));return a.DefaultMaterial}function $g(a,b,e){for(const f in e.extensions)void 0===a[f]&&(b.userData.Gr=b.userData.Gr||{},b.userData.Gr[f]=e.extensions[f])}function Ag(a,b){void 0!==b.Sg&&("object"===typeof b.Sg?Object.assign(a.userData,b.Sg):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+
b.Sg))}function Kz(a,b,e){let f=!1,h=!1,n=!1;for(let z=0,ab=b.length;z<ab;z++){var r=b[z];void 0!==r.Bf&&(f=!0);void 0!==r.gm&&(h=!0);void 0!==r.fm&&(n=!0);if(f&&h&&n)break}if(!f&&!h&&!n)return Promise.resolve(a);r=[];const t=[],w=[];for(let z=0,ab=b.length;z<ab;z++){var x=b[z];if(f){var y=void 0!==x.Bf?e.Ba("accessor",x.Bf):a.attributes.position;r.push(y)}h&&(y=void 0!==x.gm?e.Ba("accessor",x.gm):a.attributes.normal,t.push(y));n&&(x=void 0!==x.fm?e.Ba("accessor",x.fm):a.attributes.color,w.push(x))}return Promise.all([Promise.all(r),
Promise.all(t),Promise.all(w)]).then(function(z){const ab=z[0],eb=z[1];z=z[2];f&&(a.morphAttributes.position=ab);h&&(a.morphAttributes.normal=eb);n&&(a.morphAttributes.color=z);a.morphTargetsRelative=!0;return a})}function Lz(a){var b=(b=a.extensions&&a.extensions[Ad.Uh])?"draco:"+b.fd+":"+b.indices+":"+pp(b.attributes):a.indices+":"+pp(a.attributes)+":"+a.mode;if(void 0!==a.Dj)for(let e=0,f=a.Dj.length;e<f;e++)b+=":"+pp(a.Dj[e]);return b}function pp(a){let b="";const e=Object.keys(a).sort();for(let f=
0,h=e.length;f<h;f++)b+=e[f]+":"+a[e[f]]+";";return b}function qp(a){switch(a){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");}}function Mz(a,b,e){var f=b.attributes;const h=new qf;if(void 0!==f.Bf){f=e.json.nm[f.Bf];var n=f.min,r=f.max;if(void 0!==n&&void 0!==r){h.set(new mb(n[0],n[1],n[2]),new mb(r[0],r[1],r[2]));f.normalized&&(f=qp(Hj[f.Jg]),
h.min.multiplyScalar(f),h.max.multiplyScalar(f));b=b.Dj;if(void 0!==b){f=new mb;n=new mb;for(let t=0,w=b.length;t<w;t++)if(r=b[t],void 0!==r.Bf){r=e.json.nm[r.Bf];const x=r.min,y=r.max;void 0!==x&&void 0!==y?(n.setX(Math.max(Math.abs(x[0]),Math.abs(y[0]))),n.setY(Math.max(Math.abs(x[1]),Math.abs(y[1]))),n.setZ(Math.max(Math.abs(x[2]),Math.abs(y[2]))),r.normalized&&(r=qp(Hj[r.Jg]),n.multiplyScalar(r)),f.max(n)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}h.expandByVector(f)}a.boundingBox=
h;e=new lf;h.getCenter(e.center);e.radius=h.min.distanceTo(h.max)/2;a.boundingSphere=e}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}function Mv(a,b,e){function f(t,w){return e.Ba("accessor",t).then(function(x){a.setAttribute(w,x)})}const h=b.attributes,n=[];for(var r in h){const t=rp[r]||r.toLowerCase();t in a.attributes||n.push(f(h[r],t))}void 0===b.indices||a.index||(r=e.Ba("accessor",b.indices).then(function(t){a.setIndex(t)}),n.push(r));"srgb-linear"!==
Fd.workingColorSpace&&"COLOR_0"in h&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Fd.workingColorSpace}" not supported.`);Ag(a,b);Mz(a,b,e);return Promise.all(n).then(function(){return void 0!==b.Dj?Kz(a,b.Dj,e):a})}function Nv(a){return Vx(function*(){const b=yield fetch(a);if(b.ok)return b.json();throw Error(b.statusText);}())}function Nz(a){return Vx(function*(){if(!a)throw Error("No basePath supplied");return yield Nv(`${a}/${"profilesList.json"}`)}())}function Oz(a,
b,e=null,f=!0){return Vx(function*(){if(!a)throw Error("No xrInputSource supplied");if(!b)throw Error("No basePath supplied");const h=yield Nz(b);let n;a.profiles.some(w=>{const x=h[w];x&&(n={ro:w,so:`${b}/${x.path}`,Ym:!!x.Ym});return!!n});if(!n){if(!e)throw Error("No matching profile name found");var r=h[e];if(!r)throw Error(`No matching profile name found and default profile "${e}" missing.`);n={ro:e,so:`${b}/${r.path}`,Ym:!!r.Ym}}r=yield Nv(n.so);let t;if(f){let w;w="any"===a.handedness?r.Tn[Object.keys(r.Tn)[0]]:
r.Tn[a.handedness];if(!w)throw Error(`No matching handedness, ${a.handedness}, in profile ${n.ro}`);w.tm&&(t=n.so.replace("profile.json",w.tm))}return{profile:r,tm:t}}())}function Pz(a=0,b=0){let e=a,f=b;1<Math.sqrt(a*a+b*b)&&(a=Math.atan2(b,a),e=Math.cos(a),f=Math.sin(a));return{Wx:.5*e+.5,Xx:.5*f+.5}}function Qz(a,b){Object.values(a.Nf).forEach(e=>{var f=e.jp;const h=e.Bg;if(e.type===Wd.wu.Ru)if(e.Ut=b.getObjectByName(f),e.Ut){f=new kg(.001);const n=new Qd({color:255});f=new Bd(f,n);e.Ut.add(f)}else console.warn(`Could not find touch dot, ${e.jp}, in touchpad component ${e.id}`);
Object.values(h).forEach(n=>{const r=n.lu,t=n.ts,w=n.os;if(n.Rj===Wd.Wh.im){n.ss=b.getObjectByName(t);n.ns=b.getObjectByName(w);if(!n.ss){console.warn(`Could not find ${t} in the model`);return}if(!n.ns){console.warn(`Could not find ${w} in the model`);return}}n.ku=b.getObjectByName(r);n.ku||console.warn(`Could not find ${r} in the model`)})})}function Ov(a,b){Qz(a.fc,b);a.envMap&&b.traverse(e=>{e.isMesh&&(e.material.envMap=a.envMap,e.material.needsUpdate=!0)});a.add(b)}var lg={};Vb.r(lg);Vb.d(lg,
{ACESFilmicToneMapping:()=>4,AddEquation:()=>100,AddOperation:()=>2,AdditiveAnimationBlendMode:()=>2501,AdditiveBlending:()=>2,AgXToneMapping:()=>6,AlphaFormat:()=>1021,AlwaysCompare:()=>519,AlwaysDepth:()=>1,AlwaysStencilFunc:()=>519,AmbientLight:()=>Pv,AnimationAction:()=>Qv,AnimationClip:()=>Ij,AnimationLoader:()=>Rz,AnimationMixer:()=>Sz,AnimationObjectGroup:()=>Tz,AnimationUtils:()=>Uz,ArcCurve:()=>Rv,ArrayCamera:()=>Sv,ArrowHelper:()=>Vz,AttachedBindMode:()=>"attached",Audio:()=>Tv,AudioAnalyser:()=>
Wz,AudioContext:()=>sp,AudioListener:()=>Xz,AudioLoader:()=>Yz,AxesHelper:()=>Zz,BackSide:()=>1,BasicDepthPacking:()=>3200,BasicShadowMap:()=>0,BatchedMesh:()=>Uv,Bone:()=>Yk,BooleanKeyframeTrack:()=>Yg,Box2:()=>$z,Box3:()=>qf,Box3Helper:()=>aA,BoxGeometry:()=>Sg,BoxHelper:()=>bA,BufferAttribute:()=>Hd,BufferGeometry:()=>md,BufferGeometryLoader:()=>Vv,ByteType:()=>1010,Cache:()=>mg,Camera:()=>Zk,CameraHelper:()=>cA,CanvasTexture:()=>dA,CapsuleGeometry:()=>tp,CatmullRomCurve3:()=>Wv,CineonToneMapping:()=>
3,CircleGeometry:()=>up,ClampToEdgeWrapping:()=>1001,Clock:()=>Xv,Color:()=>Tb,ColorKeyframeTrack:()=>np,ColorManagement:()=>Fd,CompressedArrayTexture:()=>eA,CompressedCubeTexture:()=>fA,CompressedTexture:()=>$k,CompressedTextureLoader:()=>gA,ConeGeometry:()=>vp,ConstantAlphaFactor:()=>213,ConstantColorFactor:()=>211,CubeCamera:()=>Yv,CubeReflectionMapping:()=>301,CubeRefractionMapping:()=>302,CubeTexture:()=>ok,CubeTextureLoader:()=>hA,CubeUVReflectionMapping:()=>306,CubicBezierCurve:()=>wp,CubicBezierCurve3:()=>
Zv,CubicInterpolant:()=>$v,CullFaceBack:()=>1,CullFaceFront:()=>2,CullFaceFrontBack:()=>3,CullFaceNone:()=>0,Curve:()=>Sf,CurvePath:()=>aw,CustomBlending:()=>5,CustomToneMapping:()=>5,CylinderGeometry:()=>pk,Cylindrical:()=>iA,Data3DTexture:()=>xp,DataArrayTexture:()=>Pk,DataTexture:()=>Bg,DataTextureLoader:()=>jA,DataUtils:()=>kA,DecrementStencilOp:()=>7683,DecrementWrapStencilOp:()=>34056,DefaultLoadingManager:()=>bw,DepthFormat:()=>1026,DepthStencilFormat:()=>1027,DepthTexture:()=>yp,DetachedBindMode:()=>
"detached",DirectionalLight:()=>am,DirectionalLightHelper:()=>lA,DiscreteInterpolant:()=>cw,DisplayP3ColorSpace:()=>"display-p3",DodecahedronGeometry:()=>zp,DoubleSide:()=>2,DstAlphaFactor:()=>206,DstColorFactor:()=>208,DynamicCopyUsage:()=>35050,DynamicDrawUsage:()=>35048,DynamicReadUsage:()=>35049,EdgesGeometry:()=>dw,EllipseCurve:()=>bm,EqualCompare:()=>514,EqualDepth:()=>4,EqualStencilFunc:()=>514,EquirectangularReflectionMapping:()=>303,EquirectangularRefractionMapping:()=>304,Euler:()=>Ff,EventDispatcher:()=>
ng,ExtrudeGeometry:()=>Ap,FileLoader:()=>Tf,Float16BufferAttribute:()=>mA,Float32BufferAttribute:()=>$b,FloatType:()=>1015,Fog:()=>Bp,FogExp2:()=>Cp,FramebufferTexture:()=>nA,FrontSide:()=>0,Frustum:()=>hk,GLBufferAttribute:()=>oA,GLSL1:()=>"100",GLSL3:()=>"300 es",GreaterCompare:()=>516,GreaterDepth:()=>6,GreaterEqualCompare:()=>518,GreaterEqualDepth:()=>5,GreaterEqualStencilFunc:()=>518,GreaterStencilFunc:()=>516,GridHelper:()=>pA,Group:()=>af,HalfFloatType:()=>1016,HemisphereLight:()=>Dp,HemisphereLightHelper:()=>
qA,IcosahedronGeometry:()=>Ep,ImageBitmapLoader:()=>ew,ImageLoader:()=>sh,ImageUtils:()=>Pq,IncrementStencilOp:()=>7682,IncrementWrapStencilOp:()=>34055,InstancedBufferAttribute:()=>aj,InstancedBufferGeometry:()=>fw,InstancedInterleavedBuffer:()=>rA,InstancedMesh:()=>cm,Int16BufferAttribute:()=>sA,Int32BufferAttribute:()=>tA,Int8BufferAttribute:()=>uA,IntType:()=>1013,InterleavedBuffer:()=>qk,InterleavedBufferAttribute:()=>bj,Interpolant:()=>Jj,InterpolateDiscrete:()=>2300,InterpolateLinear:()=>2301,
InterpolateSmooth:()=>2302,InvertStencilOp:()=>5386,KeepStencilOp:()=>7680,KeyframeTrack:()=>Uf,LOD:()=>gw,LatheGeometry:()=>dm,Layers:()=>Sk,LessCompare:()=>513,LessDepth:()=>2,LessEqualCompare:()=>515,LessEqualDepth:()=>3,LessEqualStencilFunc:()=>515,LessStencilFunc:()=>513,Light:()=>Cg,LightProbe:()=>hw,Line:()=>cg,Line3:()=>vA,LineBasicMaterial:()=>mf,LineCurve:()=>Fp,LineCurve3:()=>iw,LineDashedMaterial:()=>jw,LineLoop:()=>Gp,LineSegments:()=>Vf,LinearDisplayP3ColorSpace:()=>"display-p3-linear",
LinearFilter:()=>1006,LinearInterpolant:()=>Hp,LinearMipMapLinearFilter:()=>1008,LinearMipMapNearestFilter:()=>1007,LinearMipmapLinearFilter:()=>1008,LinearMipmapNearestFilter:()=>1007,LinearSRGBColorSpace:()=>"srgb-linear",LinearToneMapping:()=>1,LinearTransfer:()=>"linear",Loader:()=>yf,LoaderUtils:()=>Dg,LoadingManager:()=>Ip,LoopOnce:()=>2200,LoopPingPong:()=>2202,LoopRepeat:()=>2201,LuminanceAlphaFormat:()=>1025,LuminanceFormat:()=>1024,MOUSE:()=>wA,Material:()=>Zd,MaterialLoader:()=>Jp,MathUtils:()=>
kw,Matrix3:()=>qd,Matrix4:()=>gd,MaxEquation:()=>104,Mesh:()=>Bd,MeshBasicMaterial:()=>Qd,MeshDepthMaterial:()=>fp,MeshDistanceMaterial:()=>gp,MeshLambertMaterial:()=>lw,MeshMatcapMaterial:()=>mw,MeshNormalMaterial:()=>nw,MeshPhongMaterial:()=>ow,MeshPhysicalMaterial:()=>Wf,MeshStandardMaterial:()=>Gj,MeshToonMaterial:()=>pw,MinEquation:()=>103,MirroredRepeatWrapping:()=>1002,MixOperation:()=>1,MultiplyBlending:()=>4,MultiplyOperation:()=>0,NearestFilter:()=>1003,NearestMipMapLinearFilter:()=>1005,
NearestMipMapNearestFilter:()=>1004,NearestMipmapLinearFilter:()=>1005,NearestMipmapNearestFilter:()=>1004,NeutralToneMapping:()=>7,NeverCompare:()=>512,NeverDepth:()=>0,NeverStencilFunc:()=>512,NoBlending:()=>0,NoColorSpace:()=>"",NoToneMapping:()=>0,NormalAnimationBlendMode:()=>2500,NormalBlending:()=>1,NotEqualCompare:()=>517,NotEqualDepth:()=>7,NotEqualStencilFunc:()=>517,NumberKeyframeTrack:()=>Wg,Object3D:()=>Cd,ObjectLoader:()=>xA,ObjectSpaceNormalMap:()=>1,OctahedronGeometry:()=>em,OneFactor:()=>
201,OneMinusConstantAlphaFactor:()=>214,OneMinusConstantColorFactor:()=>212,OneMinusDstAlphaFactor:()=>207,OneMinusDstColorFactor:()=>209,OneMinusSrcAlphaFactor:()=>205,OneMinusSrcColorFactor:()=>203,OrthographicCamera:()=>rk,P3Primaries:()=>"p3",PCFShadowMap:()=>1,PCFSoftShadowMap:()=>2,PMREMGenerator:()=>ap,Path:()=>sk,PerspectiveCamera:()=>ff,Plane:()=>yg,PlaneGeometry:()=>Df,PlaneHelper:()=>yA,PointLight:()=>Kp,PointLightHelper:()=>zA,Points:()=>Lp,PointsMaterial:()=>fm,PolarGridHelper:()=>AA,
PolyhedronGeometry:()=>cj,PositionalAudio:()=>BA,PropertyBinding:()=>Ed,PropertyMixer:()=>qw,QuadraticBezierCurve:()=>Mp,QuadraticBezierCurve3:()=>Np,Quaternion:()=>rf,QuaternionKeyframeTrack:()=>zg,QuaternionLinearInterpolant:()=>rw,RED_GREEN_RGTC2_Format:()=>36285,RED_RGTC1_Format:()=>36283,REVISION:()=>"163",RGBADepthPacking:()=>3201,RGBAFormat:()=>1023,RGBAIntegerFormat:()=>1033,RGBA_ASTC_10x10_Format:()=>37819,RGBA_ASTC_10x5_Format:()=>37816,RGBA_ASTC_10x6_Format:()=>37817,RGBA_ASTC_10x8_Format:()=>
37818,RGBA_ASTC_12x10_Format:()=>37820,RGBA_ASTC_12x12_Format:()=>37821,RGBA_ASTC_4x4_Format:()=>37808,RGBA_ASTC_5x4_Format:()=>37809,RGBA_ASTC_5x5_Format:()=>37810,RGBA_ASTC_6x5_Format:()=>37811,RGBA_ASTC_6x6_Format:()=>37812,RGBA_ASTC_8x5_Format:()=>37813,RGBA_ASTC_8x6_Format:()=>37814,RGBA_ASTC_8x8_Format:()=>37815,RGBA_BPTC_Format:()=>36492,RGBA_ETC2_EAC_Format:()=>37496,RGBA_PVRTC_2BPPV1_Format:()=>35843,RGBA_PVRTC_4BPPV1_Format:()=>35842,RGBA_S3TC_DXT1_Format:()=>33777,RGBA_S3TC_DXT3_Format:()=>
33778,RGBA_S3TC_DXT5_Format:()=>33779,RGBFormat:()=>1022,RGB_BPTC_SIGNED_Format:()=>36494,RGB_BPTC_UNSIGNED_Format:()=>36495,RGB_ETC1_Format:()=>36196,RGB_ETC2_Format:()=>37492,RGB_PVRTC_2BPPV1_Format:()=>35841,RGB_PVRTC_4BPPV1_Format:()=>35840,RGB_S3TC_DXT1_Format:()=>33776,RGFormat:()=>1030,RGIntegerFormat:()=>1031,RawShaderMaterial:()=>sw,Ray:()=>dj,Raycaster:()=>tw,Rec709Primaries:()=>"rec709",RectAreaLight:()=>uw,RedFormat:()=>1028,RedIntegerFormat:()=>1029,ReinhardToneMapping:()=>2,RenderTarget:()=>
vw,RepeatWrapping:()=>1E3,ReplaceStencilOp:()=>7681,ReverseSubtractEquation:()=>102,RingGeometry:()=>Op,SIGNED_RED_GREEN_RGTC2_Format:()=>36286,SIGNED_RED_RGTC1_Format:()=>36284,SRGBColorSpace:()=>"srgb",SRGBTransfer:()=>"srgb",Scene:()=>Pp,ShaderChunk:()=>vd,ShaderLib:()=>Pf,ShaderMaterial:()=>Of,ShadowMaterial:()=>ww,Shape:()=>ej,ShapeGeometry:()=>Qp,ShapePath:()=>CA,ShapeUtils:()=>og,ShortType:()=>1011,Skeleton:()=>gm,SkeletonHelper:()=>DA,SkinnedMesh:()=>Rp,Source:()=>fj,Sphere:()=>lf,SphereGeometry:()=>
kg,Spherical:()=>EA,SphericalHarmonics3:()=>xw,SplineCurve:()=>Sp,SpotLight:()=>Tp,SpotLightHelper:()=>FA,Sprite:()=>yw,SpriteMaterial:()=>Up,SrcAlphaFactor:()=>204,SrcAlphaSaturateFactor:()=>210,SrcColorFactor:()=>202,StaticCopyUsage:()=>35046,StaticDrawUsage:()=>35044,StaticReadUsage:()=>35045,StereoCamera:()=>GA,StreamCopyUsage:()=>35042,StreamDrawUsage:()=>35040,StreamReadUsage:()=>35041,StringKeyframeTrack:()=>Zg,SubtractEquation:()=>101,SubtractiveBlending:()=>3,TOUCH:()=>HA,TangentSpaceNormalMap:()=>
0,TetrahedronGeometry:()=>Vp,Texture:()=>Rd,TextureLoader:()=>gj,TorusGeometry:()=>Wp,TorusKnotGeometry:()=>Xp,Triangle:()=>Hf,TriangleFanDrawMode:()=>2,TriangleStripDrawMode:()=>1,TrianglesDrawMode:()=>0,TubeGeometry:()=>Yp,UVMapping:()=>300,Uint16BufferAttribute:()=>cp,Uint32BufferAttribute:()=>bp,Uint8BufferAttribute:()=>IA,Uint8ClampedBufferAttribute:()=>JA,Uniform:()=>zw,UniformsGroup:()=>KA,UniformsLib:()=>Ub,UniformsUtils:()=>pv,UnsignedByteType:()=>1009,UnsignedInt248Type:()=>1020,UnsignedInt5999Type:()=>
35902,UnsignedIntType:()=>1014,UnsignedShort4444Type:()=>1017,UnsignedShort5551Type:()=>1018,UnsignedShortType:()=>1012,VSMShadowMap:()=>3,Vector2:()=>Lb,Vector3:()=>mb,Vector4:()=>Md,VectorKeyframeTrack:()=>Xg,VideoTexture:()=>hm,WebGL3DRenderTarget:()=>LA,WebGLArrayRenderTarget:()=>MA,WebGLCoordinateSystem:()=>2E3,WebGLCubeRenderTarget:()=>Vq,WebGLMultipleRenderTargets:()=>NA,WebGLRenderTarget:()=>Qf,WebGLRenderer:()=>Aw,WebGLUtils:()=>tv,WebGPUCoordinateSystem:()=>2001,WireframeGeometry:()=>Bw,
WrapAroundEnding:()=>2402,ZeroCurvatureEnding:()=>2400,ZeroFactor:()=>200,ZeroSlopeEnding:()=>2401,ZeroStencilOp:()=>0,createCanvasElement:()=>Oq});class Nd{constructor(a,b,e,f,h){this.jc=this.Gc=this.v=this.Jd=this.z=this.y=this.x=0;a&&(this.x=a);b&&(this.y=b);e&&(this.z=e);f&&(this.Jd=f);h&&(this.v=h)}init(a,b,e,f,h){this.x=a;this.y=b;this.z=e;f&&(this.Jd=f);h&&(this.v=h)}toString(){return"("+this.x+","+this.y+","+this.z+") - ("+this.Jd+","+this.v+")"}za(a){let b=Math.sin(a);a=Math.cos(a);let e=
this.y,f=this.z;this.y=a*e-b*f;this.z=b*e+a*f}Ky(){let a=this.y;this.y=-this.z;this.z=a}Jy(){let a=this.y;this.y=this.z;this.z=-a}Ea(a){let b=Math.sin(a);a=Math.cos(a);let e=this.x,f=this.z;this.x=a*e+b*f;this.z=-b*e+a*f}Ly(){let a=this.x;this.x=-this.z;this.z=a}Ua(a){let b=Math.sin(a);a=Math.cos(a);let e=this.x,f=this.y;this.x=a*e-b*f;this.y=b*e+a*f}bt(){let a=this.x;this.x=-this.y;this.y=a}kc(a){this.za(a*Math.PI/180)}ad(a){this.Ea(a*Math.PI/180)}ye(a){this.Ua(a*Math.PI/180)}clone(){return new Nd(this.x,
this.y,this.z,this.Jd,this.v)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){let a=this.length();0<a&&(a=1/a,this.x*=a,this.y*=a,this.z*=a)}pl(a){return this.x*a.x+this.y*a.y+this.z*a.z}Ve(a,b){let e;e=Math.cos(b*Math.PI/180);this.x=e*Math.sin(a*Math.PI/180);this.y=Math.sin(b*Math.PI/180);this.z=e*Math.cos(a*Math.PI/180)}Ff(){return 180*Math.atan2(-this.x,-this.z)/Math.PI}Gf(){return 180*Math.asin(this.y/this.length())/Math.PI}ue(a,b,e){this.x=a.x*e+b.x*(1-e);this.y=
a.y*e+b.y*(1-e);this.z=a.z*e+b.z*(1-e);this.Jd=a.Jd*e+b.Jd*(1-e);this.v=a.v*e+b.v*(1-e)}}var yd={create:function(a){let b;b="undefined"!=typeof Float32Array?new Float32Array(16):Array(16);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15]);return b},set:function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];
b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b},identity:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},multiply:function(a,b,e){e||(e=a);let f=a[0],h=a[1],n=a[2],r=a[3],t=a[4],w=a[5],x=a[6],y=a[7],z=a[8],ab=a[9],eb=a[10],cb=a[11],db=a[12],bb=a[13],gb=a[14];a=a[15];let kb=b[0],qb=b[1],ob=b[2],pb=b[3],ub=b[4],rb=b[5],Ab=b[6],wb=b[7],Cb=b[8],Fb=b[9],Ob=b[10],Gb=b[11],Nb=b[12],Rb=b[13],
Pb=b[14];b=b[15];e[0]=kb*f+qb*t+ob*z+pb*db;e[1]=kb*h+qb*w+ob*ab+pb*bb;e[2]=kb*n+qb*x+ob*eb+pb*gb;e[3]=kb*r+qb*y+ob*cb+pb*a;e[4]=ub*f+rb*t+Ab*z+wb*db;e[5]=ub*h+rb*w+Ab*ab+wb*bb;e[6]=ub*n+rb*x+Ab*eb+wb*gb;e[7]=ub*r+rb*y+Ab*cb+wb*a;e[8]=Cb*f+Fb*t+Ob*z+Gb*db;e[9]=Cb*h+Fb*w+Ob*ab+Gb*bb;e[10]=Cb*n+Fb*x+Ob*eb+Gb*gb;e[11]=Cb*r+Fb*y+Ob*cb+Gb*a;e[12]=Nb*f+Rb*t+Pb*z+b*db;e[13]=Nb*h+Rb*w+Pb*ab+b*bb;e[14]=Nb*n+Rb*x+Pb*eb+b*gb;e[15]=Nb*r+Rb*y+Pb*cb+b*a;return e},translate:function(a,b,e){let f=b[0],h=b[1];b=b[2];
if(!e||a==e)return a[12]=a[0]*f+a[4]*h+a[8]*b+a[12],a[13]=a[1]*f+a[5]*h+a[9]*b+a[13],a[14]=a[2]*f+a[6]*h+a[10]*b+a[14],a[15]=a[3]*f+a[7]*h+a[11]*b+a[15],a;let n=a[0],r=a[1],t=a[2],w=a[3],x=a[4],y=a[5],z=a[6],ab=a[7],eb=a[8],cb=a[9],db=a[10],bb=a[11];e[0]=n;e[1]=r;e[2]=t;e[3]=w;e[4]=x;e[5]=y;e[6]=z;e[7]=ab;e[8]=eb;e[9]=cb;e[10]=db;e[11]=bb;e[12]=n*f+x*h+eb*b+a[12];e[13]=r*f+y*h+cb*b+a[13];e[14]=t*f+z*h+db*b+a[14];e[15]=w*f+ab*h+bb*b+a[15];return e},scale:function(a,b,e){let f=b[0],h=b[1];b=b[2];if(!e||
a==e)return a[0]*=f,a[1]*=f,a[2]*=f,a[3]*=f,a[4]*=h,a[5]*=h,a[6]*=h,a[7]*=h,a[8]*=b,a[9]*=b,a[10]*=b,a[11]*=b,a;e[0]=a[0]*f;e[1]=a[1]*f;e[2]=a[2]*f;e[3]=a[3]*f;e[4]=a[4]*h;e[5]=a[5]*h;e[6]=a[6]*h;e[7]=a[7]*h;e[8]=a[8]*b;e[9]=a[9]*b;e[10]=a[10]*b;e[11]=a[11]*b;e[12]=a[12];e[13]=a[13];e[14]=a[14];e[15]=a[15];return e},rotate:function(a,b,e,f){let h=e[0],n=e[1];e=e[2];let r=Math.sqrt(h*h+n*n+e*e);if(!r)return null;1!=r&&(r=1/r,h*=r,n*=r,e*=r);let t=Math.sin(b),w=Math.cos(b),x=1-w;b=a[0];r=a[1];let y=
a[2],z=a[3],ab=a[4],eb=a[5],cb=a[6],db=a[7],bb=a[8],gb=a[9],kb=a[10],qb=a[11],ob=h*h*x+w,pb=n*h*x+e*t,ub=e*h*x-n*t,rb=h*n*x-e*t,Ab=n*n*x+w,wb=e*n*x+h*t,Cb=h*e*x+n*t;h=n*e*x-h*t;n=e*e*x+w;f?a!=f&&(f[12]=a[12],f[13]=a[13],f[14]=a[14],f[15]=a[15]):f=a;f[0]=b*ob+ab*pb+bb*ub;f[1]=r*ob+eb*pb+gb*ub;f[2]=y*ob+cb*pb+kb*ub;f[3]=z*ob+db*pb+qb*ub;f[4]=b*rb+ab*Ab+bb*wb;f[5]=r*rb+eb*Ab+gb*wb;f[6]=y*rb+cb*Ab+kb*wb;f[7]=z*rb+db*Ab+qb*wb;f[8]=b*Cb+ab*h+bb*n;f[9]=r*Cb+eb*h+gb*n;f[10]=y*Cb+cb*h+kb*n;f[11]=z*Cb+db*h+
qb*n;return f},$v:function(a,b,e,f,h,n,r){r||(r=yd.create());let t=b-a,w=f-e,x=n-h;r[0]=2*h/t;r[1]=0;r[2]=0;r[3]=0;r[4]=0;r[5]=2*h/w;r[6]=0;r[7]=0;r[8]=(b+a)/t;r[9]=(f+e)/w;r[10]=-(n+h)/x;r[11]=-1;r[12]=0;r[13]=0;r[14]=-(n*h*2)/x;r[15]=0;return r},perspective:function(a,b,e,f,h){a=e*Math.tan(a*Math.PI/360);b*=a;return yd.$v(-b,b,-a,a,e,f,h)},jB:function(a,b,e,f,h,n,r){r||(r=yd.create());let t=b-a,w=f-e,x=n-h;r[0]=2/t;r[1]=0;r[2]=0;r[3]=0;r[4]=0;r[5]=2/w;r[6]=0;r[7]=0;r[8]=0;r[9]=0;r[10]=-2/x;r[11]=
0;r[12]=-(a+b)/t;r[13]=-(f+e)/w;r[14]=-(n+h)/x;r[15]=1;return r}};const wA={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},HA={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};class ng{addEventListener(a,b){void 0===this._listeners&&(this._listeners={});const e=this._listeners;void 0===e[a]&&(e[a]=[]);-1===e[a].indexOf(b)&&e[a].push(b)}hasEventListener(a,b){if(void 0===this._listeners)return!1;const e=this._listeners;return void 0!==e[a]&&-1!==e[a].indexOf(b)}removeEventListener(a,b){void 0!==this._listeners&&
(a=this._listeners[a],void 0!==a&&(b=a.indexOf(b),-1!==b&&a.splice(b,1)))}dispatchEvent(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;b=b.slice(0);for(let e=0,f=b.length;e<f;e++)b[e].call(this,a);a.target=null}}}}const of="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".split(" ");
let Cw=1234567;const hj=Math.PI/180,Kj=180/Math.PI,kw={DEG2RAD:hj,RAD2DEG:Kj,generateUUID:fd,clamp:jd,euclideanModulo:kf,mapLinear:function(a,b,e,f,h){return f+(a-b)*(h-f)/(e-b)},inverseLerp:function(a,b,e){return a!==b?(e-a)/(b-a):0},lerp:hg,damp:function(a,b,e,f){return hg(a,b,1-Math.exp(-e*f))},pingpong:function(a,b=1){return b-Math.abs(kf(a,2*b)-b)},smoothstep:function(a,b,e){if(a<=b)return 0;if(a>=e)return 1;a=(a-b)/(e-b);return a*a*(3-2*a)},smootherstep:function(a,b,e){if(a<=b)return 0;if(a>=
e)return 1;a=(a-b)/(e-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},seededRandom:function(a){void 0!==a&&(Cw=a);a=Cw+=1831565813;a=Math.imul(a^a>>>15,a|1);a^=a+Math.imul(a^a>>>7,a|61);return((a^a>>>14)>>>0)/4294967296},degToRad:function(a){return a*hj},radToDeg:function(a){return a*Kj},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},
ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))},setQuaternionFromProperEuler:function(a,b,e,f,h){var n=Math.cos;const r=Math.sin,t=n(e/2);e=r(e/2);const w=n((b+f)/2),x=r((b+f)/2),y=n((b-f)/2),z=r((b-f)/2);n=n((f-b)/2);b=r((f-b)/2);switch(h){case "XYX":a.set(t*x,e*y,e*z,t*w);break;case "YZY":a.set(e*z,t*x,e*y,t*w);break;case "ZXZ":a.set(e*y,e*z,t*x,t*w);break;case "XZX":a.set(t*x,e*b,e*n,
t*w);break;case "YXY":a.set(e*n,t*x,e*b,t*w);break;case "ZYZ":a.set(e*b,e*n,t*x,t*w);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+h)}},normalize:kd,denormalize:wf};class Lb{constructor(a=0,b=0){Lb.prototype.isVector2=!0;this.x=a;this.y=b}get width(){return this.x}set width(a){this.x=a}get height(){return this.y}set height(a){this.y=a}set(a,b){this.x=a;this.y=b;return this}setScalar(a){this.y=this.x=a;return this}setX(a){this.x=a;return this}setY(a){this.y=
a;return this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this}getComponent(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}}clone(){return new this.constructor(this.x,this.y)}copy(a){this.x=a.x;this.y=a.y;return this}add(a){this.x+=a.x;this.y+=a.y;return this}addScalar(a){this.x+=a;this.y+=a;return this}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this}addScaledVector(a,
b){this.x+=a.x*b;this.y+=a.y*b;return this}sub(a){this.x-=a.x;this.y-=a.y;return this}subScalar(a){this.x-=a;this.y-=a;return this}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this}multiply(a){this.x*=a.x;this.y*=a.y;return this}multiplyScalar(a){this.x*=a;this.y*=a;return this}divide(a){this.x/=a.x;this.y/=a.y;return this}divideScalar(a){return this.multiplyScalar(1/a)}applyMatrix3(a){const b=this.x,e=this.y;a=a.elements;this.x=a[0]*b+a[3]*e+a[6];this.y=a[1]*b+a[4]*e+a[7];return this}min(a){this.x=
Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this}max(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this}clamp(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this}clampScalar(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));return this}clampLength(a,b){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(a,Math.min(b,e)))}floor(){this.x=Math.floor(this.x);this.y=
Math.floor(this.y);return this}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this}roundToZero(){this.x=Math.trunc(this.x);this.y=Math.trunc(this.y);return this}negate(){this.x=-this.x;this.y=-this.y;return this}dot(a){return this.x*a.x+this.y*a.y}cross(a){return this.x*a.y-this.y*a.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(a){const b=Math.sqrt(this.lengthSq()*a.lengthSq());if(0===b)return Math.PI/2;a=this.dot(a)/b;return Math.acos(jd(a,-1,1))}distanceTo(a){return Math.sqrt(this.distanceToSquared(a))}distanceToSquared(a){const b=this.x-a.x;a=this.y-a.y;return b*b+a*a}manhattanDistanceTo(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)}setLength(a){return this.normalize().multiplyScalar(a)}lerp(a,
b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this}lerpVectors(a,b,e){this.x=a.x+(b.x-a.x)*e;this.y=a.y+(b.y-a.y)*e;return this}equals(a){return a.x===this.x&&a.y===this.y}fromArray(a,b=0){this.x=a[b];this.y=a[b+1];return this}toArray(a=[],b=0){a[b]=this.x;a[b+1]=this.y;return a}fromBufferAttribute(a,b){this.x=a.getX(b);this.y=a.getY(b);return this}rotateAround(a,b){const e=Math.cos(b);b=Math.sin(b);const f=this.x-a.x,h=this.y-a.y;this.x=f*e-h*b+a.x;this.y=f*b+h*e+a.y;return this}random(){this.x=
Math.random();this.y=Math.random();return this}*[Symbol.iterator](){yield this.x;yield this.y}}class qd{constructor(a,b,e,f,h,n,r,t,w){qd.prototype.isMatrix3=!0;this.elements=[1,0,0,0,1,0,0,0,1];void 0!==a&&this.set(a,b,e,f,h,n,r,t,w)}set(a,b,e,f,h,n,r,t,w){const x=this.elements;x[0]=a;x[1]=f;x[2]=r;x[3]=b;x[4]=h;x[5]=t;x[6]=e;x[7]=n;x[8]=w;return this}identity(){this.set(1,0,0,0,1,0,0,0,1);return this}copy(a){const b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=
a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this}extractBasis(a,b,e){a.setFromMatrix3Column(this,0);b.setFromMatrix3Column(this,1);e.setFromMatrix3Column(this,2);return this}setFromMatrix4(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this}multiply(a){return this.multiplyMatrices(this,a)}premultiply(a){return this.multiplyMatrices(a,this)}multiplyMatrices(a,b){var e=a.elements,f=b.elements;b=this.elements;a=e[0];const h=e[3],n=e[6],r=e[1],t=e[4],w=e[7],x=e[2],y=e[5];
e=e[8];const z=f[0],ab=f[3],eb=f[6],cb=f[1],db=f[4],bb=f[7],gb=f[2],kb=f[5];f=f[8];b[0]=a*z+h*cb+n*gb;b[3]=a*ab+h*db+n*kb;b[6]=a*eb+h*bb+n*f;b[1]=r*z+t*cb+w*gb;b[4]=r*ab+t*db+w*kb;b[7]=r*eb+t*bb+w*f;b[2]=x*z+y*cb+e*gb;b[5]=x*ab+y*db+e*kb;b[8]=x*eb+y*bb+e*f;return this}multiplyScalar(a){const b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this}determinant(){var a=this.elements;const b=a[0],e=a[1],f=a[2],h=a[3],n=a[4],r=a[5],t=a[6],w=a[7];a=a[8];return b*
n*a-b*r*w-e*h*a+e*r*t+f*h*w-f*n*t}invert(){const a=this.elements,b=a[0],e=a[1],f=a[2],h=a[3],n=a[4],r=a[5],t=a[6],w=a[7],x=a[8],y=x*n-r*w,z=r*t-x*h,ab=w*h-n*t;var eb=b*y+e*z+f*ab;if(0===eb)return this.set(0,0,0,0,0,0,0,0,0);eb=1/eb;a[0]=y*eb;a[1]=(f*w-x*e)*eb;a[2]=(r*e-f*n)*eb;a[3]=z*eb;a[4]=(x*b-f*t)*eb;a[5]=(f*h-r*b)*eb;a[6]=ab*eb;a[7]=(e*t-w*b)*eb;a[8]=(n*b-e*h)*eb;return this}transpose(){let a;const b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this}getNormalMatrix(a){return this.setFromMatrix4(a).invert().transpose()}transposeIntoArray(a){const b=
this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}setUvTransform(a,b,e,f,h,n,r){const t=Math.cos(h);h=Math.sin(h);this.set(e*t,e*h,-e*(t*n+h*r)+n+a,-f*h,f*t,-f*(-h*n+t*r)+r+b,0,0,1);return this}scale(a,b){this.premultiply(Zp.makeScale(a,b));return this}rotate(a){this.premultiply(Zp.makeRotation(-a));return this}translate(a,b){this.premultiply(Zp.makeTranslation(a,b));return this}makeTranslation(a,b){a.isVector2?this.set(1,0,a.x,0,1,
a.y,0,0,1):this.set(1,0,a,0,1,b,0,0,1);return this}makeRotation(a){const b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,a,b,0,0,0,1);return this}makeScale(a,b){this.set(a,0,0,0,b,0,0,0,1);return this}equals(a){const b=this.elements;a=a.elements;for(let e=0;9>e;e++)if(b[e]!==a[e])return!1;return!0}fromArray(a,b=0){for(let e=0;9>e;e++)this.elements[e]=a[e+b];return this}toArray(a=[],b=0){const e=this.elements;a[b]=e[0];a[b+1]=e[1];a[b+2]=e[2];a[b+3]=e[3];a[b+4]=e[4];a[b+5]=e[5];a[b+6]=e[6];a[b+7]=e[7];
a[b+8]=e[8];return a}clone(){return(new this.constructor).fromArray(this.elements)}}const Zp=new qd,Lj={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Dw=(new qd).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ew=(new qd).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),im={["srgb-linear"]:{transfer:"linear",primaries:"rec709",toReference:a=>a,fromReference:a=>a},srgb:{transfer:"srgb",
primaries:"rec709",toReference:a=>a.convertSRGBToLinear(),fromReference:a=>a.convertLinearToSRGB()},["display-p3-linear"]:{transfer:"linear",primaries:"p3",toReference:a=>a.applyMatrix3(Ew),fromReference:a=>a.applyMatrix3(Dw)},["display-p3"]:{transfer:"srgb",primaries:"p3",toReference:a=>a.convertSRGBToLinear().applyMatrix3(Ew),fromReference:a=>a.applyMatrix3(Dw).convertLinearToSRGB()}},OA=new Set(["srgb-linear","display-p3-linear"]),Fd={enabled:!0,_workingColorSpace:"srgb-linear",get workingColorSpace(){return this._workingColorSpace},
set workingColorSpace(a){if(!OA.has(a))throw Error(`Unsupported working color space, "${a}".`);this._workingColorSpace=a},convert:function(a,b,e){if(!1===this.enabled||b===e||!b||!e)return a;b=im[b].toReference;e=im[e].fromReference;return e(b(a))},fromWorkingColorSpace:function(a,b){return this.convert(a,this._workingColorSpace,b)},toWorkingColorSpace:function(a,b){return this.convert(a,b,this._workingColorSpace)},getPrimaries:function(a){return im[a].primaries},getTransfer:function(a){return""===
a?"linear":im[a].transfer}};let Mj;class Pq{static getDataURL(a){if(/^data:/i.test(a.src)||"undefined"===typeof HTMLCanvasElement)return a.src;if(a instanceof HTMLCanvasElement)var b=a;else void 0===Mj&&(Mj=wj("canvas")),Mj.width=a.width,Mj.height=a.height,b=Mj.getContext("2d"),a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height),b=Mj;return 2048<b.width||2048<b.height?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",a),b.toDataURL("image/jpeg",
.6)):b.toDataURL("image/png")}static sRGBToLinear(a){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap){var b=wj("canvas");b.width=a.width;b.height=a.height;var e=b.getContext("2d");e.drawImage(a,0,0,a.width,a.height);a=e.getImageData(0,0,a.width,a.height);const f=a.data;for(let h=0;h<f.length;h++)f[h]=255*xj(f[h]/255);e.putImageData(a,0,0);return b}if(a.data){b=
a.data.slice(0);for(e=0;e<b.length;e++)b[e]=b instanceof Uint8Array||b instanceof Uint8ClampedArray?Math.floor(255*xj(b[e]/255)):xj(b[e]);return{data:b,width:a.width,height:a.height}}console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.");return a}}let PA=0;class fj{constructor(a=null){this.isSource=!0;Object.defineProperty(this,"id",{value:PA++});this.uuid=fd();this.data=a;this.dataReady=!0;this.version=0}set needsUpdate(a){!0===a&&this.version++}toJSON(a){const b=
void 0===a||"string"===typeof a;if(!b&&void 0!==a.images[this.uuid])return a.images[this.uuid];const e={uuid:this.uuid,url:""},f=this.data;if(null!==f){let h;if(Array.isArray(f)){h=[];for(let n=0,r=f.length;n<r;n++)f[n].isDataTexture?h.push(Xm(f[n].image)):h.push(Xm(f[n]))}else h=Xm(f);e.url=h}b||(a.images[this.uuid]=e);return e}}let QA=0;class Rd extends ng{constructor(a=Rd.DEFAULT_IMAGE,b=Rd.DEFAULT_MAPPING,e=1001,f=1001,h=1006,n=1008,r=1023,t=1009,w=Rd.DEFAULT_ANISOTROPY,x=""){super();this.isTexture=
!0;Object.defineProperty(this,"id",{value:QA++});this.uuid=fd();this.name="";this.source=new fj(a);this.mipmaps=[];this.mapping=b;this.channel=0;this.wrapS=e;this.wrapT=f;this.magFilter=h;this.minFilter=n;this.anisotropy=w;this.format=r;this.internalFormat=null;this.type=t;this.offset=new Lb(0,0);this.repeat=new Lb(1,1);this.center=new Lb(0,0);this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new qd;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.colorSpace=
x;this.userData={};this.version=0;this.onUpdate=null;this.isRenderTargetTexture=!1;this.pmremVersion=0}get image(){return this.source.data}set image(a=null){this.source.data=a}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(a){this.name=a.name;this.source=a.source;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.channel=a.channel;this.wrapS=a.wrapS;
this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.internalFormat=a.internalFormat;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.center.copy(a.center);this.rotation=a.rotation;this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrix.copy(a.matrix);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.colorSpace=
a.colorSpace;this.userData=JSON.parse(JSON.stringify(a.userData));this.needsUpdate=!0;return this}toJSON(a){const b=void 0===a||"string"===typeof a;if(!b&&void 0!==a.textures[this.uuid])return a.textures[this.uuid];const e={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(a).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};0<Object.keys(this.userData).length&&(e.userData=this.userData);b||(a.textures[this.uuid]=e);return e}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(a){if(300!==
this.mapping)return a;a.applyMatrix3(this.matrix);if(0>a.x||1<a.x)switch(this.wrapS){case 1E3:a.x-=Math.floor(a.x);break;case 1001:a.x=0>a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1<a.y)switch(this.wrapT){case 1E3:a.y-=Math.floor(a.y);break;case 1001:a.y=0>a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}set needsUpdate(a){!0===a&&(this.version++,this.source.needsUpdate=
!0)}set needsPMREMUpdate(a){!0===a&&this.pmremVersion++}}Rd.DEFAULT_IMAGE=null;Rd.DEFAULT_MAPPING=300;Rd.DEFAULT_ANISOTROPY=1;class Md{constructor(a=0,b=0,e=0,f=1){Md.prototype.isVector4=!0;this.x=a;this.y=b;this.z=e;this.w=f}get width(){return this.z}set width(a){this.z=a}get height(){return this.w}set height(a){this.w=a}set(a,b,e,f){this.x=a;this.y=b;this.z=e;this.w=f;return this}setScalar(a){this.w=this.z=this.y=this.x=a;return this}setX(a){this.x=a;return this}setY(a){this.y=a;return this}setZ(a){this.z=
a;return this}setW(a){this.w=a;return this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this}getComponent(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==
a.w?a.w:1;return this}add(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this}addScalar(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this}addScaledVector(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this}sub(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this}subScalar(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this}subVectors(a,b){this.x=a.x-b.x;this.y=
a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this}multiply(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;this.w*=a.w;return this}multiplyScalar(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this}applyMatrix4(a){const b=this.x,e=this.y,f=this.z,h=this.w;a=a.elements;this.x=a[0]*b+a[4]*e+a[8]*f+a[12]*h;this.y=a[1]*b+a[5]*e+a[9]*f+a[13]*h;this.z=a[2]*b+a[6]*e+a[10]*f+a[14]*h;this.w=a[3]*b+a[7]*e+a[11]*f+a[15]*h;return this}divideScalar(a){return this.multiplyScalar(1/a)}setAxisAngleFromQuaternion(a){this.w=
2*Math.acos(a.w);const b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this}setAxisAngleFromRotationMatrix(a){a=a.elements;var b=a[0];var e=a[4];var f=a[8];const h=a[1];var n=a[5],r=a[9];var t=a[2];var w=a[6];var x=a[10];if(.01>Math.abs(e-h)&&.01>Math.abs(f-t)&&.01>Math.abs(r-w)){if(.1>Math.abs(e+h)&&.1>Math.abs(f+t)&&.1>Math.abs(r+w)&&.1>Math.abs(b+n+x-3))return this.set(1,0,0,0),this;a=Math.PI;b=(b+1)/2;n=(n+1)/2;x=(x+1)/2;e=(e+h)/4;f=(f+
t)/4;r=(r+w)/4;b>n&&b>x?.01>b?(w=0,e=t=.707106781):(w=Math.sqrt(b),t=e/w,e=f/w):n>x?.01>n?(w=.707106781,t=0,e=.707106781):(t=Math.sqrt(n),w=e/t,e=r/t):.01>x?(t=w=.707106781,e=0):(e=Math.sqrt(x),w=f/e,t=r/e);this.set(w,t,e,a);return this}a=Math.sqrt((w-r)*(w-r)+(f-t)*(f-t)+(h-e)*(h-e));.001>Math.abs(a)&&(a=1);this.x=(w-r)/a;this.y=(f-t)/a;this.z=(h-e)/a;this.w=Math.acos((b+n+x-1)/2);return this}min(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,
a.w);return this}max(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this}clamp(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this}clampScalar(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a,Math.min(b,this.z));this.w=Math.max(a,Math.min(b,this.w));
return this}clampLength(a,b){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(a,Math.min(b,e)))}floor(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this}roundToZero(){this.x=
Math.trunc(this.x);this.y=Math.trunc(this.y);this.z=Math.trunc(this.z);this.w=Math.trunc(this.w);return this}negate(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this}dot(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.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(a){return this.normalize().multiplyScalar(a)}lerp(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}lerpVectors(a,b,e){this.x=a.x+(b.x-a.x)*e;this.y=a.y+(b.y-a.y)*e;this.z=a.z+(b.z-a.z)*e;this.w=a.w+(b.w-a.w)*e;return this}equals(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w}fromArray(a,b=0){this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this}toArray(a=[],b=0){a[b]=this.x;a[b+1]=this.y;a[b+2]=
this.z;a[b+3]=this.w;return a}fromBufferAttribute(a,b){this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}random(){this.x=Math.random();this.y=Math.random();this.z=Math.random();this.w=Math.random();return this}*[Symbol.iterator](){yield this.x;yield this.y;yield this.z;yield this.w}}class vw extends ng{constructor(a=1,b=1,e={}){super();this.isRenderTarget=!0;this.width=a;this.height=b;this.depth=1;this.scissor=new Md(0,0,a,b);this.scissorTest=!1;this.viewport=new Md(0,
0,a,b);a={width:a,height:b,depth:1};e=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},e);a=new Rd(a,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace);a.flipY=!1;a.generateMipmaps=e.generateMipmaps;a.internalFormat=e.internalFormat;this.textures=[];b=e.count;for(let f=0;f<b;f++)this.textures[f]=a.clone(),this.textures[f].isRenderTargetTexture=!0;this.depthBuffer=e.depthBuffer;
this.stencilBuffer=e.stencilBuffer;this.depthTexture=e.depthTexture;this.samples=e.samples}get texture(){return this.textures[0]}set texture(a){this.textures[0]=a}setSize(a,b,e=1){if(this.width!==a||this.height!==b||this.depth!==e){this.width=a;this.height=b;this.depth=e;for(let f=0,h=this.textures.length;f<h;f++)this.textures[f].image.width=a,this.textures[f].image.height=b,this.textures[f].image.depth=e;this.dispose()}this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)}clone(){return(new this.constructor).copy(this)}copy(a){this.width=
a.width;this.height=a.height;this.depth=a.depth;this.scissor.copy(a.scissor);this.scissorTest=a.scissorTest;this.viewport.copy(a.viewport);this.textures.length=0;for(let e=0,f=a.textures.length;e<f;e++)this.textures[e]=a.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0;const b=Object.assign({},a.texture.image);this.texture.source=new fj(b);this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;null!==a.depthTexture&&(this.depthTexture=a.depthTexture.clone());this.samples=a.samples;
return this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qf extends vw{constructor(a=1,b=1,e={}){super(a,b,e);this.isWebGLRenderTarget=!0}}class Pk extends Rd{constructor(a=null,b=1,e=1,f=1){super(null);this.isDataArrayTexture=!0;this.image={data:a,width:b,height:e,depth:f};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}}class MA extends Qf{constructor(a=1,b=1,e=1,f={}){super(a,b,f);this.isWebGLArrayRenderTarget=!0;this.depth=
e;this.texture=new Pk(null,a,b,e);this.texture.isRenderTargetTexture=!0}}class xp extends Rd{constructor(a=null,b=1,e=1,f=1){super(null);this.isData3DTexture=!0;this.image={data:a,width:b,height:e,depth:f};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}}class LA extends Qf{constructor(a=1,b=1,e=1,f={}){super(a,b,f);this.isWebGL3DRenderTarget=!0;this.depth=e;this.texture=new xp(null,a,b,e);this.texture.isRenderTargetTexture=!0}}class rf{constructor(a=
0,b=0,e=0,f=1){this.isQuaternion=!0;this._x=a;this._y=b;this._z=e;this._w=f}static slerpFlat(a,b,e,f,h,n,r){let t=e[f+0],w=e[f+1],x=e[f+2];e=e[f+3];f=h[n+0];const y=h[n+1],z=h[n+2];h=h[n+3];if(0===r)a[b+0]=t,a[b+1]=w,a[b+2]=x,a[b+3]=e;else if(1===r)a[b+0]=f,a[b+1]=y,a[b+2]=z,a[b+3]=h;else{if(e!==h||t!==f||w!==y||x!==z){n=1-r;var ab=t*f+w*y+x*z+e*h,eb=0<=ab?1:-1,cb=1-ab*ab;cb>Number.EPSILON&&(cb=Math.sqrt(cb),ab=Math.atan2(cb,ab*eb),n=Math.sin(n*ab)/cb,r=Math.sin(r*ab)/cb);eb*=r;t=t*n+f*eb;w=w*n+y*
eb;x=x*n+z*eb;e=e*n+h*eb;n===1-r&&(r=1/Math.sqrt(t*t+w*w+x*x+e*e),t*=r,w*=r,x*=r,e*=r)}a[b]=t;a[b+1]=w;a[b+2]=x;a[b+3]=e}}static multiplyQuaternionsFlat(a,b,e,f,h,n){const r=e[f],t=e[f+1],w=e[f+2];e=e[f+3];f=h[n];const x=h[n+1],y=h[n+2];h=h[n+3];a[b]=r*h+e*f+t*y-w*x;a[b+1]=t*h+e*x+w*f-r*y;a[b+2]=w*h+e*y+r*x-t*f;a[b+3]=e*h-r*f-t*x-w*y;return a}get x(){return this._x}set x(a){this._x=a;this._onChangeCallback()}get y(){return this._y}set y(a){this._y=a;this._onChangeCallback()}get z(){return this._z}set z(a){this._z=
a;this._onChangeCallback()}get w(){return this._w}set w(a){this._w=a;this._onChangeCallback()}set(a,b,e,f){this._x=a;this._y=b;this._z=e;this._w=f;this._onChangeCallback();return this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this}setFromEuler(a,b=!0){var e=a._x,f=a._y,h=a._z;a=a._order;var n=Math.cos;const r=Math.sin,t=n(e/2),w=n(f/2);n=n(h/2);e=r(e/2);f=r(f/2);h=r(h/2);switch(a){case "XYZ":this._x=
e*w*n+t*f*h;this._y=t*f*n-e*w*h;this._z=t*w*h+e*f*n;this._w=t*w*n-e*f*h;break;case "YXZ":this._x=e*w*n+t*f*h;this._y=t*f*n-e*w*h;this._z=t*w*h-e*f*n;this._w=t*w*n+e*f*h;break;case "ZXY":this._x=e*w*n-t*f*h;this._y=t*f*n+e*w*h;this._z=t*w*h+e*f*n;this._w=t*w*n-e*f*h;break;case "ZYX":this._x=e*w*n-t*f*h;this._y=t*f*n+e*w*h;this._z=t*w*h-e*f*n;this._w=t*w*n+e*f*h;break;case "YZX":this._x=e*w*n+t*f*h;this._y=t*f*n+e*w*h;this._z=t*w*h-e*f*n;this._w=t*w*n-e*f*h;break;case "XZY":this._x=e*w*n-t*f*h;this._y=
t*f*n-e*w*h;this._z=t*w*h+e*f*n;this._w=t*w*n+e*f*h;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}!0===b&&this._onChangeCallback();return this}setFromAxisAngle(a,b){b/=2;const e=Math.sin(b);this._x=a.x*e;this._y=a.y*e;this._z=a.z*e;this._w=Math.cos(b);this._onChangeCallback();return this}setFromRotationMatrix(a){var b=a.elements,e=b[0];a=b[4];const f=b[8],h=b[1],n=b[5],r=b[9],t=b[2],w=b[6];b=b[10];const x=e+n+b;0<x?(e=.5/Math.sqrt(x+1),this._w=.25/
e,this._x=(w-r)*e,this._y=(f-t)*e,this._z=(h-a)*e):e>n&&e>b?(e=2*Math.sqrt(1+e-n-b),this._w=(w-r)/e,this._x=.25*e,this._y=(a+h)/e,this._z=(f+t)/e):n>b?(e=2*Math.sqrt(1+n-e-b),this._w=(f-t)/e,this._x=(a+h)/e,this._y=.25*e,this._z=(r+w)/e):(e=2*Math.sqrt(1+b-e-n),this._w=(h-a)/e,this._x=(f+t)/e,this._y=(r+w)/e,this._z=.25*e);this._onChangeCallback();return this}setFromUnitVectors(a,b){let e=a.dot(b)+1;e<Number.EPSILON?(e=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,
this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=e;return this.normalize()}angleTo(a){return 2*Math.acos(Math.abs(jd(this.dot(a),-1,1)))}rotateTowards(a,b){const e=this.angleTo(a);if(0===e)return this;this.slerp(a,Math.min(1,b/e));return this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this}dot(a){return this._x*a._x+this._y*a._y+this._z*
a._z+this._w*a._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 a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this}multiply(a){return this.multiplyQuaternions(this,a)}premultiply(a){return this.multiplyQuaternions(a,this)}multiplyQuaternions(a,b){const e=a._x,
f=a._y,h=a._z;a=a._w;const n=b._x,r=b._y,t=b._z;b=b._w;this._x=e*b+a*n+f*t-h*r;this._y=f*b+a*r+h*n-e*t;this._z=h*b+a*t+e*r-f*n;this._w=a*b-e*n-f*r-h*t;this._onChangeCallback();return this}slerp(a,b){if(0===b)return this;if(1===b)return this.copy(a);const e=this._x,f=this._y,h=this._z,n=this._w;var r=n*a._w+e*a._x+f*a._y+h*a._z;0>r?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,r=-r):this.copy(a);if(1<=r)return this._w=n,this._x=e,this._y=f,this._z=h,this;a=1-r*r;if(a<=Number.EPSILON)return r=
1-b,this._w=r*n+b*this._w,this._x=r*e+b*this._x,this._y=r*f+b*this._y,this._z=r*h+b*this._z,this.normalize(),this;a=Math.sqrt(a);const t=Math.atan2(a,r);r=Math.sin((1-b)*t)/a;b=Math.sin(b*t)/a;this._w=n*r+this._w*b;this._x=e*r+this._x*b;this._y=f*r+this._y*b;this._z=h*r+this._z*b;this._onChangeCallback();return this}slerpQuaternions(a,b,e){return this.copy(a).slerp(b,e)}random(){const a=2*Math.PI*Math.random(),b=2*Math.PI*Math.random();var e=Math.random();const f=Math.sqrt(1-e);e=Math.sqrt(e);return this.set(f*
Math.sin(a),f*Math.cos(a),e*Math.sin(b),e*Math.cos(b))}equals(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w}fromArray(a,b=0){this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this._onChangeCallback();return this}toArray(a=[],b=0){a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a}fromBufferAttribute(a,b){this._x=a.getX(b);this._y=a.getY(b);this._z=a.getZ(b);this._w=a.getW(b);this._onChangeCallback();return this}toJSON(){return this.toArray()}_onChange(a){this._onChangeCallback=
a;return this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x;yield this._y;yield this._z;yield this._w}}class mb{constructor(a=0,b=0,e=0){mb.prototype.isVector3=!0;this.x=a;this.y=b;this.z=e}set(a,b,e){void 0===e&&(e=this.z);this.x=a;this.y=b;this.z=e;return this}setScalar(a){this.z=this.y=this.x=a;return this}setX(a){this.x=a;return this}setY(a){this.y=a;return this}setZ(a){this.z=a;return this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;
default:throw Error("index is out of range: "+a);}return this}getComponent(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(a){this.x=a.x;this.y=a.y;this.z=a.z;return this}add(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this}addScalar(a){this.x+=a;this.y+=a;this.z+=a;return this}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this}addScaledVector(a,
b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this}sub(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}subScalar(a){this.x-=a;this.y-=a;this.z-=a;return this}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this}multiply(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this}multiplyScalar(a){this.x*=a;this.y*=a;this.z*=a;return this}multiplyVectors(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this}applyEuler(a){return this.applyQuaternion(Fw.setFromEuler(a))}applyAxisAngle(a,
b){return this.applyQuaternion(Fw.setFromAxisAngle(a,b))}applyMatrix3(a){const b=this.x,e=this.y,f=this.z;a=a.elements;this.x=a[0]*b+a[3]*e+a[6]*f;this.y=a[1]*b+a[4]*e+a[7]*f;this.z=a[2]*b+a[5]*e+a[8]*f;return this}applyNormalMatrix(a){return this.applyMatrix3(a).normalize()}applyMatrix4(a){const b=this.x,e=this.y,f=this.z;a=a.elements;const h=1/(a[3]*b+a[7]*e+a[11]*f+a[15]);this.x=(a[0]*b+a[4]*e+a[8]*f+a[12])*h;this.y=(a[1]*b+a[5]*e+a[9]*f+a[13])*h;this.z=(a[2]*b+a[6]*e+a[10]*f+a[14])*h;return this}applyQuaternion(a){const b=
this.x,e=this.y,f=this.z,h=a.x,n=a.y,r=a.z;a=a.w;const t=2*(n*f-r*e),w=2*(r*b-h*f),x=2*(h*e-n*b);this.x=b+a*t+n*x-r*w;this.y=e+a*w+r*t-h*x;this.z=f+a*x+h*w-n*t;return this}project(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)}unproject(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)}transformDirection(a){const b=this.x,e=this.y,f=this.z;a=a.elements;this.x=a[0]*b+a[4]*e+a[8]*f;this.y=a[1]*b+a[5]*e+a[9]*f;this.z=a[2]*b+a[6]*e+
a[10]*f;return this.normalize()}divide(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this}divideScalar(a){return this.multiplyScalar(1/a)}min(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this}max(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this}clamp(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this}clampScalar(a,
b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a,Math.min(b,this.z));return this}clampLength(a,b){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(a,Math.min(b,e)))}floor(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);
return this}roundToZero(){this.x=Math.trunc(this.x);this.y=Math.trunc(this.y);this.z=Math.trunc(this.z);return this}negate(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this}dot(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){return this.normalize().multiplyScalar(a)}lerp(a,
b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this}lerpVectors(a,b,e){this.x=a.x+(b.x-a.x)*e;this.y=a.y+(b.y-a.y)*e;this.z=a.z+(b.z-a.z)*e;return this}cross(a){return this.crossVectors(this,a)}crossVectors(a,b){const e=a.x,f=a.y;a=a.z;const h=b.x,n=b.y;b=b.z;this.x=f*b-a*n;this.y=a*h-e*b;this.z=e*n-f*h;return this}projectOnVector(a){var b=a.lengthSq();if(0===b)return this.set(0,0,0);b=a.dot(this)/b;return this.copy(a).multiplyScalar(b)}projectOnPlane(a){$p.copy(this).projectOnVector(a);
return this.sub($p)}reflect(a){return this.sub($p.copy(a).multiplyScalar(2*this.dot(a)))}angleTo(a){const b=Math.sqrt(this.lengthSq()*a.lengthSq());if(0===b)return Math.PI/2;a=this.dot(a)/b;return Math.acos(jd(a,-1,1))}distanceTo(a){return Math.sqrt(this.distanceToSquared(a))}distanceToSquared(a){const b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+a*a}manhattanDistanceTo(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)}setFromSpherical(a){return this.setFromSphericalCoords(a.radius,
a.phi,a.theta)}setFromSphericalCoords(a,b,e){const f=Math.sin(b)*a;this.x=f*Math.sin(e);this.y=Math.cos(b)*a;this.z=f*Math.cos(e);return this}setFromCylindrical(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)}setFromCylindricalCoords(a,b,e){this.x=a*Math.sin(b);this.y=e;this.z=a*Math.cos(b);return this}setFromMatrixPosition(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this}setFromMatrixScale(a){const b=this.setFromMatrixColumn(a,0).length(),e=this.setFromMatrixColumn(a,
1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=e;this.z=a;return this}setFromMatrixColumn(a,b){return this.fromArray(a.elements,4*b)}setFromMatrix3Column(a,b){return this.fromArray(a.elements,3*b)}setFromEuler(a){this.x=a._x;this.y=a._y;this.z=a._z;return this}setFromColor(a){this.x=a.r;this.y=a.g;this.z=a.b;return this}equals(a){return a.x===this.x&&a.y===this.y&&a.z===this.z}fromArray(a,b=0){this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this}toArray(a=[],b=0){a[b]=this.x;
a[b+1]=this.y;a[b+2]=this.z;return a}fromBufferAttribute(a,b){this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}random(){this.x=Math.random();this.y=Math.random();this.z=Math.random();return this}randomDirection(){const a=Math.random()*Math.PI*2,b=2*Math.random()-1,e=Math.sqrt(1-b*b);this.x=e*Math.cos(a);this.y=b;this.z=e*Math.sin(a);return this}*[Symbol.iterator](){yield this.x;yield this.y;yield this.z}}const $p=new mb,Fw=new rf;class qf{constructor(a=new mb(Infinity,Infinity,Infinity),
b=new mb(-Infinity,-Infinity,-Infinity)){this.isBox3=!0;this.min=a;this.max=b}set(a,b){this.min.copy(a);this.max.copy(b);return this}setFromArray(a){this.makeEmpty();for(let b=0,e=a.length;b<e;b+=3)this.expandByPoint(Xf.fromArray(a,b));return this}setFromBufferAttribute(a){this.makeEmpty();for(let b=0,e=a.count;b<e;b++)this.expandByPoint(Xf.fromBufferAttribute(a,b));return this}setFromPoints(a){this.makeEmpty();for(let b=0,e=a.length;b<e;b++)this.expandByPoint(a[b]);return this}setFromCenterAndSize(a,
b){b=Xf.copy(b).multiplyScalar(.5);this.min.copy(a).sub(b);this.max.copy(a).add(b);return this}setFromObject(a,b=!1){this.makeEmpty();return this.expandByObject(a,b)}clone(){return(new this.constructor).copy(this)}copy(a){this.min.copy(a.min);this.max.copy(a.max);return this}makeEmpty(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(a){return this.isEmpty()?
a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(a){return this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)}expandByPoint(a){this.min.min(a);this.max.max(a);return this}expandByVector(a){this.min.sub(a);this.max.add(a);return this}expandByScalar(a){this.min.addScalar(-a);this.max.addScalar(a);return this}expandByObject(a,b=!1){a.updateWorldMatrix(!1,!1);const e=a.geometry;if(void 0!==e){const f=e.getAttribute("position");if(!0===b&&void 0!==f&&!0!==a.isInstancedMesh)for(let h=
0,n=f.count;h<n;h++)!0===a.isMesh?a.getVertexPosition(h,Xf):Xf.fromBufferAttribute(f,h),Xf.applyMatrix4(a.matrixWorld),this.expandByPoint(Xf);else void 0!==a.boundingBox?(null===a.boundingBox&&a.computeBoundingBox(),jm.copy(a.boundingBox)):(null===e.boundingBox&&e.computeBoundingBox(),jm.copy(e.boundingBox)),jm.applyMatrix4(a.matrixWorld),this.union(jm)}a=a.children;for(let f=0,h=a.length;f<h;f++)this.expandByObject(a[f],b);return this}containsPoint(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||
a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0}containsBox(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z}getParameter(a,b){return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:
!0}intersectsSphere(a){this.clampPoint(a.center,Xf);return Xf.distanceToSquared(a.center)<=a.radius*a.radius}intersectsPlane(a){let b,e;0<a.normal.x?(b=a.normal.x*this.min.x,e=a.normal.x*this.max.x):(b=a.normal.x*this.max.x,e=a.normal.x*this.min.x);0<a.normal.y?(b+=a.normal.y*this.min.y,e+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,e+=a.normal.y*this.min.y);0<a.normal.z?(b+=a.normal.z*this.min.z,e+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,e+=a.normal.z*this.min.z);return b<=-a.constant&&
e>=-a.constant}intersectsTriangle(a){if(this.isEmpty())return!1;this.getCenter(tk);km.subVectors(this.max,tk);Nj.subVectors(a.a,tk);Oj.subVectors(a.b,tk);Pj.subVectors(a.c,tk);Eg.subVectors(Oj,Nj);Fg.subVectors(Pj,Oj);ij.subVectors(Nj,Pj);a=[0,-Eg.z,Eg.y,0,-Fg.z,Fg.y,0,-ij.z,ij.y,Eg.z,0,-Eg.x,Fg.z,0,-Fg.x,ij.z,0,-ij.x,-Eg.y,Eg.x,0,-Fg.y,Fg.x,0,-ij.y,ij.x,0];if(!Ym(a,Nj,Oj,Pj,km))return!1;a=[1,0,0,0,1,0,0,0,1];if(!Ym(a,Nj,Oj,Pj,km))return!1;lm.crossVectors(Eg,Fg);a=[lm.x,lm.y,lm.z];return Ym(a,Nj,
Oj,Pj,km)}clampPoint(a,b){return b.copy(a).clamp(this.min,this.max)}distanceToPoint(a){return this.clampPoint(a,Xf).distanceTo(a)}getBoundingSphere(a){this.isEmpty()?a.makeEmpty():(this.getCenter(a.center),a.radius=.5*this.getSize(Xf).length());return a}intersect(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this}union(a){this.min.min(a.min);this.max.max(a.max);return this}applyMatrix4(a){if(this.isEmpty())return this;pg[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);
pg[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a);pg[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);pg[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a);pg[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);pg[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);pg[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);pg[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(pg);return this}translate(a){this.min.add(a);this.max.add(a);return this}equals(a){return a.min.equals(this.min)&&
a.max.equals(this.max)}}const pg=[new mb,new mb,new mb,new mb,new mb,new mb,new mb,new mb],Xf=new mb,jm=new qf,Nj=new mb,Oj=new mb,Pj=new mb,Eg=new mb,Fg=new mb,ij=new mb,tk=new mb,km=new mb,lm=new mb,Og=new mb,RA=new qf,uk=new mb,aq=new mb;class lf{constructor(a=new mb,b=-1){this.isSphere=!0;this.center=a;this.radius=b}set(a,b){this.center.copy(a);this.radius=b;return this}setFromPoints(a,b){const e=this.center;void 0!==b?e.copy(b):RA.setFromPoints(a).getCenter(e);b=0;for(let f=0,h=a.length;f<h;f++)b=
Math.max(b,e.distanceToSquared(a[f]));this.radius=Math.sqrt(b);return this}copy(a){this.center.copy(a.center);this.radius=a.radius;return this}isEmpty(){return 0>this.radius}makeEmpty(){this.center.set(0,0,0);this.radius=-1;return this}containsPoint(a){return a.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(a){return a.distanceTo(this.center)-this.radius}intersectsSphere(a){const b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b}intersectsBox(a){return a.intersectsSphere(this)}intersectsPlane(a){return Math.abs(a.distanceToPoint(this.center))<=
this.radius}clampPoint(a,b){const e=this.center.distanceToSquared(a);b.copy(a);e>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b}getBoundingBox(a){if(this.isEmpty())return a.makeEmpty(),a;a.set(this.center,this.center);a.expandByScalar(this.radius);return a}applyMatrix4(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this}translate(a){this.center.add(a);return this}expandByPoint(a){if(this.isEmpty())return this.center.copy(a),
this.radius=0,this;uk.subVectors(a,this.center);a=uk.lengthSq();if(a>this.radius*this.radius){a=Math.sqrt(a);const b=.5*(a-this.radius);this.center.addScaledVector(uk,b/a);this.radius+=b}return this}union(a){if(a.isEmpty())return this;if(this.isEmpty())return this.copy(a),this;!0===this.center.equals(a.center)?this.radius=Math.max(this.radius,a.radius):(aq.subVectors(a.center,this.center).setLength(a.radius),this.expandByPoint(uk.copy(a.center).add(aq)),this.expandByPoint(uk.copy(a.center).sub(aq)));
return this}equals(a){return a.center.equals(this.center)&&a.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const qg=new mb,bq=new mb,mm=new mb,Gg=new mb,cq=new mb,nm=new mb,dq=new mb;class dj{constructor(a=new mb,b=new mb(0,0,-1)){this.origin=a;this.direction=b}set(a,b){this.origin.copy(a);this.direction.copy(b);return this}copy(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this}at(a,b){return b.copy(this.origin).addScaledVector(this.direction,a)}lookAt(a){this.direction.copy(a).sub(this.origin).normalize();
return this}recast(a){this.origin.copy(this.at(a,qg));return this}closestPointToPoint(a,b){b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.origin).addScaledVector(this.direction,a)}distanceToPoint(a){return Math.sqrt(this.distanceSqToPoint(a))}distanceSqToPoint(a){const b=qg.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);qg.copy(this.origin).addScaledVector(this.direction,b);return qg.distanceToSquared(a)}distanceSqToSegment(a,
b,e,f){bq.copy(a).add(b).multiplyScalar(.5);mm.copy(b).sub(a).normalize();Gg.copy(this.origin).sub(bq);var h=.5*a.distanceTo(b),n=-this.direction.dot(mm);const r=Gg.dot(this.direction),t=-Gg.dot(mm),w=Gg.lengthSq(),x=Math.abs(1-n*n);let y;0<x?(a=n*t-r,b=n*r-t,y=h*x,0<=a?b>=-y?b<=y?(h=1/x,a*=h,b*=h,n=a*(a+n*b+2*r)+b*(n*a+b+2*t)+w):(b=h,a=Math.max(0,-(n*b+r)),n=-a*a+b*(b+2*t)+w):(b=-h,a=Math.max(0,-(n*b+r)),n=-a*a+b*(b+2*t)+w):b<=-y?(a=Math.max(0,-(-n*h+r)),b=0<a?-h:Math.min(Math.max(-h,-t),h),n=-a*
a+b*(b+2*t)+w):b<=y?(a=0,b=Math.min(Math.max(-h,-t),h),n=b*(b+2*t)+w):(a=Math.max(0,-(n*h+r)),b=0<a?h:Math.min(Math.max(-h,-t),h),n=-a*a+b*(b+2*t)+w)):(b=0<n?-h:h,a=Math.max(0,-(n*b+r)),n=-a*a+b*(b+2*t)+w);e&&e.copy(this.origin).addScaledVector(this.direction,a);f&&f.copy(bq).addScaledVector(mm,b);return n}intersectSphere(a,b){qg.subVectors(a.center,this.origin);var e=qg.dot(this.direction),f=qg.dot(qg)-e*e;a=a.radius*a.radius;if(f>a)return null;a=Math.sqrt(a-f);f=e-a;e+=a;return 0>e?null:0>f?this.at(e,
b):this.at(f,b)}intersectsSphere(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius}distanceToPlane(a){const b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null}intersectPlane(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)}intersectsPlane(a){const b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1}intersectBox(a,b){let e;var f=1/this.direction.x;
var h=1/this.direction.y;const n=1/this.direction.z,r=this.origin;0<=f?(e=(a.min.x-r.x)*f,f*=a.max.x-r.x):(e=(a.max.x-r.x)*f,f*=a.min.x-r.x);if(0<=h){var t=(a.min.y-r.y)*h;h*=a.max.y-r.y}else t=(a.max.y-r.y)*h,h*=a.min.y-r.y;if(e>h||t>f)return null;if(t>e||isNaN(e))e=t;if(h<f||isNaN(f))f=h;0<=n?(t=(a.min.z-r.z)*n,a=(a.max.z-r.z)*n):(t=(a.max.z-r.z)*n,a=(a.min.z-r.z)*n);if(e>a||t>f)return null;if(t>e||e!==e)e=t;if(a<f||f!==f)f=a;return 0>f?null:this.at(0<=e?e:f,b)}intersectsBox(a){return null!==this.intersectBox(a,
qg)}intersectTriangle(a,b,e,f,h){cq.subVectors(b,a);nm.subVectors(e,a);dq.crossVectors(cq,nm);b=this.direction.dot(dq);if(0<b){if(f)return null;f=1}else if(0>b)f=-1,b=-b;else return null;Gg.subVectors(this.origin,a);a=f*this.direction.dot(nm.crossVectors(Gg,nm));if(0>a)return null;e=f*this.direction.dot(cq.cross(Gg));if(0>e||a+e>b)return null;a=-f*Gg.dot(dq);return 0>a?null:this.at(a/b,h)}applyMatrix4(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}equals(a){return a.origin.equals(this.origin)&&
a.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class gd{constructor(a,b,e,f,h,n,r,t,w,x,y,z,ab,eb,cb,db){gd.prototype.isMatrix4=!0;this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];void 0!==a&&this.set(a,b,e,f,h,n,r,t,w,x,y,z,ab,eb,cb,db)}set(a,b,e,f,h,n,r,t,w,x,y,z,ab,eb,cb,db){const bb=this.elements;bb[0]=a;bb[4]=b;bb[8]=e;bb[12]=f;bb[1]=h;bb[5]=n;bb[9]=r;bb[13]=t;bb[2]=w;bb[6]=x;bb[10]=y;bb[14]=z;bb[3]=ab;bb[7]=eb;bb[11]=cb;bb[15]=db;return this}identity(){this.set(1,
0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this}clone(){return(new gd).fromArray(this.elements)}copy(a){const b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this}copyPosition(a){const b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this}setFromMatrix3(a){a=a.elements;this.set(a[0],a[3],a[6],0,a[1],a[4],a[7],0,a[2],a[5],
a[8],0,0,0,0,1);return this}extractBasis(a,b,e){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);e.setFromMatrixColumn(this,2);return this}makeBasis(a,b,e){this.set(a.x,b.x,e.x,0,a.y,b.y,e.y,0,a.z,b.z,e.z,0,0,0,0,1);return this}extractRotation(a){const b=this.elements,e=a.elements,f=1/Qj.setFromMatrixColumn(a,0).length(),h=1/Qj.setFromMatrixColumn(a,1).length();a=1/Qj.setFromMatrixColumn(a,2).length();b[0]=e[0]*f;b[1]=e[1]*f;b[2]=e[2]*f;b[3]=0;b[4]=e[4]*h;b[5]=e[5]*h;b[6]=e[6]*h;b[7]=0;
b[8]=e[8]*a;b[9]=e[9]*a;b[10]=e[10]*a;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this}makeRotationFromEuler(a){const b=this.elements;var e=a.x,f=a.y,h=a.z;const n=Math.cos(e);e=Math.sin(e);const r=Math.cos(f);f=Math.sin(f);const t=Math.cos(h);h=Math.sin(h);if("XYZ"===a.order){a=n*t;var w=n*h,x=e*t,y=e*h;b[0]=r*t;b[4]=-r*h;b[8]=f;b[1]=w+x*f;b[5]=a-y*f;b[9]=-e*r;b[2]=y-a*f;b[6]=x+w*f;b[10]=n*r}else"YXZ"===a.order?(a=r*t,w=r*h,x=f*t,y=f*h,b[0]=a+y*e,b[4]=x*e-w,b[8]=n*f,b[1]=n*h,b[5]=n*t,b[9]=-e,
b[2]=w*e-x,b[6]=y+a*e,b[10]=n*r):"ZXY"===a.order?(a=r*t,w=r*h,x=f*t,y=f*h,b[0]=a-y*e,b[4]=-n*h,b[8]=x+w*e,b[1]=w+x*e,b[5]=n*t,b[9]=y-a*e,b[2]=-n*f,b[6]=e,b[10]=n*r):"ZYX"===a.order?(a=n*t,w=n*h,x=e*t,y=e*h,b[0]=r*t,b[4]=x*f-w,b[8]=a*f+y,b[1]=r*h,b[5]=y*f+a,b[9]=w*f-x,b[2]=-f,b[6]=e*r,b[10]=n*r):"YZX"===a.order?(a=n*r,w=n*f,x=e*r,y=e*f,b[0]=r*t,b[4]=y-a*h,b[8]=x*h+w,b[1]=h,b[5]=n*t,b[9]=-e*t,b[2]=-f*t,b[6]=w*h+x,b[10]=a-y*h):"XZY"===a.order&&(a=n*r,w=n*f,x=e*r,y=e*f,b[0]=r*t,b[4]=-h,b[8]=f*t,b[1]=
a*h+y,b[5]=n*t,b[9]=w*h-x,b[2]=x*h-w,b[6]=e*t,b[10]=y*h+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this}makeRotationFromQuaternion(a){return this.compose(SA,a,TA)}lookAt(a,b,e){const f=this.elements;zf.subVectors(a,b);0===zf.lengthSq()&&(zf.z=1);zf.normalize();Hg.crossVectors(e,zf);0===Hg.lengthSq()&&(1===Math.abs(e.z)?zf.x+=1E-4:zf.z+=1E-4,zf.normalize(),Hg.crossVectors(e,zf));Hg.normalize();om.crossVectors(zf,Hg);f[0]=Hg.x;f[4]=om.x;f[8]=zf.x;f[1]=Hg.y;f[5]=om.y;f[9]=zf.y;f[2]=
Hg.z;f[6]=om.z;f[10]=zf.z;return this}multiply(a){return this.multiplyMatrices(this,a)}premultiply(a){return this.multiplyMatrices(a,this)}multiplyMatrices(a,b){var e=a.elements,f=b.elements;b=this.elements;a=e[0];const h=e[4],n=e[8],r=e[12],t=e[1],w=e[5],x=e[9],y=e[13],z=e[2],ab=e[6],eb=e[10],cb=e[14],db=e[3],bb=e[7],gb=e[11];e=e[15];const kb=f[0],qb=f[4],ob=f[8],pb=f[12],ub=f[1],rb=f[5],Ab=f[9],wb=f[13],Cb=f[2],Fb=f[6],Ob=f[10],Gb=f[14],Nb=f[3],Rb=f[7],Pb=f[11];f=f[15];b[0]=a*kb+h*ub+n*Cb+r*Nb;
b[4]=a*qb+h*rb+n*Fb+r*Rb;b[8]=a*ob+h*Ab+n*Ob+r*Pb;b[12]=a*pb+h*wb+n*Gb+r*f;b[1]=t*kb+w*ub+x*Cb+y*Nb;b[5]=t*qb+w*rb+x*Fb+y*Rb;b[9]=t*ob+w*Ab+x*Ob+y*Pb;b[13]=t*pb+w*wb+x*Gb+y*f;b[2]=z*kb+ab*ub+eb*Cb+cb*Nb;b[6]=z*qb+ab*rb+eb*Fb+cb*Rb;b[10]=z*ob+ab*Ab+eb*Ob+cb*Pb;b[14]=z*pb+ab*wb+eb*Gb+cb*f;b[3]=db*kb+bb*ub+gb*Cb+e*Nb;b[7]=db*qb+bb*rb+gb*Fb+e*Rb;b[11]=db*ob+bb*Ab+gb*Ob+e*Pb;b[15]=db*pb+bb*wb+gb*Gb+e*f;return this}multiplyScalar(a){const b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;
b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this}determinant(){const a=this.elements,b=a[0],e=a[4],f=a[8],h=a[12],n=a[1],r=a[5],t=a[9],w=a[13],x=a[2],y=a[6],z=a[10],ab=a[14];return a[3]*(+h*t*y-f*w*y-h*r*z+e*w*z+f*r*ab-e*t*ab)+a[7]*(+b*t*ab-b*w*z+h*n*z-f*n*ab+f*w*x-h*t*x)+a[11]*(+b*w*y-b*r*ab-h*n*y+e*n*ab+h*r*x-e*w*x)+a[15]*(-f*r*x-b*t*y+b*r*z+f*n*y-e*n*z+e*t*x)}transpose(){const a=this.elements;let b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;
b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this}setPosition(a,b,e){const f=this.elements;a.isVector3?(f[12]=a.x,f[13]=a.y,f[14]=a.z):(f[12]=a,f[13]=b,f[14]=e);return this}invert(){const a=this.elements,b=a[0],e=a[1],f=a[2],h=a[3],n=a[4],r=a[5],t=a[6],w=a[7],x=a[8],y=a[9],z=a[10],ab=a[11],eb=a[12],cb=a[13],db=a[14],bb=a[15],gb=y*db*w-cb*z*w+cb*t*ab-r*db*ab-y*t*bb+r*z*bb,kb=eb*z*w-x*db*w-eb*t*ab+n*db*ab+x*t*bb-n*z*bb,qb=x*cb*w-eb*y*
w+eb*r*ab-n*cb*ab-x*r*bb+n*y*bb,ob=eb*y*t-x*cb*t-eb*r*z+n*cb*z+x*r*db-n*y*db;var pb=b*gb+e*kb+f*qb+h*ob;if(0===pb)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);pb=1/pb;a[0]=gb*pb;a[1]=(cb*z*h-y*db*h-cb*f*ab+e*db*ab+y*f*bb-e*z*bb)*pb;a[2]=(r*db*h-cb*t*h+cb*f*w-e*db*w-r*f*bb+e*t*bb)*pb;a[3]=(y*t*h-r*z*h-y*f*w+e*z*w+r*f*ab-e*t*ab)*pb;a[4]=kb*pb;a[5]=(x*db*h-eb*z*h+eb*f*ab-b*db*ab-x*f*bb+b*z*bb)*pb;a[6]=(eb*t*h-n*db*h-eb*f*w+b*db*w+n*f*bb-b*t*bb)*pb;a[7]=(n*z*h-x*t*h+x*f*w-b*z*w-n*f*ab+b*t*ab)*pb;
a[8]=qb*pb;a[9]=(eb*y*h-x*cb*h-eb*e*ab+b*cb*ab+x*e*bb-b*y*bb)*pb;a[10]=(n*cb*h-eb*r*h+eb*e*w-b*cb*w-n*e*bb+b*r*bb)*pb;a[11]=(x*r*h-n*y*h-x*e*w+b*y*w+n*e*ab-b*r*ab)*pb;a[12]=ob*pb;a[13]=(x*cb*f-eb*y*f+eb*e*z-b*cb*z-x*e*db+b*y*db)*pb;a[14]=(eb*r*f-n*cb*f-eb*e*t+b*cb*t+n*e*db-b*r*db)*pb;a[15]=(n*y*f-x*r*f+x*e*t-b*y*t-n*e*z+b*r*z)*pb;return this}scale(a){const b=this.elements,e=a.x,f=a.y;a=a.z;b[0]*=e;b[4]*=f;b[8]*=a;b[1]*=e;b[5]*=f;b[9]*=a;b[2]*=e;b[6]*=f;b[10]*=a;b[3]*=e;b[7]*=f;b[11]*=a;return this}getMaxScaleOnAxis(){const a=
this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))}makeTranslation(a,b,e){a.isVector3?this.set(1,0,0,a.x,0,1,0,a.y,0,0,1,a.z,0,0,0,1):this.set(1,0,0,a,0,1,0,b,0,0,1,e,0,0,0,1);return this}makeRotationX(a){const b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this}makeRotationY(a){const b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this}makeRotationZ(a){const b=
Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this}makeRotationAxis(a,b){const e=Math.cos(b);b=Math.sin(b);const f=1-e,h=a.x,n=a.y;a=a.z;const r=f*h,t=f*n;this.set(r*h+e,r*n-b*a,r*a+b*n,0,r*n+b*a,t*n+e,t*a-b*h,0,r*a-b*n,t*a+b*h,f*a*a+e,0,0,0,0,1);return this}makeScale(a,b,e){this.set(a,0,0,0,0,b,0,0,0,0,e,0,0,0,0,1);return this}makeShear(a,b,e,f,h,n){this.set(1,e,h,0,a,1,n,0,b,f,1,0,0,0,0,1);return this}compose(a,b,e){const f=this.elements;var h=b._x,n=b._y,r=b._z,t=
b._w,w=h+h,x=n+n,y=r+r;b=h*w;const z=h*x;h*=y;const ab=n*x;n*=y;r*=y;w*=t;x*=t;t*=y;y=e.x;const eb=e.y;e=e.z;f[0]=(1-(ab+r))*y;f[1]=(z+t)*y;f[2]=(h-x)*y;f[3]=0;f[4]=(z-t)*eb;f[5]=(1-(b+r))*eb;f[6]=(n+w)*eb;f[7]=0;f[8]=(h+x)*e;f[9]=(n-w)*e;f[10]=(1-(b+ab))*e;f[11]=0;f[12]=a.x;f[13]=a.y;f[14]=a.z;f[15]=1;return this}decompose(a,b,e){var f=this.elements;let h=Qj.set(f[0],f[1],f[2]).length();const n=Qj.set(f[4],f[5],f[6]).length(),r=Qj.set(f[8],f[9],f[10]).length();0>this.determinant()&&(h=-h);a.x=f[12];
a.y=f[13];a.z=f[14];bf.copy(this);a=1/h;f=1/n;const t=1/r;bf.elements[0]*=a;bf.elements[1]*=a;bf.elements[2]*=a;bf.elements[4]*=f;bf.elements[5]*=f;bf.elements[6]*=f;bf.elements[8]*=t;bf.elements[9]*=t;bf.elements[10]*=t;b.setFromRotationMatrix(bf);e.x=h;e.y=n;e.z=r;return this}makePerspective(a,b,e,f,h,n,r=2E3){const t=this.elements;if(2E3===r)r=-(n+h)/(n-h),n=-2*n*h/(n-h);else if(2001===r)r=-n/(n-h),n=-n*h/(n-h);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+r);
t[0]=2*h/(b-a);t[4]=0;t[8]=(b+a)/(b-a);t[12]=0;t[1]=0;t[5]=2*h/(e-f);t[9]=(e+f)/(e-f);t[13]=0;t[2]=0;t[6]=0;t[10]=r;t[14]=n;t[3]=0;t[7]=0;t[11]=-1;t[15]=0;return this}makeOrthographic(a,b,e,f,h,n,r=2E3){const t=this.elements,w=1/(b-a),x=1/(e-f);var y=1/(n-h);if(2E3===r)h=(n+h)*y,y*=-2;else if(2001===r)h*=y,y*=-1;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+r);t[0]=2*w;t[4]=0;t[8]=0;t[12]=-((b+a)*w);t[1]=0;t[5]=2*x;t[9]=0;t[13]=-((e+f)*x);t[2]=0;t[6]=0;t[10]=y;t[14]=
-h;t[3]=0;t[7]=0;t[11]=0;t[15]=1;return this}equals(a){const b=this.elements;a=a.elements;for(let e=0;16>e;e++)if(b[e]!==a[e])return!1;return!0}fromArray(a,b=0){for(let e=0;16>e;e++)this.elements[e]=a[e+b];return this}toArray(a=[],b=0){const e=this.elements;a[b]=e[0];a[b+1]=e[1];a[b+2]=e[2];a[b+3]=e[3];a[b+4]=e[4];a[b+5]=e[5];a[b+6]=e[6];a[b+7]=e[7];a[b+8]=e[8];a[b+9]=e[9];a[b+10]=e[10];a[b+11]=e[11];a[b+12]=e[12];a[b+13]=e[13];a[b+14]=e[14];a[b+15]=e[15];return a}}const Qj=new mb,bf=new gd,SA=new mb(0,
0,0),TA=new mb(1,1,1),Hg=new mb,om=new mb,zf=new mb,Gw=new gd,Hw=new rf;class Ff{constructor(a=0,b=0,e=0,f=Ff.DEFAULT_ORDER){this.isEuler=!0;this._x=a;this._y=b;this._z=e;this._order=f}get x(){return this._x}set x(a){this._x=a;this._onChangeCallback()}get y(){return this._y}set y(a){this._y=a;this._onChangeCallback()}get z(){return this._z}set z(a){this._z=a;this._onChangeCallback()}get order(){return this._order}set order(a){this._order=a;this._onChangeCallback()}set(a,b,e,f=this._order){this._x=
a;this._y=b;this._z=e;this._order=f;this._onChangeCallback();return this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this}setFromRotationMatrix(a,b=this._order,e=!0){var f=a.elements;a=f[0];const h=f[4],n=f[8],r=f[1],t=f[5],w=f[9],x=f[2],y=f[6];f=f[10];switch(b){case "XYZ":this._y=Math.asin(jd(n,-1,1));.9999999>Math.abs(n)?(this._x=Math.atan2(-w,f),this._z=Math.atan2(-h,
a)):(this._x=Math.atan2(y,t),this._z=0);break;case "YXZ":this._x=Math.asin(-jd(w,-1,1));.9999999>Math.abs(w)?(this._y=Math.atan2(n,f),this._z=Math.atan2(r,t)):(this._y=Math.atan2(-x,a),this._z=0);break;case "ZXY":this._x=Math.asin(jd(y,-1,1));.9999999>Math.abs(y)?(this._y=Math.atan2(-x,f),this._z=Math.atan2(-h,t)):(this._y=0,this._z=Math.atan2(r,a));break;case "ZYX":this._y=Math.asin(-jd(x,-1,1));.9999999>Math.abs(x)?(this._x=Math.atan2(y,f),this._z=Math.atan2(r,a)):(this._x=0,this._z=Math.atan2(-h,
t));break;case "YZX":this._z=Math.asin(jd(r,-1,1));.9999999>Math.abs(r)?(this._x=Math.atan2(-w,t),this._y=Math.atan2(-x,a)):(this._x=0,this._y=Math.atan2(n,f));break;case "XZY":this._z=Math.asin(-jd(h,-1,1));.9999999>Math.abs(h)?(this._x=Math.atan2(y,t),this._y=Math.atan2(n,a)):(this._x=Math.atan2(-w,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+b)}this._order=b;!0===e&&this._onChangeCallback();return this}setFromQuaternion(a,b,e){Gw.makeRotationFromQuaternion(a);
return this.setFromRotationMatrix(Gw,b,e)}setFromVector3(a,b=this._order){return this.set(a.x,a.y,a.z,b)}reorder(a){Hw.setFromEuler(this);return this.setFromQuaternion(Hw,a)}equals(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order}fromArray(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this}toArray(a=[],b=0){a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a}_onChange(a){this._onChangeCallback=
a;return this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x;yield this._y;yield this._z;yield this._order}}Ff.DEFAULT_ORDER="XYZ";class Sk{constructor(){this.mask=1}set(a){this.mask=(1<<a|0)>>>0}enable(a){this.mask=this.mask|1<<a|0}enableAll(){this.mask=-1}toggle(a){this.mask^=1<<a|0}disable(a){this.mask&=~(1<<a|0)}disableAll(){this.mask=0}test(a){return 0!==(this.mask&a.mask)}isEnabled(a){return 0!==(this.mask&(1<<a|0))}}let UA=0;const Iw=new mb,Rj=new rf,rg=new gd,pm=new mb,vk=new mb,
VA=new mb,WA=new rf,Jw=new mb(1,0,0),Kw=new mb(0,1,0),Lw=new mb(0,0,1),Mw={type:"added"},XA={type:"removed"},Sj={type:"childadded",child:null},eq={type:"childremoved",child:null};class Cd extends ng{constructor(){super();this.isObject3D=!0;Object.defineProperty(this,"id",{value:UA++});this.uuid=fd();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=Cd.DEFAULT_UP.clone();const a=new mb,b=new Ff,e=new rf,f=new mb(1,1,1);b._onChange(function(){e.setFromEuler(b,!1)});e._onChange(function(){b.setFromQuaternion(e,
void 0,!1)});Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:a},rotation:{configurable:!0,enumerable:!0,value:b},quaternion:{configurable:!0,enumerable:!0,value:e},scale:{configurable:!0,enumerable:!0,value:f},modelViewMatrix:{value:new gd},normalMatrix:{value:new qd}});this.matrix=new gd;this.matrixWorld=new gd;this.matrixAutoUpdate=Cd.DEFAULT_MATRIX_AUTO_UPDATE;this.matrixWorldAutoUpdate=Cd.DEFAULT_MATRIX_WORLD_AUTO_UPDATE;this.matrixWorldNeedsUpdate=!1;this.layers=new Sk;
this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.animations=[];this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(a){this.matrixAutoUpdate&&this.updateMatrix();this.matrix.premultiply(a);this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(a){this.quaternion.premultiply(a);return this}setRotationFromAxisAngle(a,b){this.quaternion.setFromAxisAngle(a,b)}setRotationFromEuler(a){this.quaternion.setFromEuler(a,
!0)}setRotationFromMatrix(a){this.quaternion.setFromRotationMatrix(a)}setRotationFromQuaternion(a){this.quaternion.copy(a)}rotateOnAxis(a,b){Rj.setFromAxisAngle(a,b);this.quaternion.multiply(Rj);return this}rotateOnWorldAxis(a,b){Rj.setFromAxisAngle(a,b);this.quaternion.premultiply(Rj);return this}rotateX(a){return this.rotateOnAxis(Jw,a)}rotateY(a){return this.rotateOnAxis(Kw,a)}rotateZ(a){return this.rotateOnAxis(Lw,a)}translateOnAxis(a,b){Iw.copy(a).applyQuaternion(this.quaternion);this.position.add(Iw.multiplyScalar(b));
return this}translateX(a){return this.translateOnAxis(Jw,a)}translateY(a){return this.translateOnAxis(Kw,a)}translateZ(a){return this.translateOnAxis(Lw,a)}localToWorld(a){this.updateWorldMatrix(!0,!1);return a.applyMatrix4(this.matrixWorld)}worldToLocal(a){this.updateWorldMatrix(!0,!1);return a.applyMatrix4(rg.copy(this.matrixWorld).invert())}lookAt(a,b,e){a.isVector3?pm.copy(a):pm.set(a,b,e);a=this.parent;this.updateWorldMatrix(!0,!1);vk.setFromMatrixPosition(this.matrixWorld);this.isCamera||this.isLight?
rg.lookAt(vk,pm,this.up):rg.lookAt(pm,vk,this.up);this.quaternion.setFromRotationMatrix(rg);a&&(rg.extractRotation(a.matrixWorld),Rj.setFromRotationMatrix(rg),this.quaternion.premultiply(Rj.invert()))}add(a){if(1<arguments.length){for(let b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",a),this;a&&a.isObject3D?(a.removeFromParent(),a.parent=this,this.children.push(a),a.dispatchEvent(Mw),
Sj.child=a,this.dispatchEvent(Sj),Sj.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a);return this}remove(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);return this}b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1),a.dispatchEvent(XA),eq.child=a,this.dispatchEvent(eq),eq.child=null);return this}removeFromParent(){const a=this.parent;null!==a&&a.remove(this);return this}clear(){return this.remove(...this.children)}attach(a){this.updateWorldMatrix(!0,
!1);rg.copy(this.matrixWorld).invert();null!==a.parent&&(a.parent.updateWorldMatrix(!0,!1),rg.multiply(a.parent.matrixWorld));a.applyMatrix4(rg);a.removeFromParent();a.parent=this;this.children.push(a);a.updateWorldMatrix(!1,!0);a.dispatchEvent(Mw);Sj.child=a;this.dispatchEvent(Sj);Sj.child=null;return this}getObjectById(a){return this.getObjectByProperty("id",a)}getObjectByName(a){return this.getObjectByProperty("name",a)}getObjectByProperty(a,b){if(this[a]===b)return this;for(let e=0,f=this.children.length;e<
f;e++){const h=this.children[e].getObjectByProperty(a,b);if(void 0!==h)return h}}getObjectsByProperty(a,b,e=[]){this[a]===b&&e.push(this);const f=this.children;for(let h=0,n=f.length;h<n;h++)f[h].getObjectsByProperty(a,b,e);return e}getWorldPosition(a){this.updateWorldMatrix(!0,!1);return a.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(a){this.updateWorldMatrix(!0,!1);this.matrixWorld.decompose(vk,a,VA);return a}getWorldScale(a){this.updateWorldMatrix(!0,!1);this.matrixWorld.decompose(vk,
WA,a);return a}getWorldDirection(a){this.updateWorldMatrix(!0,!1);const b=this.matrixWorld.elements;return a.set(b[8],b[9],b[10]).normalize()}raycast(){}traverse(a){a(this);const b=this.children;for(let e=0,f=b.length;e<f;e++)b[e].traverse(a)}traverseVisible(a){if(!1!==this.visible){a(this);var b=this.children;for(let e=0,f=b.length;e<f;e++)b[e].traverseVisible(a)}}traverseAncestors(a){const b=this.parent;null!==b&&(a(b),b.traverseAncestors(a))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,
this.scale);this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;const b=this.children;for(let e=0,f=b.length;e<f;e++){const h=b[e];!0!==h.matrixWorldAutoUpdate&&!0!==a||h.updateMatrixWorld(a)}}updateWorldMatrix(a,b){const e=this.parent;!0===a&&null!==e&&!0===e.matrixWorldAutoUpdate&&
e.updateWorldMatrix(!0,!1);this.matrixAutoUpdate&&this.updateMatrix();null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(!0===b){a=this.children;for(let f=0,h=a.length;f<h;f++)b=a[f],!0===b.matrixWorldAutoUpdate&&b.updateWorldMatrix(!1,!0)}}toJSON(a){function b(t,w){void 0===t[w.uuid]&&(t[w.uuid]=w.toJSON(a));return w.uuid}function e(t){const w=[];for(const x in t){const y=t[x];delete y.metadata;w.push(y)}return w}var f=
void 0===a||"string"===typeof a;const h={};f&&(a={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},h.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};n.uuid=this.uuid;n.type=this.type;""!==this.name&&(n.name=this.name);!0===this.castShadow&&(n.castShadow=!0);!0===this.receiveShadow&&(n.receiveShadow=!0);!1===this.visible&&(n.visible=!1);!1===this.frustumCulled&&(n.frustumCulled=!1);0!==this.renderOrder&&(n.renderOrder=this.renderOrder);
0<Object.keys(this.userData).length&&(n.userData=this.userData);n.layers=this.layers.mask;n.matrix=this.matrix.toArray();n.up=this.up.toArray();!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1);this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON()));this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,
n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()})),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,
n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(a),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()}));if(this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(a).uuid)),this.environment&&
this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(a).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=b(a.geometries,this.geometry);var r=this.geometry.parameters;if(void 0!==r&&void 0!==r.shapes)if(r=r.shapes,Array.isArray(r))for(let t=0,w=r.length;t<w;t++)b(a.shapes,r[t]);else b(a.shapes,r)}this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(b(a.skeletons,this.skeleton),
n.skeleton=this.skeleton.uuid));if(void 0!==this.material)if(Array.isArray(this.material)){r=[];for(let t=0,w=this.material.length;t<w;t++)r.push(b(a.materials,this.material[t]));n.material=r}else n.material=b(a.materials,this.material);if(0<this.children.length)for(n.children=[],r=0;r<this.children.length;r++)n.children.push(this.children[r].toJSON(a).object);if(0<this.animations.length)for(n.animations=[],r=0;r<this.animations.length;r++)n.animations.push(b(a.animations,this.animations[r]));if(f){f=
e(a.geometries);r=e(a.materials);const t=e(a.textures),w=e(a.images),x=e(a.shapes),y=e(a.skeletons),z=e(a.animations),ab=e(a.nodes);0<f.length&&(h.geometries=f);0<r.length&&(h.materials=r);0<t.length&&(h.textures=t);0<w.length&&(h.images=w);0<x.length&&(h.shapes=x);0<y.length&&(h.skeletons=y);0<z.length&&(h.animations=z);0<ab.length&&(h.nodes=ab)}h.object=n;return h}clone(a){return(new this.constructor).copy(this,a)}copy(a,b=!0){this.name=a.name;this.up.copy(a.up);this.position.copy(a.position);this.rotation.order=
a.rotation.order;this.quaternion.copy(a.quaternion);this.scale.copy(a.scale);this.matrix.copy(a.matrix);this.matrixWorld.copy(a.matrixWorld);this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrixWorldAutoUpdate=a.matrixWorldAutoUpdate;this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;this.layers.mask=a.layers.mask;this.visible=a.visible;this.castShadow=a.castShadow;this.receiveShadow=a.receiveShadow;this.frustumCulled=a.frustumCulled;this.renderOrder=a.renderOrder;this.animations=a.animations.slice();
this.userData=JSON.parse(JSON.stringify(a.userData));if(!0===b)for(b=0;b<a.children.length;b++)this.add(a.children[b].clone());return this}}Cd.DEFAULT_UP=new mb(0,1,0);Cd.DEFAULT_MATRIX_AUTO_UPDATE=!0;Cd.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Yf=new mb,sg=new mb,fq=new mb,tg=new mb,Tj=new mb,Uj=new mb,Nw=new mb,gq=new mb,hq=new mb,iq=new mb;class Hf{constructor(a=new mb,b=new mb,e=new mb){this.a=a;this.b=b;this.c=e}static getNormal(a,b,e,f){f.subVectors(e,b);Yf.subVectors(a,b);f.cross(Yf);a=f.lengthSq();
return 0<a?f.multiplyScalar(1/Math.sqrt(a)):f.set(0,0,0)}static getBarycoord(a,b,e,f,h){Yf.subVectors(f,b);sg.subVectors(e,b);fq.subVectors(a,b);a=Yf.dot(Yf);b=Yf.dot(sg);e=Yf.dot(fq);var n=sg.dot(sg);f=sg.dot(fq);var r=a*n-b*b;if(0===r)return h.set(0,0,0),null;r=1/r;n=(n*e-b*f)*r;a=(a*f-b*e)*r;return h.set(1-n-a,a,n)}static containsPoint(a,b,e,f){return null===this.getBarycoord(a,b,e,f,tg)?!1:0<=tg.x&&0<=tg.y&&1>=tg.x+tg.y}static getInterpolation(a,b,e,f,h,n,r,t){if(null===this.getBarycoord(a,b,
e,f,tg))return t.x=0,t.y=0,"z"in t&&(t.z=0),"w"in t&&(t.w=0),null;t.setScalar(0);t.addScaledVector(h,tg.x);t.addScaledVector(n,tg.y);t.addScaledVector(r,tg.z);return t}static isFrontFacing(a,b,e,f){Yf.subVectors(e,b);sg.subVectors(a,b);return 0>Yf.cross(sg).dot(f)?!0:!1}set(a,b,e){this.a.copy(a);this.b.copy(b);this.c.copy(e);return this}setFromPointsAndIndices(a,b,e,f){this.a.copy(a[b]);this.b.copy(a[e]);this.c.copy(a[f]);return this}setFromAttributeAndIndices(a,b,e,f){this.a.fromBufferAttribute(a,
b);this.b.fromBufferAttribute(a,e);this.c.fromBufferAttribute(a,f);return this}clone(){return(new this.constructor).copy(this)}copy(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this}getArea(){Yf.subVectors(this.c,this.b);sg.subVectors(this.a,this.b);return.5*Yf.cross(sg).length()}getMidpoint(a){return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(a){return Hf.getNormal(this.a,this.b,this.c,a)}getPlane(a){return a.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(a,
b){return Hf.getBarycoord(a,this.a,this.b,this.c,b)}getInterpolation(a,b,e,f,h){return Hf.getInterpolation(a,this.a,this.b,this.c,b,e,f,h)}containsPoint(a){return Hf.containsPoint(a,this.a,this.b,this.c)}isFrontFacing(a){return Hf.isFrontFacing(this.a,this.b,this.c,a)}intersectsBox(a){return a.intersectsTriangle(this)}closestPointToPoint(a,b){const e=this.a;var f=this.b,h=this.c;Tj.subVectors(f,e);Uj.subVectors(h,e);gq.subVectors(a,e);var n=Tj.dot(gq),r=Uj.dot(gq);if(0>=n&&0>=r)return b.copy(e);hq.subVectors(a,
f);const t=Tj.dot(hq),w=Uj.dot(hq);if(0<=t&&w<=t)return b.copy(f);var x=n*w-t*r;if(0>=x&&0<=n&&0>=t)return f=n/(n-t),b.copy(e).addScaledVector(Tj,f);iq.subVectors(a,h);a=Tj.dot(iq);const y=Uj.dot(iq);if(0<=y&&a<=y)return b.copy(h);n=a*r-n*y;if(0>=n&&0<=r&&0>=y)return x=r/(r-y),b.copy(e).addScaledVector(Uj,x);r=t*y-a*w;if(0>=r&&0<=w-t&&0<=a-y)return Nw.subVectors(h,f),x=(w-t)/(w-t+(a-y)),b.copy(f).addScaledVector(Nw,x);h=1/(r+n+x);f=n*h;x*=h;return b.copy(e).addScaledVector(Tj,f).addScaledVector(Uj,
x)}equals(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}}const Ow={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},Ig={h:0,s:0,l:0},qm={h:0,s:0,l:0};class Tb{constructor(a,b,e){this.isColor=!0;this.b=this.g=this.r=1;return this.set(a,b,e)}set(a,b,e){void 0===b&&void 0===e?a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a):
this.setRGB(a,b,e);return this}setScalar(a){this.b=this.g=this.r=a;return this}setHex(a,b="srgb"){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;Fd.toWorkingColorSpace(this,b);return this}setRGB(a,b,e,f=Fd.workingColorSpace){this.r=a;this.g=b;this.b=e;Fd.toWorkingColorSpace(this,f);return this}setHSL(a,b,e,f=Fd.workingColorSpace){a=kf(a,1);b=jd(b,0,1);e=jd(e,0,1);0===b?this.r=this.g=this.b=e:(b=.5>=e?e*(1+b):e+b-e*b,e=2*e-b,this.r=Zm(e,b,a+1/3),this.g=Zm(e,b,a),this.b=
Zm(e,b,a-1/3));Fd.toWorkingColorSpace(this,f);return this}setStyle(a,b="srgb"){function e(n){void 0!==n&&1>parseFloat(n)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var f;if(f=/^(\w+)\(([^\)]*)\)/.exec(a)){var h=f[2];switch(f[1]){case "rgb":case "rgba":if(f=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return e(f[4]),this.setRGB(Math.min(255,parseInt(f[1],10))/255,Math.min(255,parseInt(f[2],10))/255,Math.min(255,parseInt(f[3],10))/255,b);if(f=/^\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return e(f[4]),
this.setRGB(Math.min(100,parseInt(f[1],10))/100,Math.min(100,parseInt(f[2],10))/100,Math.min(100,parseInt(f[3],10))/100,b);break;case "hsl":case "hsla":if(f=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return e(f[4]),this.setHSL(parseFloat(f[1])/360,parseFloat(f[2])/100,parseFloat(f[3])/100,b);break;default:console.warn("THREE.Color: Unknown color model "+a)}}else if(f=/^#([A-Fa-f\d]+)$/.exec(a)){h=f[1];f=h.length;if(3===f)return this.setRGB(parseInt(h.charAt(0),
16)/15,parseInt(h.charAt(1),16)/15,parseInt(h.charAt(2),16)/15,b);if(6===f)return this.setHex(parseInt(h,16),b);console.warn("THREE.Color: Invalid hex color "+a)}else if(a&&0<a.length)return this.setColorName(a,b);return this}setColorName(a,b="srgb"){const e=Ow[a.toLowerCase()];void 0!==e?this.setHex(e,b):console.warn("THREE.Color: Unknown color "+a);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(a){this.r=a.r;this.g=a.g;this.b=a.b;return this}copySRGBToLinear(a){this.r=
xj(a.r);this.g=xj(a.g);this.b=xj(a.b);return this}copyLinearToSRGB(a){this.r=Wm(a.r);this.g=Wm(a.g);this.b=Wm(a.b);return this}convertSRGBToLinear(){this.copySRGBToLinear(this);return this}convertLinearToSRGB(){this.copyLinearToSRGB(this);return this}getHex(a="srgb"){Fd.fromWorkingColorSpace(sf.copy(this),a);return 65536*Math.round(jd(255*sf.r,0,255))+256*Math.round(jd(255*sf.g,0,255))+Math.round(jd(255*sf.b,0,255))}getHexString(a="srgb"){return("000000"+this.getHex(a).toString(16)).slice(-6)}getHSL(a,
b=Fd.workingColorSpace){Fd.fromWorkingColorSpace(sf.copy(this),b);b=sf.r;const e=sf.g,f=sf.b,h=Math.max(b,e,f);var n=Math.min(b,e,f);let r;const t=(n+h)/2;if(n===h)n=r=0;else{const w=h-n;n=.5>=t?w/(h+n):w/(2-h-n);switch(h){case b:r=(e-f)/w+(e<f?6:0);break;case e:r=(f-b)/w+2;break;case f:r=(b-e)/w+4}r/=6}a.h=r;a.s=n;a.l=t;return a}getRGB(a,b=Fd.workingColorSpace){Fd.fromWorkingColorSpace(sf.copy(this),b);a.r=sf.r;a.g=sf.g;a.b=sf.b;return a}getStyle(a="srgb"){Fd.fromWorkingColorSpace(sf.copy(this),
a);const b=sf.r,e=sf.g,f=sf.b;return"srgb"!==a?`color(${a} ${b.toFixed(3)} ${e.toFixed(3)} ${f.toFixed(3)})`:`rgb(${Math.round(255*b)},${Math.round(255*e)},${Math.round(255*f)})`}offsetHSL(a,b,e){this.getHSL(Ig);return this.setHSL(Ig.h+a,Ig.s+b,Ig.l+e)}add(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this}addColors(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this}addScalar(a){this.r+=a;this.g+=a;this.b+=a;return this}sub(a){this.r=Math.max(0,this.r-a.r);this.g=Math.max(0,this.g-a.g);
this.b=Math.max(0,this.b-a.b);return this}multiply(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this}multiplyScalar(a){this.r*=a;this.g*=a;this.b*=a;return this}lerp(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this}lerpColors(a,b,e){this.r=a.r+(b.r-a.r)*e;this.g=a.g+(b.g-a.g)*e;this.b=a.b+(b.b-a.b)*e;return this}lerpHSL(a,b){this.getHSL(Ig);a.getHSL(qm);a=hg(Ig.h,qm.h,b);const e=hg(Ig.s,qm.s,b);b=hg(Ig.l,qm.l,b);this.setHSL(a,e,b);return this}setFromVector3(a){this.r=
a.x;this.g=a.y;this.b=a.z;return this}applyMatrix3(a){const b=this.r,e=this.g,f=this.b;a=a.elements;this.r=a[0]*b+a[3]*e+a[6]*f;this.g=a[1]*b+a[4]*e+a[7]*f;this.b=a[2]*b+a[5]*e+a[8]*f;return this}equals(a){return a.r===this.r&&a.g===this.g&&a.b===this.b}fromArray(a,b=0){this.r=a[b];this.g=a[b+1];this.b=a[b+2];return this}toArray(a=[],b=0){a[b]=this.r;a[b+1]=this.g;a[b+2]=this.b;return a}fromBufferAttribute(a,b){this.r=a.getX(b);this.g=a.getY(b);this.b=a.getZ(b);return this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r;
yield this.g;yield this.b}}const sf=new Tb;Tb.NAMES=Ow;let YA=0;class Zd extends ng{constructor(){super();this.isMaterial=!0;Object.defineProperty(this,"id",{value:YA++});this.uuid=fd();this.name="";this.type="Material";this.blending=1;this.side=0;this.vertexColors=!1;this.opacity=1;this.alphaHash=this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.blendColor=new Tb(0,0,0);this.blendAlpha=0;this.depthFunc=
3;this.depthWrite=this.depthTest=!0;this.stencilWriteMask=255;this.stencilFunc=519;this.stencilRef=0;this.stencilFuncMask=255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.forceSinglePass=this.premultipliedAlpha=this.alphaToCoverage=this.dithering=!1;this.toneMapped=
this.visible=!0;this.userData={};this._alphaTest=this.version=0}get alphaTest(){return this._alphaTest}set alphaTest(a){0<this._alphaTest!==0<a&&this.version++;this._alphaTest=a}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(a){if(void 0!==a)for(const b in a){const e=a[b];if(void 0===e){console.warn(`THREE.Material: parameter '${b}' has value of undefined.`);continue}const f=this[b];void 0===f?console.warn(`THREE.Material: '${b}' is not a property of THREE.${this.type}.`):
f&&f.isColor?f.set(e):f&&f.isVector3&&e&&e.isVector3?f.copy(e):this[b]=e}}toJSON(a){function b(h){const n=[];for(const r in h){const t=h[r];delete t.metadata;n.push(t)}return n}var e=void 0===a||"string"===typeof a;e&&(a={textures:{},images:{}});const f={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};f.uuid=this.uuid;f.type=this.type;""!==this.name&&(f.name=this.name);this.color&&this.color.isColor&&(f.color=this.color.getHex());void 0!==this.roughness&&(f.roughness=this.roughness);
void 0!==this.metalness&&(f.metalness=this.metalness);void 0!==this.sheen&&(f.sheen=this.sheen);this.sheenColor&&this.sheenColor.isColor&&(f.sheenColor=this.sheenColor.getHex());void 0!==this.sheenRoughness&&(f.sheenRoughness=this.sheenRoughness);this.emissive&&this.emissive.isColor&&(f.emissive=this.emissive.getHex());void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(f.emissiveIntensity=this.emissiveIntensity);this.specular&&this.specular.isColor&&(f.specular=this.specular.getHex());
void 0!==this.specularIntensity&&(f.specularIntensity=this.specularIntensity);this.specularColor&&this.specularColor.isColor&&(f.specularColor=this.specularColor.getHex());void 0!==this.shininess&&(f.shininess=this.shininess);void 0!==this.clearcoat&&(f.clearcoat=this.clearcoat);void 0!==this.clearcoatRoughness&&(f.clearcoatRoughness=this.clearcoatRoughness);this.clearcoatMap&&this.clearcoatMap.isTexture&&(f.clearcoatMap=this.clearcoatMap.toJSON(a).uuid);this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&
(f.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(a).uuid);this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(f.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(a).uuid,f.clearcoatNormalScale=this.clearcoatNormalScale.toArray());void 0!==this.iridescence&&(f.iridescence=this.iridescence);void 0!==this.iridescenceIOR&&(f.iridescenceIOR=this.iridescenceIOR);void 0!==this.iridescenceThicknessRange&&(f.iridescenceThicknessRange=this.iridescenceThicknessRange);this.iridescenceMap&&
this.iridescenceMap.isTexture&&(f.iridescenceMap=this.iridescenceMap.toJSON(a).uuid);this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(f.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(a).uuid);void 0!==this.anisotropy&&(f.anisotropy=this.anisotropy);void 0!==this.anisotropyRotation&&(f.anisotropyRotation=this.anisotropyRotation);this.anisotropyMap&&this.anisotropyMap.isTexture&&(f.anisotropyMap=this.anisotropyMap.toJSON(a).uuid);this.map&&this.map.isTexture&&(f.map=
this.map.toJSON(a).uuid);this.matcap&&this.matcap.isTexture&&(f.matcap=this.matcap.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&&(f.alphaMap=this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(f.lightMap=this.lightMap.toJSON(a).uuid,f.lightMapIntensity=this.lightMapIntensity);this.aoMap&&this.aoMap.isTexture&&(f.aoMap=this.aoMap.toJSON(a).uuid,f.aoMapIntensity=this.aoMapIntensity);this.bumpMap&&this.bumpMap.isTexture&&(f.bumpMap=this.bumpMap.toJSON(a).uuid,f.bumpScale=
this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(f.normalMap=this.normalMap.toJSON(a).uuid,f.normalMapType=this.normalMapType,f.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(f.displacementMap=this.displacementMap.toJSON(a).uuid,f.displacementScale=this.displacementScale,f.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(f.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&
(f.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(f.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(f.specularMap=this.specularMap.toJSON(a).uuid);this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(f.specularIntensityMap=this.specularIntensityMap.toJSON(a).uuid);this.specularColorMap&&this.specularColorMap.isTexture&&(f.specularColorMap=this.specularColorMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&
(f.envMap=this.envMap.toJSON(a).uuid,void 0!==this.combine&&(f.combine=this.combine));void 0!==this.envMapRotation&&(f.envMapRotation=this.envMapRotation.toArray());void 0!==this.envMapIntensity&&(f.envMapIntensity=this.envMapIntensity);void 0!==this.reflectivity&&(f.reflectivity=this.reflectivity);void 0!==this.refractionRatio&&(f.refractionRatio=this.refractionRatio);this.gradientMap&&this.gradientMap.isTexture&&(f.gradientMap=this.gradientMap.toJSON(a).uuid);void 0!==this.transmission&&(f.transmission=
this.transmission);this.transmissionMap&&this.transmissionMap.isTexture&&(f.transmissionMap=this.transmissionMap.toJSON(a).uuid);void 0!==this.thickness&&(f.thickness=this.thickness);this.thicknessMap&&this.thicknessMap.isTexture&&(f.thicknessMap=this.thicknessMap.toJSON(a).uuid);void 0!==this.attenuationDistance&&Infinity!==this.attenuationDistance&&(f.attenuationDistance=this.attenuationDistance);void 0!==this.attenuationColor&&(f.attenuationColor=this.attenuationColor.getHex());void 0!==this.size&&
(f.size=this.size);null!==this.shadowSide&&(f.shadowSide=this.shadowSide);void 0!==this.sizeAttenuation&&(f.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(f.blending=this.blending);0!==this.side&&(f.side=this.side);!0===this.vertexColors&&(f.vertexColors=!0);1>this.opacity&&(f.opacity=this.opacity);!0===this.transparent&&(f.transparent=!0);204!==this.blendSrc&&(f.blendSrc=this.blendSrc);205!==this.blendDst&&(f.blendDst=this.blendDst);100!==this.blendEquation&&(f.blendEquation=this.blendEquation);
null!==this.blendSrcAlpha&&(f.blendSrcAlpha=this.blendSrcAlpha);null!==this.blendDstAlpha&&(f.blendDstAlpha=this.blendDstAlpha);null!==this.blendEquationAlpha&&(f.blendEquationAlpha=this.blendEquationAlpha);this.blendColor&&this.blendColor.isColor&&(f.blendColor=this.blendColor.getHex());0!==this.blendAlpha&&(f.blendAlpha=this.blendAlpha);3!==this.depthFunc&&(f.depthFunc=this.depthFunc);!1===this.depthTest&&(f.depthTest=this.depthTest);!1===this.depthWrite&&(f.depthWrite=this.depthWrite);!1===this.colorWrite&&
(f.colorWrite=this.colorWrite);255!==this.stencilWriteMask&&(f.stencilWriteMask=this.stencilWriteMask);519!==this.stencilFunc&&(f.stencilFunc=this.stencilFunc);0!==this.stencilRef&&(f.stencilRef=this.stencilRef);255!==this.stencilFuncMask&&(f.stencilFuncMask=this.stencilFuncMask);7680!==this.stencilFail&&(f.stencilFail=this.stencilFail);7680!==this.stencilZFail&&(f.stencilZFail=this.stencilZFail);7680!==this.stencilZPass&&(f.stencilZPass=this.stencilZPass);!0===this.stencilWrite&&(f.stencilWrite=
this.stencilWrite);void 0!==this.rotation&&0!==this.rotation&&(f.rotation=this.rotation);!0===this.polygonOffset&&(f.polygonOffset=!0);0!==this.polygonOffsetFactor&&(f.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(f.polygonOffsetUnits=this.polygonOffsetUnits);void 0!==this.linewidth&&1!==this.linewidth&&(f.linewidth=this.linewidth);void 0!==this.dashSize&&(f.dashSize=this.dashSize);void 0!==this.gapSize&&(f.gapSize=this.gapSize);void 0!==this.scale&&(f.scale=this.scale);
!0===this.dithering&&(f.dithering=!0);0<this.alphaTest&&(f.alphaTest=this.alphaTest);!0===this.alphaHash&&(f.alphaHash=!0);!0===this.alphaToCoverage&&(f.alphaToCoverage=!0);!0===this.premultipliedAlpha&&(f.premultipliedAlpha=!0);!0===this.forceSinglePass&&(f.forceSinglePass=!0);!0===this.wireframe&&(f.wireframe=!0);1<this.wireframeLinewidth&&(f.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(f.wireframeLinecap=this.wireframeLinecap);"round"!==this.wireframeLinejoin&&
(f.wireframeLinejoin=this.wireframeLinejoin);!0===this.flatShading&&(f.flatShading=!0);!1===this.visible&&(f.visible=!1);!1===this.toneMapped&&(f.toneMapped=!1);!1===this.fog&&(f.fog=!1);0<Object.keys(this.userData).length&&(f.userData=this.userData);e&&(e=b(a.textures),a=b(a.images),0<e.length&&(f.textures=e),0<a.length&&(f.images=a));return f}clone(){return(new this.constructor).copy(this)}copy(a){this.name=a.name;this.blending=a.blending;this.side=a.side;this.vertexColors=a.vertexColors;this.opacity=
a.opacity;this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation=a.blendEquation;this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.blendColor.copy(a.blendColor);this.blendAlpha=a.blendAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.stencilWriteMask=a.stencilWriteMask;this.stencilFunc=a.stencilFunc;this.stencilRef=a.stencilRef;this.stencilFuncMask=
a.stencilFuncMask;this.stencilFail=a.stencilFail;this.stencilZFail=a.stencilZFail;this.stencilZPass=a.stencilZPass;this.stencilWrite=a.stencilWrite;const b=a.clippingPlanes;let e=null;if(null!==b){const f=b.length;e=Array(f);for(let h=0;h!==f;++h)e[h]=b[h].clone()}this.clippingPlanes=e;this.clipIntersection=a.clipIntersection;this.clipShadows=a.clipShadows;this.shadowSide=a.shadowSide;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset=a.polygonOffset;this.polygonOffsetFactor=
a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.dithering=a.dithering;this.alphaTest=a.alphaTest;this.alphaHash=a.alphaHash;this.alphaToCoverage=a.alphaToCoverage;this.premultipliedAlpha=a.premultipliedAlpha;this.forceSinglePass=a.forceSinglePass;this.visible=a.visible;this.toneMapped=a.toneMapped;this.userData=JSON.parse(JSON.stringify(a.userData));return this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(a){!0===a&&this.version++}}class Qd extends Zd{constructor(a){super();
this.isMeshBasicMaterial=!0;this.type="MeshBasicMaterial";this.color=new Tb(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.envMapRotation=new Ff;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;
this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapRotation.copy(a.envMapRotation);this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.fog=
a.fog;return this}}const jg=function(){var a=new ArrayBuffer(4);const b=new Float32Array(a);a=new Uint32Array(a);const e=new Uint32Array(512),f=new Uint32Array(512);for(var h=0;256>h;++h){var n=h-127;-27>n?(e[h]=0,e[h|256]=32768,f[h]=24,f[h|256]=24):-14>n?(e[h]=1024>>-n-14,e[h|256]=1024>>-n-14|32768,f[h]=-n-1,f[h|256]=-n-1):15>=n?(e[h]=n+15<<10,e[h|256]=n+15<<10|32768,f[h]=13,f[h|256]=13):128>n?(e[h]=31744,e[h|256]=64512,f[h]=24,f[h|256]=24):(e[h]=31744,e[h|256]=64512,f[h]=13,f[h|256]=13)}h=new Uint32Array(2048);
n=new Uint32Array(64);const r=new Uint32Array(64);for(var t=1;1024>t;++t){let w=t<<13,x=0;for(;0===(w&8388608);)w<<=1,x-=8388608;w&=-8388609;x+=947912704;h[t]=w|x}for(t=1024;2048>t;++t)h[t]=939524096+(t-1024<<13);for(t=1;31>t;++t)n[t]=t<<23;n[31]=1199570944;n[32]=2147483648;for(t=33;63>t;++t)n[t]=2147483648+(t-32<<23);n[63]=3347054592;for(t=1;64>t;++t)32!==t&&(r[t]=1024);return{floatView:b,uint32View:a,baseTable:e,shiftTable:f,mantissaTable:h,exponentTable:n,offsetTable:r}}(),kA={toHalfFloat:Bf,fromHalfFloat:fk},
cf=new mb,rm=new Lb;class Hd{constructor(a,b,e=!1){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0;this.name="";this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=e;this.usage=35044;this._updateRange={offset:0,count:-1};this.updateRanges=[];this.gpuType=1015;this.version=0}onUploadCallback(){}set needsUpdate(a){!0===a&&this.version++}setUsage(a){this.usage=a;return this}addUpdateRange(a,b){this.updateRanges.push({start:a,
count:b})}clearUpdateRanges(){this.updateRanges.length=0}copy(a){this.name=a.name;this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.usage=a.usage;this.gpuType=a.gpuType;return this}copyAt(a,b,e){a*=this.itemSize;e*=b.itemSize;for(let f=0,h=this.itemSize;f<h;f++)this.array[a+f]=b.array[e+f];return this}copyArray(a){this.array.set(a);return this}applyMatrix3(a){if(2===this.itemSize)for(let b=0,e=this.count;b<e;b++)rm.fromBufferAttribute(this,
b),rm.applyMatrix3(a),this.setXY(b,rm.x,rm.y);else if(3===this.itemSize)for(let b=0,e=this.count;b<e;b++)cf.fromBufferAttribute(this,b),cf.applyMatrix3(a),this.setXYZ(b,cf.x,cf.y,cf.z);return this}applyMatrix4(a){for(let b=0,e=this.count;b<e;b++)cf.fromBufferAttribute(this,b),cf.applyMatrix4(a),this.setXYZ(b,cf.x,cf.y,cf.z);return this}applyNormalMatrix(a){for(let b=0,e=this.count;b<e;b++)cf.fromBufferAttribute(this,b),cf.applyNormalMatrix(a),this.setXYZ(b,cf.x,cf.y,cf.z);return this}transformDirection(a){for(let b=
0,e=this.count;b<e;b++)cf.fromBufferAttribute(this,b),cf.transformDirection(a),this.setXYZ(b,cf.x,cf.y,cf.z);return this}set(a,b=0){this.array.set(a,b);return this}getComponent(a,b){a=this.array[a*this.itemSize+b];this.normalized&&(a=wf(a,this.array));return a}setComponent(a,b,e){this.normalized&&(e=kd(e,this.array));this.array[a*this.itemSize+b]=e;return this}getX(a){a=this.array[a*this.itemSize];this.normalized&&(a=wf(a,this.array));return a}setX(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*
this.itemSize]=b;return this}getY(a){a=this.array[a*this.itemSize+1];this.normalized&&(a=wf(a,this.array));return a}setY(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*this.itemSize+1]=b;return this}getZ(a){a=this.array[a*this.itemSize+2];this.normalized&&(a=wf(a,this.array));return a}setZ(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*this.itemSize+2]=b;return this}getW(a){a=this.array[a*this.itemSize+3];this.normalized&&(a=wf(a,this.array));return a}setW(a,b){this.normalized&&
(b=kd(b,this.array));this.array[a*this.itemSize+3]=b;return this}setXY(a,b,e){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array));this.array[a+0]=b;this.array[a+1]=e;return this}setXYZ(a,b,e,f){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array));this.array[a+0]=b;this.array[a+1]=e;this.array[a+2]=f;return this}setXYZW(a,b,e,f,h){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array),h=kd(h,this.array));
this.array[a+0]=b;this.array[a+1]=e;this.array[a+2]=f;this.array[a+3]=h;return this}onUpload(a){this.onUploadCallback=a;return this}clone(){return(new this.constructor(this.array,this.itemSize)).copy(this)}toJSON(){const a={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};""!==this.name&&(a.name=this.name);35044!==this.usage&&(a.usage=this.usage);return a}}class uA extends Hd{constructor(a,b,e){super(new Int8Array(a),b,e)}}class IA extends Hd{constructor(a,
b,e){super(new Uint8Array(a),b,e)}}class JA extends Hd{constructor(a,b,e){super(new Uint8ClampedArray(a),b,e)}}class sA extends Hd{constructor(a,b,e){super(new Int16Array(a),b,e)}}class cp extends Hd{constructor(a,b,e){super(new Uint16Array(a),b,e)}}class tA extends Hd{constructor(a,b,e){super(new Int32Array(a),b,e)}}class bp extends Hd{constructor(a,b,e){super(new Uint32Array(a),b,e)}}class mA extends Hd{constructor(a,b,e){super(new Uint16Array(a),b,e);this.isFloat16BufferAttribute=!0}getX(a){a=
fk(this.array[a*this.itemSize]);this.normalized&&(a=wf(a,this.array));return a}setX(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*this.itemSize]=Bf(b);return this}getY(a){a=fk(this.array[a*this.itemSize+1]);this.normalized&&(a=wf(a,this.array));return a}setY(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*this.itemSize+1]=Bf(b);return this}getZ(a){a=fk(this.array[a*this.itemSize+2]);this.normalized&&(a=wf(a,this.array));return a}setZ(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*
this.itemSize+2]=Bf(b);return this}getW(a){a=fk(this.array[a*this.itemSize+3]);this.normalized&&(a=wf(a,this.array));return a}setW(a,b){this.normalized&&(b=kd(b,this.array));this.array[a*this.itemSize+3]=Bf(b);return this}setXY(a,b,e){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array));this.array[a+0]=Bf(b);this.array[a+1]=Bf(e);return this}setXYZ(a,b,e,f){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array));this.array[a+0]=Bf(b);this.array[a+
1]=Bf(e);this.array[a+2]=Bf(f);return this}setXYZW(a,b,e,f,h){a*=this.itemSize;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array),h=kd(h,this.array));this.array[a+0]=Bf(b);this.array[a+1]=Bf(e);this.array[a+2]=Bf(f);this.array[a+3]=Bf(h);return this}}class $b extends Hd{constructor(a,b,e){super(new Float32Array(a),b,e)}}let ZA=0;const Lf=new gd,jq=new Cd,Vj=new mb,Gf=new qf,wk=new qf,jf=new mb;class md extends ng{constructor(){super();this.isBufferGeometry=!0;Object.defineProperty(this,
"id",{value:ZA++});this.uuid=fd();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.morphTargetsRelative=!1;this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}getIndex(){return this.index}setIndex(a){this.index=Array.isArray(a)?new (Nq(a)?bp:cp)(a,1):a;return this}getAttribute(a){return this.attributes[a]}setAttribute(a,b){this.attributes[a]=b;return this}deleteAttribute(a){delete this.attributes[a];
return this}hasAttribute(a){return void 0!==this.attributes[a]}addGroup(a,b,e=0){this.groups.push({start:a,count:b,materialIndex:e})}clearGroups(){this.groups=[]}setDrawRange(a,b){this.drawRange.start=a;this.drawRange.count=b}applyMatrix4(a){var b=this.attributes.position;void 0!==b&&(b.applyMatrix4(a),b.needsUpdate=!0);b=this.attributes.normal;if(void 0!==b){const e=(new qd).getNormalMatrix(a);b.applyNormalMatrix(e);b.needsUpdate=!0}b=this.attributes.tangent;void 0!==b&&(b.transformDirection(a),
b.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this}applyQuaternion(a){Lf.makeRotationFromQuaternion(a);this.applyMatrix4(Lf);return this}rotateX(a){Lf.makeRotationX(a);this.applyMatrix4(Lf);return this}rotateY(a){Lf.makeRotationY(a);this.applyMatrix4(Lf);return this}rotateZ(a){Lf.makeRotationZ(a);this.applyMatrix4(Lf);return this}translate(a,b,e){Lf.makeTranslation(a,b,e);this.applyMatrix4(Lf);return this}scale(a,
b,e){Lf.makeScale(a,b,e);this.applyMatrix4(Lf);return this}lookAt(a){jq.lookAt(a);jq.updateMatrix();this.applyMatrix4(jq.matrix);return this}center(){this.computeBoundingBox();this.boundingBox.getCenter(Vj).negate();this.translate(Vj.x,Vj.y,Vj.z);return this}setFromPoints(a){const b=[];for(let e=0,f=a.length;e<f;e++){const h=a[e];b.push(h.x,h.y,h.z||0)}this.setAttribute("position",new $b(b,3));return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new qf);const a=this.attributes.position,
b=this.morphAttributes.position;if(a&&a.isGLBufferAttribute)console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new mb(-Infinity,-Infinity,-Infinity),new mb(Infinity,Infinity,Infinity));else{if(void 0!==a){if(this.boundingBox.setFromBufferAttribute(a),b)for(let e=0,f=b.length;e<f;e++)Gf.setFromBufferAttribute(b[e]),this.morphTargetsRelative?(jf.addVectors(this.boundingBox.min,Gf.min),this.boundingBox.expandByPoint(jf),
jf.addVectors(this.boundingBox.max,Gf.max),this.boundingBox.expandByPoint(jf)):(this.boundingBox.expandByPoint(Gf.min),this.boundingBox.expandByPoint(Gf.max))}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=
new lf);const a=this.attributes.position,b=this.morphAttributes.position;if(a&&a.isGLBufferAttribute)console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new mb,Infinity);else if(a){const e=this.boundingSphere.center;Gf.setFromBufferAttribute(a);if(b)for(let h=0,n=b.length;h<n;h++)wk.setFromBufferAttribute(b[h]),this.morphTargetsRelative?(jf.addVectors(Gf.min,wk.min),Gf.expandByPoint(jf),jf.addVectors(Gf.max,
wk.max),Gf.expandByPoint(jf)):(Gf.expandByPoint(wk.min),Gf.expandByPoint(wk.max));Gf.getCenter(e);let f=0;for(let h=0,n=a.count;h<n;h++)jf.fromBufferAttribute(a,h),f=Math.max(f,e.distanceToSquared(jf));if(b)for(let h=0,n=b.length;h<n;h++){const r=b[h],t=this.morphTargetsRelative;for(let w=0,x=r.count;w<x;w++)jf.fromBufferAttribute(r,w),t&&(Vj.fromBufferAttribute(a,w),jf.add(Vj)),f=Math.max(f,e.distanceToSquared(jf))}this.boundingSphere.radius=Math.sqrt(f);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',
this)}}computeTangents(){function a(Ab,wb,Cb){y.fromBufferAttribute(h,Ab);z.fromBufferAttribute(h,wb);ab.fromBufferAttribute(h,Cb);eb.fromBufferAttribute(r,Ab);cb.fromBufferAttribute(r,wb);db.fromBufferAttribute(r,Cb);z.sub(y);ab.sub(y);cb.sub(eb);db.sub(eb);const Fb=1/(cb.x*db.y-db.x*cb.y);isFinite(Fb)&&(bb.copy(z).multiplyScalar(db.y).addScaledVector(ab,-cb.y).multiplyScalar(Fb),gb.copy(ab).multiplyScalar(cb.x).addScaledVector(z,-db.x).multiplyScalar(Fb),w[Ab].add(bb),w[wb].add(bb),w[Cb].add(bb),
x[Ab].add(gb),x[wb].add(gb),x[Cb].add(gb))}function b(Ab){ub.fromBufferAttribute(n,Ab);rb.copy(ub);var wb=w[Ab];ob.copy(wb);ob.sub(ub.multiplyScalar(ub.dot(wb))).normalize();pb.crossVectors(rb,wb);wb=0>pb.dot(x[Ab])?-1:1;t.setXYZW(Ab,ob.x,ob.y,ob.z,wb)}const e=this.index;var f=this.attributes;if(null===e||void 0===f.position||void 0===f.normal||void 0===f.uv)console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");else{var h=f.position,
n=f.normal,r=f.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Hd(new Float32Array(4*h.count),4));var t=this.getAttribute("tangent"),w=[],x=[];for(f=0;f<h.count;f++)w[f]=new mb,x[f]=new mb;var y=new mb,z=new mb,ab=new mb,eb=new Lb,cb=new Lb,db=new Lb,bb=new mb,gb=new mb;f=this.groups;0===f.length&&(f=[{start:0,count:e.count}]);for(let Ab=0,wb=f.length;Ab<wb;++Ab){var kb=f[Ab],qb=kb.start;kb=kb.count;for(let Cb=qb,Fb=qb+kb;Cb<Fb;Cb+=3)a(e.getX(Cb+0),e.getX(Cb+1),e.getX(Cb+2))}var ob=
new mb,pb=new mb,ub=new mb,rb=new mb;for(let Ab=0,wb=f.length;Ab<wb;++Ab){kb=f[Ab];qb=kb.start;kb=kb.count;for(let Cb=qb,Fb=qb+kb;Cb<Fb;Cb+=3)b(e.getX(Cb+0)),b(e.getX(Cb+1)),b(e.getX(Cb+2))}}}computeVertexNormals(){const a=this.index,b=this.getAttribute("position");if(void 0!==b){let e=this.getAttribute("normal");if(void 0===e)e=new Hd(new Float32Array(3*b.count),3),this.setAttribute("normal",e);else for(let z=0,ab=e.count;z<ab;z++)e.setXYZ(z,0,0,0);const f=new mb,h=new mb,n=new mb,r=new mb,t=new mb,
w=new mb,x=new mb,y=new mb;if(a)for(let z=0,ab=a.count;z<ab;z+=3){const eb=a.getX(z+0),cb=a.getX(z+1),db=a.getX(z+2);f.fromBufferAttribute(b,eb);h.fromBufferAttribute(b,cb);n.fromBufferAttribute(b,db);x.subVectors(n,h);y.subVectors(f,h);x.cross(y);r.fromBufferAttribute(e,eb);t.fromBufferAttribute(e,cb);w.fromBufferAttribute(e,db);r.add(x);t.add(x);w.add(x);e.setXYZ(eb,r.x,r.y,r.z);e.setXYZ(cb,t.x,t.y,t.z);e.setXYZ(db,w.x,w.y,w.z)}else for(let z=0,ab=b.count;z<ab;z+=3)f.fromBufferAttribute(b,z+0),
h.fromBufferAttribute(b,z+1),n.fromBufferAttribute(b,z+2),x.subVectors(n,h),y.subVectors(f,h),x.cross(y),e.setXYZ(z+0,x.x,x.y,x.z),e.setXYZ(z+1,x.x,x.y,x.z),e.setXYZ(z+2,x.x,x.y,x.z);this.normalizeNormals();e.needsUpdate=!0}}normalizeNormals(){const a=this.attributes.normal;for(let b=0,e=a.count;b<e;b++)jf.fromBufferAttribute(a,b),jf.normalize(),a.setXYZ(b,jf.x,jf.y,jf.z)}toNonIndexed(){function a(t,w){const x=t.array,y=t.itemSize,z=t.normalized,ab=new x.constructor(w.length*y);let eb,cb=0;for(let db=
0,bb=w.length;db<bb;db++){eb=t.isInterleavedBufferAttribute?w[db]*t.data.stride+t.offset:w[db]*y;for(let gb=0;gb<y;gb++)ab[cb++]=x[eb++]}return new Hd(ab,y,z)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const b=new md;var e=this.index.array,f=this.attributes;for(var h in f){var n=a(f[h],e);b.setAttribute(h,n)}f=this.morphAttributes;for(var r in f){h=[];n=f[r];for(let t=0,w=n.length;t<w;t++){const x=a(n[t],e);h.push(x)}b.morphAttributes[r]=
h}b.morphTargetsRelative=this.morphTargetsRelative;e=this.groups;for(let t=0,w=e.length;t<w;t++)r=e[t],b.addGroup(r.start,r.count,r.materialIndex);return b}toJSON(){const a={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);0<Object.keys(this.userData).length&&(a.userData=this.userData);if(void 0!==this.parameters){var b=this.parameters;for(var e in b)void 0!==b[e]&&(a[e]=b[e]);return a}a.data={attributes:{}};
e=this.index;null!==e&&(a.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});e=this.attributes;for(var f in e)a.data.attributes[f]=e[f].toJSON(a.data);f={};e=!1;for(b in this.morphAttributes){const h=this.morphAttributes[b],n=[];for(let r=0,t=h.length;r<t;r++)n.push(h[r].toJSON(a.data));0<n.length&&(f[b]=n,e=!0)}e&&(a.data.morphAttributes=f,a.data.morphTargetsRelative=this.morphTargetsRelative);b=this.groups;0<b.length&&(a.data.groups=JSON.parse(JSON.stringify(b)));
b=this.boundingSphere;null!==b&&(a.data.boundingSphere={center:b.center.toArray(),radius:b.radius});return a}clone(){return(new this.constructor).copy(this)}copy(a){this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;var b={};this.name=a.name;var e=a.index;null!==e&&this.setIndex(e.clone(b));e=a.attributes;for(var f in e)this.setAttribute(f,e[f].clone(b));f=a.morphAttributes;for(var h in f){e=[];const n=f[h];for(let r=0,t=n.length;r<
t;r++)e.push(n[r].clone(b));this.morphAttributes[h]=e}this.morphTargetsRelative=a.morphTargetsRelative;b=a.groups;for(let n=0,r=b.length;n<r;n++)h=b[n],this.addGroup(h.start,h.count,h.materialIndex);b=a.boundingBox;null!==b&&(this.boundingBox=b.clone());b=a.boundingSphere;null!==b&&(this.boundingSphere=b.clone());this.drawRange.start=a.drawRange.start;this.drawRange.count=a.drawRange.count;this.userData=a.userData;return this}dispose(){this.dispatchEvent({type:"dispose"})}}const Pw=new gd,jj=new dj,
sm=new lf,Qw=new mb,Pg=new mb,Qg=new mb,Rg=new mb,kq=new mb,tm=new mb,Kk=new Lb,Lk=new Lb,Mk=new Lb,Qq=new mb,Rq=new mb,Sq=new mb,yj=new mb,Jk=new mb;class Bd extends Cd{constructor(a=new md,b=new Qd){super();this.isMesh=!0;this.type="Mesh";this.geometry=a;this.material=b;this.updateMorphTargets()}copy(a,b){super.copy(a,b);void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));
this.material=Array.isArray(a.material)?a.material.slice():a.material;this.geometry=a.geometry;return this}updateMorphTargets(){var a=this.geometry.morphAttributes,b=Object.keys(a);if(0<b.length&&(a=a[b[0]],void 0!==a)){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let e=0,f=a.length;e<f;e++)b=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=e}}getVertexPosition(a,b){var e=this.geometry;const f=e.morphAttributes.position,h=e.morphTargetsRelative;
b.fromBufferAttribute(e.attributes.position,a);e=this.morphTargetInfluences;if(f&&e){tm.set(0,0,0);for(let n=0,r=f.length;n<r;n++){const t=e[n];0!==t&&(kq.fromBufferAttribute(f[n],a),h?tm.addScaledVector(kq,t):tm.addScaledVector(kq.sub(b),t))}b.add(tm)}return b}raycast(a,b){const e=this.geometry,f=this.matrixWorld;void 0!==this.material&&(null===e.boundingSphere&&e.computeBoundingSphere(),sm.copy(e.boundingSphere),sm.applyMatrix4(f),jj.copy(a.ray).recast(a.near),!1===sm.containsPoint(jj.origin)&&
(null===jj.intersectSphere(sm,Qw)||jj.origin.distanceToSquared(Qw)>Math.pow(a.far-a.near,2))||(Pw.copy(f).invert(),jj.copy(a.ray).applyMatrix4(Pw),null!==e.boundingBox&&!1===jj.intersectsBox(e.boundingBox)||this._computeIntersections(a,b,jj)))}_computeIntersections(a,b,e){var f=this.geometry;const h=this.material;var n=f.index,r=f.attributes.position;const t=f.attributes.uv,w=f.attributes.uv1,x=f.attributes.normal;var y=f.groups;f=f.drawRange;if(null!==n)if(Array.isArray(h))for(let cb=0,db=y.length;cb<
db;cb++){r=y[cb];var z=h[r.materialIndex];var ab=Math.max(r.start,f.start);var eb=Math.min(n.count,Math.min(r.start+r.count,f.start+f.count));for(let bb=ab,gb=eb;bb<gb;bb+=3){ab=n.getX(bb);eb=n.getX(bb+1);const kb=n.getX(bb+2);if(ab=Ik(this,z,a,e,t,w,x,ab,eb,kb))ab.faceIndex=Math.floor(bb/3),ab.face.materialIndex=r.materialIndex,b.push(ab)}}else{y=Math.max(0,f.start);f=Math.min(n.count,f.start+f.count);for(let cb=y,db=f;cb<db;cb+=3)if(f=n.getX(cb),y=n.getX(cb+1),r=n.getX(cb+2),ab=Ik(this,h,a,e,t,
w,x,f,y,r))ab.faceIndex=Math.floor(cb/3),b.push(ab)}else if(void 0!==r)if(Array.isArray(h))for(let cb=0,db=y.length;cb<db;cb++){n=y[cb];z=h[n.materialIndex];ab=Math.max(n.start,f.start);eb=Math.min(r.count,Math.min(n.start+n.count,f.start+f.count));for(let bb=ab,gb=eb;bb<gb;bb+=3)if(ab=Ik(this,z,a,e,t,w,x,bb,bb+1,bb+2))ab.faceIndex=Math.floor(bb/3),ab.face.materialIndex=n.materialIndex,b.push(ab)}else{n=Math.max(0,f.start);f=Math.min(r.count,f.start+f.count);for(let cb=n,db=f;cb<db;cb+=3)if(ab=Ik(this,
h,a,e,t,w,x,cb,cb+1,cb+2))ab.faceIndex=Math.floor(cb/3),b.push(ab)}}}class Sg extends md{constructor(a=1,b=1,e=1,f=1,h=1,n=1){function r(cb,db,bb,gb,kb,qb,ob,pb,ub,rb,Ab){const wb=qb/ub,Cb=ob/rb,Fb=qb/2,Ob=ob/2,Gb=pb/2;ob=ub+1;const Nb=rb+1;let Rb=qb=0;const Pb=new mb;for(let wd=0;wd<Nb;wd++){const Yb=wd*Cb-Ob;for(let Sb=0;Sb<ob;Sb++)Pb[cb]=(Sb*wb-Fb)*gb,Pb[db]=Yb*kb,Pb[bb]=Gb,x.push(Pb.x,Pb.y,Pb.z),Pb[cb]=0,Pb[db]=0,Pb[bb]=0<pb?1:-1,y.push(Pb.x,Pb.y,Pb.z),z.push(Sb/ub),z.push(1-wd/rb),qb+=1}for(cb=
0;cb<rb;cb++)for(db=0;db<ub;db++)bb=ab+db+ob*(cb+1),gb=ab+(db+1)+ob*(cb+1),kb=ab+(db+1)+ob*cb,w.push(ab+db+ob*cb,bb,kb),w.push(bb,gb,kb),Rb+=6;t.addGroup(eb,Rb,Ab);eb+=Rb;ab+=qb}super();this.type="BoxGeometry";this.parameters={width:a,height:b,depth:e,widthSegments:f,heightSegments:h,depthSegments:n};const t=this;f=Math.floor(f);h=Math.floor(h);n=Math.floor(n);const w=[],x=[],y=[],z=[];let ab=0,eb=0;r("z","y","x",-1,-1,e,b,a,n,h,0);r("z","y","x",1,-1,e,b,-a,n,h,1);r("x","z","y",1,1,a,e,b,f,n,2);r("x",
"z","y",1,-1,a,e,-b,f,n,3);r("x","y","z",1,-1,a,b,e,f,h,4);r("x","y","z",-1,-1,a,b,-e,f,h,5);this.setIndex(w);this.setAttribute("position",new $b(x,3));this.setAttribute("normal",new $b(y,3));this.setAttribute("uv",new $b(z,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new Sg(a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments)}}const pv={clone:zj,merge:xf};class Of extends Zd{constructor(a){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.clipping=this.lights=this.fog=!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!==a&&this.setValues(a)}copy(a){super.copy(a);this.fragmentShader=a.fragmentShader;this.vertexShader=a.vertexShader;this.uniforms=zj(a.uniforms);var b=a.uniformsGroups;const e=[];for(let f=0;f<b.length;f++)e.push(b[f].clone());this.uniformsGroups=e;this.defines=Object.assign({},a.defines);this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.fog=a.fog;this.lights=a.lights;
this.clipping=a.clipping;this.extensions=Object.assign({},a.extensions);this.glslVersion=a.glslVersion;return this}toJSON(a){const b=super.toJSON(a);b.glslVersion=this.glslVersion;b.uniforms={};for(const e in this.uniforms){const f=this.uniforms[e].value;b.uniforms[e]=f&&f.isTexture?{type:"t",value:f.toJSON(a).uuid}:f&&f.isColor?{type:"c",value:f.getHex()}:f&&f.isVector2?{type:"v2",value:f.toArray()}:f&&f.isVector3?{type:"v3",value:f.toArray()}:f&&f.isVector4?{type:"v4",value:f.toArray()}:f&&f.isMatrix3?
{type:"m3",value:f.toArray()}:f&&f.isMatrix4?{type:"m4",value:f.toArray()}:{value:f}}0<Object.keys(this.defines).length&&(b.defines=this.defines);b.vertexShader=this.vertexShader;b.fragmentShader=this.fragmentShader;b.lights=this.lights;b.clipping=this.clipping;a={};for(const e in this.extensions)!0===this.extensions[e]&&(a[e]=!0);0<Object.keys(a).length&&(b.extensions=a);return b}}class Zk extends Cd{constructor(){super();this.isCamera=!0;this.type="Camera";this.matrixWorldInverse=new gd;this.projectionMatrix=
new gd;this.projectionMatrixInverse=new gd;this.coordinateSystem=2E3}copy(a,b){super.copy(a,b);this.matrixWorldInverse.copy(a.matrixWorldInverse);this.projectionMatrix.copy(a.projectionMatrix);this.projectionMatrixInverse.copy(a.projectionMatrixInverse);this.coordinateSystem=a.coordinateSystem;return this}getWorldDirection(a){return super.getWorldDirection(a).negate()}updateMatrixWorld(a){super.updateMatrixWorld(a);this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(a,b){super.updateWorldMatrix(a,
b);this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Jg=new mb,Rw=new Lb,Sw=new Lb;class ff extends Zk{constructor(a=50,b=1,e=.1,f=2E3){super();this.isPerspectiveCamera=!0;this.type="PerspectiveCamera";this.fov=a;this.zoom=1;this.near=e;this.far=f;this.focus=10;this.aspect=b;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}copy(a,b){super.copy(a,b);this.fov=a.fov;this.zoom=a.zoom;this.near=a.near;this.far=
a.far;this.focus=a.focus;this.aspect=a.aspect;this.view=null===a.view?null:Object.assign({},a.view);this.filmGauge=a.filmGauge;this.filmOffset=a.filmOffset;return this}setFocalLength(a){a=.5*this.getFilmHeight()/a;this.fov=2*Kj*Math.atan(a);this.updateProjectionMatrix()}getFocalLength(){const a=Math.tan(.5*hj*this.fov);return.5*this.getFilmHeight()/a}getEffectiveFOV(){return 2*Kj*Math.atan(Math.tan(.5*hj*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/
Math.max(this.aspect,1)}getViewBounds(a,b,e){Jg.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse);b.set(Jg.x,Jg.y).multiplyScalar(-a/Jg.z);Jg.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse);e.set(Jg.x,Jg.y).multiplyScalar(-a/Jg.z)}getViewSize(a,b){this.getViewBounds(a,Rw,Sw);return b.subVectors(Sw,Rw)}setViewOffset(a,b,e,f,h,n){this.aspect=a/b;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=
a;this.view.fullHeight=b;this.view.offsetX=e;this.view.offsetY=f;this.view.width=h;this.view.height=n;this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()}updateProjectionMatrix(){const a=this.near;let b=a*Math.tan(.5*hj*this.fov)/this.zoom,e=2*b,f=this.aspect*e,h=-.5*f;var n=this.view;if(null!==this.view&&this.view.enabled){const r=n.fullWidth,t=n.fullHeight;h+=n.offsetX*f/r;b-=n.offsetY*e/t;f*=n.width/r;e*=n.height/t}n=this.filmOffset;
0!==n&&(h+=a*n/this.getFilmWidth());this.projectionMatrix.makePerspective(h,h+f,b,b-e,a,this.far,this.coordinateSystem);this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(a){a=super.toJSON(a);a.object.fov=this.fov;a.object.zoom=this.zoom;a.object.near=this.near;a.object.far=this.far;a.object.focus=this.focus;a.object.aspect=this.aspect;null!==this.view&&(a.object.view=Object.assign({},this.view));a.object.filmGauge=this.filmGauge;a.object.filmOffset=this.filmOffset;return a}}
class Yv extends Cd{constructor(a,b,e){super();this.type="CubeCamera";this.renderTarget=e;this.coordinateSystem=null;this.activeMipmapLevel=0;e=new ff(-90,1,a,b);e.layers=this.layers;this.add(e);e=new ff(-90,1,a,b);e.layers=this.layers;this.add(e);e=new ff(-90,1,a,b);e.layers=this.layers;this.add(e);e=new ff(-90,1,a,b);e.layers=this.layers;this.add(e);e=new ff(-90,1,a,b);e.layers=this.layers;this.add(e);a=new ff(-90,1,a,b);a.layers=this.layers;this.add(a)}updateCoordinateSystem(){const a=this.coordinateSystem,
b=this.children.concat(),[e,f,h,n,r,t]=b;for(const w of b)this.remove(w);if(2E3===a)e.up.set(0,1,0),e.lookAt(1,0,0),f.up.set(0,1,0),f.lookAt(-1,0,0),h.up.set(0,0,-1),h.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),r.up.set(0,1,0),r.lookAt(0,0,1),t.up.set(0,1,0),t.lookAt(0,0,-1);else if(2001===a)e.up.set(0,-1,0),e.lookAt(-1,0,0),f.up.set(0,-1,0),f.lookAt(1,0,0),h.up.set(0,0,1),h.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),r.up.set(0,-1,0),r.lookAt(0,0,1),t.up.set(0,-1,0),t.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+
a);for(const w of b)this.add(w),w.updateMatrixWorld()}update(a,b){null===this.parent&&this.updateMatrixWorld();const e=this.renderTarget,f=this.activeMipmapLevel;this.coordinateSystem!==a.coordinateSystem&&(this.coordinateSystem=a.coordinateSystem,this.updateCoordinateSystem());const [h,n,r,t,w,x]=this.children,y=a.getRenderTarget(),z=a.getActiveCubeFace(),ab=a.getActiveMipmapLevel(),eb=a.xr.enabled;a.xr.enabled=!1;const cb=e.texture.generateMipmaps;e.texture.generateMipmaps=!1;a.setRenderTarget(e,
0,f);a.render(b,h);a.setRenderTarget(e,1,f);a.render(b,n);a.setRenderTarget(e,2,f);a.render(b,r);a.setRenderTarget(e,3,f);a.render(b,t);a.setRenderTarget(e,4,f);a.render(b,w);e.texture.generateMipmaps=cb;a.setRenderTarget(e,5,f);a.render(b,x);a.setRenderTarget(y,z,ab);a.xr.enabled=eb;e.texture.needsPMREMUpdate=!0}}class ok extends Rd{constructor(a,b,e,f,h,n,r,t,w,x){a=void 0!==a?a:[];super(a,void 0!==b?b:301,e,f,h,n,r,t,w,x);this.isCubeTexture=!0;this.flipY=!1}get images(){return this.image}set images(a){this.image=
a}}class Vq extends Qf{constructor(a=1,b={}){super(a,a,b);this.isWebGLCubeRenderTarget=!0;a={width:a,height:a,depth:1};this.texture=new ok([a,a,a,a,a,a],b.mapping,b.wrapS,b.wrapT,b.magFilter,b.minFilter,b.format,b.type,b.anisotropy,b.colorSpace);this.texture.isRenderTargetTexture=!0;this.texture.generateMipmaps=void 0!==b.generateMipmaps?b.generateMipmaps:!1;this.texture.minFilter=void 0!==b.minFilter?b.minFilter:1006}fromEquirectangularTexture(a,b){this.texture.type=b.type;this.texture.colorSpace=
b.colorSpace;this.texture.generateMipmaps=b.generateMipmaps;this.texture.minFilter=b.minFilter;this.texture.magFilter=b.magFilter;var e=new Sg(5,5,5),f=new Of({name:"CubemapFromEquirect",uniforms:zj({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",side:1,blending:0});f.uniforms.tEquirect.value=b;e=new Bd(e,f);f=b.minFilter;1008===b.minFilter&&(b.minFilter=1006);(new Yv(1,10,this)).update(a,e);b.minFilter=
f;e.geometry.dispose();e.material.dispose();return this}clear(a,b,e,f){const h=a.getRenderTarget();for(let n=0;6>n;n++)a.setRenderTarget(this,n),a.clear(b,e,f);a.setRenderTarget(h)}}const lq=new mb,$A=new mb,aB=new qd;class yg{constructor(a=new mb(1,0,0),b=0){this.isPlane=!0;this.normal=a;this.constant=b}set(a,b){this.normal.copy(a);this.constant=b;return this}setComponents(a,b,e,f){this.normal.set(a,b,e);this.constant=f;return this}setFromNormalAndCoplanarPoint(a,b){this.normal.copy(a);this.constant=
-b.dot(this.normal);return this}setFromCoplanarPoints(a,b,e){b=lq.subVectors(e,b).cross($A.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this}copy(a){this.normal.copy(a.normal);this.constant=a.constant;return this}normalize(){const a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this}negate(){this.constant*=-1;this.normal.negate();return this}distanceToPoint(a){return this.normal.dot(a)+this.constant}distanceToSphere(a){return this.distanceToPoint(a.center)-
a.radius}projectPoint(a,b){return b.copy(a).addScaledVector(this.normal,-this.distanceToPoint(a))}intersectLine(a,b){const e=a.delta(lq);var f=this.normal.dot(e);if(0===f)return 0===this.distanceToPoint(a.start)?b.copy(a.start):null;f=-(a.start.dot(this.normal)+this.constant)/f;return 0>f||1<f?null:b.copy(a.start).addScaledVector(e,f)}intersectsLine(a){const b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b}intersectsBox(a){return a.intersectsPlane(this)}intersectsSphere(a){return a.intersectsPlane(this)}coplanarPoint(a){return a.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(a,
b){b=b||aB.getNormalMatrix(a);a=this.coplanarPoint(lq).applyMatrix4(a);b=this.normal.applyMatrix3(b).normalize();this.constant=-a.dot(b);return this}translate(a){this.constant-=a.dot(this.normal);return this}equals(a){return a.normal.equals(this.normal)&&a.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const kj=new lf,um=new mb;class hk{constructor(a=new yg,b=new yg,e=new yg,f=new yg,h=new yg,n=new yg){this.planes=[a,b,e,f,h,n]}set(a,b,e,f,h,n){const r=this.planes;r[0].copy(a);
r[1].copy(b);r[2].copy(e);r[3].copy(f);r[4].copy(h);r[5].copy(n);return this}copy(a){const b=this.planes;for(let e=0;6>e;e++)b[e].copy(a.planes[e]);return this}setFromProjectionMatrix(a,b=2E3){const e=this.planes;var f=a.elements;a=f[0];const h=f[1],n=f[2],r=f[3],t=f[4],w=f[5],x=f[6],y=f[7],z=f[8],ab=f[9],eb=f[10],cb=f[11],db=f[12],bb=f[13],gb=f[14];f=f[15];e[0].setComponents(r-a,y-t,cb-z,f-db).normalize();e[1].setComponents(r+a,y+t,cb+z,f+db).normalize();e[2].setComponents(r+h,y+w,cb+ab,f+bb).normalize();
e[3].setComponents(r-h,y-w,cb-ab,f-bb).normalize();e[4].setComponents(r-n,y-x,cb-eb,f-gb).normalize();if(2E3===b)e[5].setComponents(r+n,y+x,cb+eb,f+gb).normalize();else if(2001===b)e[5].setComponents(n,x,eb,gb).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+b);return this}intersectsObject(a){if(void 0!==a.boundingSphere)null===a.boundingSphere&&a.computeBoundingSphere(),kj.copy(a.boundingSphere).applyMatrix4(a.matrixWorld);else{const b=a.geometry;
null===b.boundingSphere&&b.computeBoundingSphere();kj.copy(b.boundingSphere).applyMatrix4(a.matrixWorld)}return this.intersectsSphere(kj)}intersectsSprite(a){kj.center.set(0,0,0);kj.radius=.7071067811865476;kj.applyMatrix4(a.matrixWorld);return this.intersectsSphere(kj)}intersectsSphere(a){const b=this.planes,e=a.center;a=-a.radius;for(let f=0;6>f;f++)if(b[f].distanceToPoint(e)<a)return!1;return!0}intersectsBox(a){const b=this.planes;for(let e=0;6>e;e++){const f=b[e];um.x=0<f.normal.x?a.max.x:a.min.x;
um.y=0<f.normal.y?a.max.y:a.min.y;um.z=0<f.normal.z?a.max.z:a.min.z;if(0>f.distanceToPoint(um))return!1}return!0}containsPoint(a){const b=this.planes;for(let e=0;6>e;e++)if(0>b[e].distanceToPoint(a))return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Df extends md{constructor(a=1,b=1,e=1,f=1){super();this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:e,heightSegments:f};var h=a/2,n=b/2;e=Math.floor(e);f=Math.floor(f);const r=e+1;var t=f+1,w=a/e,x=b/f;b=
[];a=[];const y=[],z=[];for(let ab=0;ab<t;ab++){const eb=ab*x-n;for(let cb=0;cb<r;cb++)a.push(cb*w-h,-eb,0),y.push(0,0,1),z.push(cb/e),z.push(1-ab/f)}for(h=0;h<f;h++)for(n=0;n<e;n++)t=n+r*(h+1),w=n+1+r*(h+1),x=n+1+r*h,b.push(n+r*h,t,x),b.push(t,w,x);this.setIndex(b);this.setAttribute("position",new $b(a,3));this.setAttribute("normal",new $b(y,3));this.setAttribute("uv",new $b(z,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new Df(a.width,
a.height,a.widthSegments,a.heightSegments)}}const vd={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}"},
Ub={common:{diffuse:{value:new Tb(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qd},alphaMap:{value:null},alphaMapTransform:{value:new qd},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qd}},envmap:{envMap:{value:null},envMapRotation:{value:new qd},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qd}},lightmap:{lightMap:{value:null},
lightMapIntensity:{value:1},lightMapTransform:{value:new qd}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qd},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qd},normalScale:{value:new Lb(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qd},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qd}},metalnessmap:{metalnessMap:{value:null},
metalnessMapTransform:{value:new qd}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qd}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new Tb(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 Tb(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qd},alphaTest:{value:0},uvTransform:{value:new qd}},
sprite:{diffuse:{value:new Tb(16777215)},opacity:{value:1},center:{value:new Lb(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qd},alphaMap:{value:null},alphaMapTransform:{value:new qd},alphaTest:{value:0}}},Pf={basic:{uniforms:xf([Ub.common,Ub.specularmap,Ub.envmap,Ub.aomap,Ub.lightmap,Ub.fog]),vertexShader:vd.meshbasic_vert,fragmentShader:vd.meshbasic_frag},lambert:{uniforms:xf([Ub.common,Ub.specularmap,Ub.envmap,Ub.aomap,Ub.lightmap,Ub.emissivemap,Ub.bumpmap,Ub.normalmap,Ub.displacementmap,
Ub.fog,Ub.lights,{emissive:{value:new Tb(0)}}]),vertexShader:vd.meshlambert_vert,fragmentShader:vd.meshlambert_frag},phong:{uniforms:xf([Ub.common,Ub.specularmap,Ub.envmap,Ub.aomap,Ub.lightmap,Ub.emissivemap,Ub.bumpmap,Ub.normalmap,Ub.displacementmap,Ub.fog,Ub.lights,{emissive:{value:new Tb(0)},specular:{value:new Tb(1118481)},shininess:{value:30}}]),vertexShader:vd.meshphong_vert,fragmentShader:vd.meshphong_frag},standard:{uniforms:xf([Ub.common,Ub.envmap,Ub.aomap,Ub.lightmap,Ub.emissivemap,Ub.bumpmap,
Ub.normalmap,Ub.displacementmap,Ub.roughnessmap,Ub.metalnessmap,Ub.fog,Ub.lights,{emissive:{value:new Tb(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vd.meshphysical_vert,fragmentShader:vd.meshphysical_frag},toon:{uniforms:xf([Ub.common,Ub.aomap,Ub.lightmap,Ub.emissivemap,Ub.bumpmap,Ub.normalmap,Ub.displacementmap,Ub.gradientmap,Ub.fog,Ub.lights,{emissive:{value:new Tb(0)}}]),vertexShader:vd.meshtoon_vert,fragmentShader:vd.meshtoon_frag},matcap:{uniforms:xf([Ub.common,
Ub.bumpmap,Ub.normalmap,Ub.displacementmap,Ub.fog,{matcap:{value:null}}]),vertexShader:vd.meshmatcap_vert,fragmentShader:vd.meshmatcap_frag},points:{uniforms:xf([Ub.points,Ub.fog]),vertexShader:vd.points_vert,fragmentShader:vd.points_frag},dashed:{uniforms:xf([Ub.common,Ub.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vd.linedashed_vert,fragmentShader:vd.linedashed_frag},depth:{uniforms:xf([Ub.common,Ub.displacementmap]),vertexShader:vd.depth_vert,fragmentShader:vd.depth_frag},
normal:{uniforms:xf([Ub.common,Ub.bumpmap,Ub.normalmap,Ub.displacementmap,{opacity:{value:1}}]),vertexShader:vd.meshnormal_vert,fragmentShader:vd.meshnormal_frag},sprite:{uniforms:xf([Ub.sprite,Ub.fog]),vertexShader:vd.sprite_vert,fragmentShader:vd.sprite_frag},background:{uniforms:{uvTransform:{value:new qd},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vd.background_vert,fragmentShader:vd.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},
backgroundIntensity:{value:1},backgroundRotation:{value:new qd}},vertexShader:vd.backgroundCube_vert,fragmentShader:vd.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vd.cube_vert,fragmentShader:vd.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vd.equirect_vert,fragmentShader:vd.equirect_frag},distanceRGBA:{uniforms:xf([Ub.common,Ub.displacementmap,{referencePosition:{value:new mb},nearDistance:{value:1},farDistance:{value:1E3}}]),
vertexShader:vd.distanceRGBA_vert,fragmentShader:vd.distanceRGBA_frag},shadow:{uniforms:xf([Ub.lights,Ub.fog,{color:{value:new Tb(0)},opacity:{value:1}}]),vertexShader:vd.shadow_vert,fragmentShader:vd.shadow_frag}};Pf.physical={uniforms:xf([Pf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qd},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qd},clearcoatNormalScale:{value:new Lb(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},
clearcoatRoughnessMapTransform:{value:new qd},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qd},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qd},sheen:{value:0},sheenColor:{value:new Tb(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qd},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qd},
transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qd},transmissionSamplerSize:{value:new Lb},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qd},attenuationDistance:{value:0},attenuationColor:{value:new Tb(0)},specularColor:{value:new Tb(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qd},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qd},
anisotropyVector:{value:new Lb},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qd}}]),vertexShader:vd.meshphysical_vert,fragmentShader:vd.meshphysical_frag};const Nk={r:0,b:0,g:0},If=new Ff,ay=new gd;class rk extends Zk{constructor(a=-1,b=1,e=1,f=-1,h=.1,n=2E3){super();this.isOrthographicCamera=!0;this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=a;this.right=b;this.top=e;this.bottom=f;this.near=h;this.far=n;this.updateProjectionMatrix()}copy(a,b){super.copy(a,b);this.left=
a.left;this.right=a.right;this.top=a.top;this.bottom=a.bottom;this.near=a.near;this.far=a.far;this.zoom=a.zoom;this.view=null===a.view?null:Object.assign({},a.view);return this}setViewOffset(a,b,e,f,h,n){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=a;this.view.fullHeight=b;this.view.offsetX=e;this.view.offsetY=f;this.view.width=h;this.view.height=n;this.updateProjectionMatrix()}clearViewOffset(){null!==
this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()}updateProjectionMatrix(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),e=(this.right+this.left)/2,f=(this.top+this.bottom)/2;let h=e-a;e+=a;a=f+b;b=f-b;null!==this.view&&this.view.enabled&&(f=(this.right-this.left)/this.view.fullWidth/this.zoom,b=(this.top-this.bottom)/this.view.fullHeight/this.zoom,h+=f*this.view.offsetX,e=h+f*this.view.width,a-=b*this.view.offsetY,b=a-b*this.view.height);this.projectionMatrix.makeOrthographic(h,
e,a,b,this.near,this.far,this.coordinateSystem);this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(a){a=super.toJSON(a);a.object.zoom=this.zoom;a.object.left=this.left;a.object.right=this.right;a.object.top=this.top;a.object.bottom=this.bottom;a.object.near=this.near;a.object.far=this.far;null!==this.view&&(a.object.view=Object.assign({},this.view));return a}}const Tw=[.125,.215,.35,.446,.526,.582],mq=new rk,Uw=new Tb;let nq=null,oq=0,pq=0,qq=!1;const lj=(1+Math.sqrt(5))/2,Wj=
1/lj,Vw=[new mb(1,1,1),new mb(-1,1,1),new mb(1,1,-1),new mb(-1,1,-1),new mb(0,lj,Wj),new mb(0,lj,-Wj),new mb(Wj,0,lj),new mb(-Wj,0,lj),new mb(lj,Wj,0),new mb(-lj,Wj,0)];class ap{constructor(a){this._renderer=a;this._pingPongRenderTarget=null;this._cubeSize=this._lodMax=0;this._lodPlanes=[];this._sizeLods=[];this._sigmas=[];this._equirectMaterial=this._cubemapMaterial=this._blurMaterial=null;this._compileMaterial(this._blurMaterial)}fromScene(a,b=0,e=.1,f=100){nq=this._renderer.getRenderTarget();oq=
this._renderer.getActiveCubeFace();pq=this._renderer.getActiveMipmapLevel();qq=this._renderer.xr.enabled;this._renderer.xr.enabled=!1;this._setSize(256);const h=this._allocateTargets();h.depthBuffer=!0;this._sceneToCubeUV(a,e,f,h);0<b&&this._blur(h,0,0,b);this._applyPMREM(h);this._cleanup(h);return h}fromEquirectangular(a,b=null){return this._fromTexture(a,b)}fromCubemap(a,b=null){return this._fromTexture(a,b)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Yq(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===
this._equirectMaterial&&(this._equirectMaterial=Xq(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose();null!==this._cubemapMaterial&&this._cubemapMaterial.dispose();null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(a){this._lodMax=Math.floor(Math.log2(a));this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose();null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let a=0;a<this._lodPlanes.length;a++)this._lodPlanes[a].dispose()}_cleanup(a){this._renderer.setRenderTarget(nq,
oq,pq);this._renderer.xr.enabled=qq;a.scissorTest=!1;Ok(a,0,0,a.width,a.height)}_fromTexture(a,b){301===a.mapping||302===a.mapping?this._setSize(0===a.image.length?16:a.image[0].width||a.image[0].image.width):this._setSize(a.image.width/4);nq=this._renderer.getRenderTarget();oq=this._renderer.getActiveCubeFace();pq=this._renderer.getActiveMipmapLevel();qq=this._renderer.xr.enabled;this._renderer.xr.enabled=!1;b=b||this._allocateTargets();this._textureToCubeUV(a,b);this._applyPMREM(b);this._cleanup(b);
return b}_allocateTargets(){const a=3*Math.max(this._cubeSize,112),b=4*this._cubeSize;var e={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:"srgb-linear",depthBuffer:!1};const f=Wq(a,b,e);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==a||this._pingPongRenderTarget.height!==b){null!==this._pingPongRenderTarget&&this._dispose();this._pingPongRenderTarget=Wq(a,b,e);e=this._lodMax;var h=[],n=[];const x=[];let y=e;const z=e-4+1+Tw.length;for(let ab=
0;ab<z;ab++){var r=Math.pow(2,y);n.push(r);var t=1/r;ab>e-4?t=Tw[ab-e+4-1]:0===ab&&(t=0);x.push(t);t=1/(r-2);r=-t;t=1+t;var w=[r,r,t,r,t,t,r,r,t,t,r,t];r=new Float32Array(108);t=new Float32Array(72);const eb=new Float32Array(36);for(let cb=0;6>cb;cb++){const db=cb%3*2/3-1,bb=2<cb?0:-1;r.set([db,bb,0,db+2/3,bb,0,db+2/3,bb+1,0,db,bb,0,db+2/3,bb+1,0,db,bb+1,0],18*cb);t.set(w,12*cb);eb.set([cb,cb,cb,cb,cb,cb],6*cb)}w=new md;w.setAttribute("position",new Hd(r,3));w.setAttribute("uv",new Hd(t,2));w.setAttribute("faceIndex",
new Hd(eb,1));h.push(w);4<y&&y--}({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}={lodPlanes:h,sizeLods:n,sigmas:x});h=new Float32Array(20);n=new mb(0,1,0);this._blurMaterial=new Of({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/a,CUBEUV_TEXEL_HEIGHT:1/b,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:h},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:$m(),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})}return f}_compileMaterial(a){a=new Bd(this._lodPlanes[0],a);this._renderer.compile(a,mq)}_sceneToCubeUV(a,b,e,f){b=new ff(90,1,b,e);e=[1,-1,1,1,1,1];const h=[1,1,1,-1,-1,-1],n=this._renderer,r=n.autoClear,t=n.toneMapping;n.getClearColor(Uw);n.toneMapping=0;n.autoClear=!1;var w=new Qd({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1});const x=new Bd(new Sg,w);let y=!1;const z=a.background;z?z.isColor&&(w.color.copy(z),a.background=null,y=!0):(w.color.copy(Uw),
y=!0);for(w=0;6>w;w++){const ab=w%3;0===ab?(b.up.set(0,e[w],0),b.lookAt(h[w],0,0)):1===ab?(b.up.set(0,0,e[w]),b.lookAt(0,h[w],0)):(b.up.set(0,e[w],0),b.lookAt(0,0,h[w]));const eb=this._cubeSize;Ok(f,ab*eb,2<w?eb:0,eb,eb);n.setRenderTarget(f);y&&n.render(x,b);n.render(a,b)}x.geometry.dispose();x.material.dispose();n.toneMapping=t;n.autoClear=r;a.background=z}_textureToCubeUV(a,b){const e=this._renderer;var f=301===a.mapping||302===a.mapping;f?(null===this._cubemapMaterial&&(this._cubemapMaterial=Yq()),
this._cubemapMaterial.uniforms.flipEnvMap.value=!1===a.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Xq());const h=f?this._cubemapMaterial:this._equirectMaterial;f=new Bd(this._lodPlanes[0],h);h.uniforms.envMap.value=a;a=this._cubeSize;Ok(b,0,0,3*a,2*a);e.setRenderTarget(b);e.render(f,mq)}_applyPMREM(a){const b=this._renderer,e=b.autoClear;b.autoClear=!1;for(let f=1;f<this._lodPlanes.length;f++)this._blur(a,f-1,f,Math.sqrt(this._sigmas[f]*this._sigmas[f]-this._sigmas[f-
1]*this._sigmas[f-1]),Vw[(f-1)%Vw.length]);b.autoClear=e}_blur(a,b,e,f,h){const n=this._pingPongRenderTarget;this._halfBlur(a,n,b,e,f,"latitudinal",h);this._halfBlur(n,a,e,e,f,"longitudinal",h)}_halfBlur(a,b,e,f,h,n,r){const t=this._renderer;var w=this._blurMaterial;"latitudinal"!==n&&"longitudinal"!==n&&console.error("blur direction must be either latitudinal or longitudinal!");const x=new Bd(this._lodPlanes[f],w);w=w.uniforms;var y=this._sizeLods[e]-1;y=isFinite(h)?Math.PI/(2*y):2*Math.PI/39;var z=
h/y;const ab=isFinite(h)?1+Math.floor(3*z):20;20<ab&&console.warn(`sigmaRadians, ${h}, is too large and will clip, as it requested ${ab} samples when the maximum is set to ${20}`);h=[];let eb=0;for(let db=0;20>db;++db){var cb=db/z;cb=Math.exp(-cb*cb/2);h.push(cb);0===db?eb+=cb:db<ab&&(eb+=2*cb)}for(z=0;z<h.length;z++)h[z]/=eb;w.envMap.value=a.texture;w.samples.value=ab;w.weights.value=h;w.latitudinal.value="latitudinal"===n;r&&(w.poleAxis.value=r);a=this._lodMax;w.dTheta.value=y;w.mipInt.value=a-
e;e=this._sizeLods[f];Ok(b,3*e*(f>a-4?f-a+4:0),4*(this._cubeSize-e),3*e,2*e);t.setRenderTarget(b);t.render(x,mq)}}class yp extends Rd{constructor(a,b,e,f,h,n,r,t,w,x){x=void 0!==x?x:1026;if(1026!==x&&1027!==x)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===e&&1026===x&&(e=1014);void 0===e&&1027===x&&(e=1020);super(null,f,h,n,r,t,x,e,w);this.isDepthTexture=!0;this.image={width:a,height:b};this.magFilter=void 0!==r?r:1003;this.minFilter=void 0!==
t?t:1003;this.generateMipmaps=this.flipY=!1;this.compareFunction=null}copy(a){super.copy(a);this.compareFunction=a.compareFunction;return this}toJSON(a){a=super.toJSON(a);null!==this.compareFunction&&(a.compareFunction=this.compareFunction);return a}}const ev=new Rd,dv=new yp(1,1);dv.compareFunction=515;const hv=new Pk,fv=new xp,gv=new ok,Zq=[],$q=[],cv=new Float32Array(16),bv=new Float32Array(9),av=new Float32Array(4);class bB{constructor(a,b,e){this.id=a;this.addr=e;this.cache=[];this.type=b.type;
this.setValue=Gy(b.type)}}class cB{constructor(a,b,e){this.id=a;this.addr=e;this.cache=[];this.type=b.type;this.size=b.size;this.setValue=$y(b.type)}}class dB{constructor(a){this.id=a;this.seq=[];this.map={}}setValue(a,b,e){const f=this.seq;for(let h=0,n=f.length;h!==n;++h){const r=f[h];r.setValue(a,b[r.id],e)}}}const rq=/(\w+)(\])?(\[|\.)?/g;class Rk{constructor(a,b){this.seq=[];this.map={};const e=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(let x=0;x<e;++x){var f=a.getActiveUniform(b,x),h=f;
f=a.getUniformLocation(b,f.name);var n=this,r=h.name;const y=r.length;for(rq.lastIndex=0;;){const z=rq.exec(r),ab=rq.lastIndex;var t=z[1],w=z[3];"]"===z[2]&&(t|=0);if(void 0===w||"["===w&&ab+2===y){r=n;h=void 0===w?new bB(t,h,f):new cB(t,h,f);r.seq.push(h);r.map[h.id]=h;break}else w=n.map[t],void 0===w&&(w=new dB(t),t=n,n=w,t.seq.push(n),t.map[n.id]=n),n=w}}}setValue(a,b,e,f){b=this.map[b];void 0!==b&&b.setValue(a,e,f)}setOptional(a,b,e){b=b[e];void 0!==b&&this.setValue(a,e,b)}static upload(a,b,e,
f){for(let h=0,n=b.length;h!==n;++h){const r=b[h],t=e[r.id];!1!==t.needsUpdate&&r.setValue(a,t.value,f)}}static seqWithValue(a,b){const e=[];for(let f=0,h=a.length;f!==h;++f){const n=a[f];n.id in b&&e.push(n)}return e}}let kz=0;const ep=/^[ \t]*#include +<([\w\d./]+)>/gm,dz=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]),ov=/#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;
let eB=0;class mz{constructor(){this.shaderCache=new Map;this.materialCache=new Map}update(a){var b=a.fragmentShader;const e=this._getShaderStage(a.vertexShader);b=this._getShaderStage(b);a=this._getShaderCacheForMaterial(a);!1===a.has(e)&&(a.add(e),e.usedTimes++);!1===a.has(b)&&(a.add(b),b.usedTimes++);return this}remove(a){const b=this.materialCache.get(a);for(const e of b)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);this.materialCache.delete(a);return this}getVertexShaderID(a){return this._getShaderStage(a.vertexShader).id}getFragmentShaderID(a){return this._getShaderStage(a.fragmentShader).id}dispose(){this.shaderCache.clear();
this.materialCache.clear()}_getShaderCacheForMaterial(a){const b=this.materialCache;let e=b.get(a);void 0===e&&(e=new Set,b.set(a,e));return e}_getShaderStage(a){const b=this.shaderCache;let e=b.get(a);void 0===e&&(e=new fB(a),b.set(a,e));return e}}class fB{constructor(a){this.id=eB++;this.code=a;this.usedTimes=0}}let uz=0;class fp extends Zd{constructor(a){super();this.isMeshDepthMaterial=!0;this.type="MeshDepthMaterial";this.depthPacking=3200;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=
1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.setValues(a)}copy(a){super.copy(a);this.depthPacking=a.depthPacking;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this}}class gp extends Zd{constructor(a){super();this.isMeshDistanceMaterial=!0;this.type="MeshDistanceMaterial";this.displacementMap=
this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.setValues(a)}copy(a){super.copy(a);this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;return this}}class Sv extends ff{constructor(a=[]){super();this.isArrayCamera=!0;this.cameras=a}}class af extends Cd{constructor(){super();this.isGroup=!0;this.type="Group"}}const gB={type:"move"};class sq{constructor(){this._hand=
this._grip=this._targetRay=null}getHandSpace(){null===this._hand&&(this._hand=new af,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1});return this._hand}getTargetRaySpace(){null===this._targetRay&&(this._targetRay=new af,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new mb,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new mb);return this._targetRay}getGripSpace(){null===
this._grip&&(this._grip=new af,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new mb,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new mb);return this._grip}dispatchEvent(a){null!==this._targetRay&&this._targetRay.dispatchEvent(a);null!==this._grip&&this._grip.dispatchEvent(a);null!==this._hand&&this._hand.dispatchEvent(a);return this}connect(a){if(a&&a.hand){const b=this._hand;if(b)for(const e of a.hand.values())this._getHandJoint(b,
e)}this.dispatchEvent({type:"connected",data:a});return this}disconnect(a){this.dispatchEvent({type:"disconnected",data:a});null!==this._targetRay&&(this._targetRay.visible=!1);null!==this._grip&&(this._grip.visible=!1);null!==this._hand&&(this._hand.visible=!1);return this}update(a,b,e){let f=null,h=null,n=null;const r=this._targetRay,t=this._grip,w=this._hand;if(a&&"visible-blurred"!==b.session.visibilityState){if(w&&a.hand){n=!0;for(var x of a.hand.values()){const y=b.getJointPose(x,e),z=this._getHandJoint(w,
x);null!==y&&(z.matrix.fromArray(y.transform.matrix),z.matrix.decompose(z.position,z.rotation,z.scale),z.matrixWorldNeedsUpdate=!0,z.jointRadius=y.radius);z.visible=null!==y}x=w.joints["index-finger-tip"].position.distanceTo(w.joints["thumb-tip"].position);w.inputState.pinching&&.025<x?(w.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:a.handedness,target:this})):!w.inputState.pinching&&.015>=x&&(w.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:a.handedness,
target:this}))}else null!==t&&a.gripSpace&&(h=b.getPose(a.gripSpace,e),null!==h&&(t.matrix.fromArray(h.transform.matrix),t.matrix.decompose(t.position,t.rotation,t.scale),t.matrixWorldNeedsUpdate=!0,h.linearVelocity?(t.hasLinearVelocity=!0,t.linearVelocity.copy(h.linearVelocity)):t.hasLinearVelocity=!1,h.angularVelocity?(t.hasAngularVelocity=!0,t.angularVelocity.copy(h.angularVelocity)):t.hasAngularVelocity=!1));null!==r&&(f=b.getPose(a.targetRaySpace,e),null===f&&null!==h&&(f=h),null!==f&&(r.matrix.fromArray(f.transform.matrix),
r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,f.linearVelocity?(r.hasLinearVelocity=!0,r.linearVelocity.copy(f.linearVelocity)):r.hasLinearVelocity=!1,f.angularVelocity?(r.hasAngularVelocity=!0,r.angularVelocity.copy(f.angularVelocity)):r.hasAngularVelocity=!1,this.dispatchEvent(gB)))}null!==r&&(r.visible=null!==f);null!==t&&(t.visible=null!==h);null!==w&&(w.visible=null!==n);return this}_getHandJoint(a,b){if(void 0===a.joints[b.jointName]){const e=new af;e.matrixAutoUpdate=
!1;e.visible=!1;a.joints[b.jointName]=e;a.add(e)}return a.joints[b.jointName]}}class hB{constructor(){this.mesh=this.texture=null;this.depthFar=this.depthNear=0}init(a,b,e){if(null===this.texture){const f=new Rd;a.properties.get(f).__webglTexture=b.texture;if(b.depthNear!=e.depthNear||b.depthFar!=e.depthFar)this.depthNear=b.depthNear,this.depthFar=b.depthFar;this.texture=f}}render(a,b){if(null!==this.texture){if(null===this.mesh){var e=b.cameras[0].viewport;e=new Of({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 Bd(new Df(20,20),e)}a.render(this.mesh,b)}}reset(){this.mesh=this.texture=null}}class iB extends ng{constructor(a,b){function e(hb){var ib=rb.indexOf(hb.inputSource);-1!==ib&&(ib=ub[ib],void 0!==ib&&(ib.update(hb.inputSource,hb.frame,ab||x),ib.dispatchEvent({type:hb.type,data:hb.inputSource})))}function f(){t.removeEventListener("select",e);t.removeEventListener("selectstart",e);t.removeEventListener("selectend",e);t.removeEventListener("squeeze",e);t.removeEventListener("squeezestart",
e);t.removeEventListener("squeezeend",e);t.removeEventListener("end",f);t.removeEventListener("inputsourceschange",h);for(let hb=0;hb<ub.length;hb++){const ib=rb[hb];null!==ib&&(rb[hb]=null,ub[hb].disconnect(ib))}Rb=Nb=null;kb.reset();a.setRenderTarget(ob);pb=t=cb=db=bb=null;Sb.stop();r.isPresenting=!1;a.setPixelRatio(wb);a.setSize(Ab.width,Ab.height,!1);r.dispatchEvent({type:"sessionend"})}function h(hb){for(var ib=0;ib<hb.removed.length;ib++){var nb=hb.removed[ib],tb=rb.indexOf(nb);0<=tb&&(rb[tb]=
null,ub[tb].disconnect(nb))}for(ib=0;ib<hb.added.length;ib++){nb=hb.added[ib];tb=rb.indexOf(nb);if(-1===tb){for(let sb=0;sb<ub.length;sb++)if(sb>=rb.length){rb.push(nb);tb=sb;break}else if(null===rb[sb]){rb[sb]=nb;tb=sb;break}if(-1===tb)break}(tb=ub[tb])&&tb.connect(nb)}}function n(hb,ib){null===ib?hb.matrixWorld.copy(hb.matrix):hb.matrixWorld.multiplyMatrices(ib.matrixWorld,hb.matrix);hb.matrixWorldInverse.copy(hb.matrixWorld).invert()}super();const r=this;let t=null,w=1,x=null,y="local-floor",z=
1,ab=null,eb=null,cb=null,db=null,bb=null,gb=null;const kb=new hB,qb=b.getContextAttributes();let ob=null,pb=null;const ub=[],rb=[],Ab=new Lb;let wb=null;const Cb=new ff;Cb.layers.enable(1);Cb.viewport=new Md;const Fb=new ff;Fb.layers.enable(2);Fb.viewport=new Md;const Ob=[Cb,Fb],Gb=new Sv;Gb.layers.enable(1);Gb.layers.enable(2);let Nb=null,Rb=null;this.cameraAutoUpdate=!0;this.isPresenting=this.enabled=!1;this.getController=function(hb){let ib=ub[hb];void 0===ib&&(ib=new sq,ub[hb]=ib);return ib.getTargetRaySpace()};
this.getControllerGrip=function(hb){let ib=ub[hb];void 0===ib&&(ib=new sq,ub[hb]=ib);return ib.getGripSpace()};this.getHand=function(hb){let ib=ub[hb];void 0===ib&&(ib=new sq,ub[hb]=ib);return ib.getHandSpace()};this.setFramebufferScaleFactor=function(hb){w=hb;!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")};this.setReferenceSpaceType=function(hb){y=hb;!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")};
this.getReferenceSpace=function(){return ab||x};this.setReferenceSpace=function(hb){ab=hb};this.getBaseLayer=function(){return null!==db?db:bb};this.getBinding=function(){return cb};this.getFrame=function(){return gb};this.getSession=function(){return t};this.setSession=function(hb){const ib=this;return Vx(function*(){t=hb;if(null!==t){ob=a.getRenderTarget();t.addEventListener("select",e);t.addEventListener("selectstart",e);t.addEventListener("selectend",e);t.addEventListener("squeeze",e);t.addEventListener("squeezestart",
e);t.addEventListener("squeezeend",e);t.addEventListener("end",f);t.addEventListener("inputsourceschange",h);!0!==qb.xrCompatible&&(yield b.makeXRCompatible());wb=a.getPixelRatio();a.getSize(Ab);if(void 0===t.renderState.layers)bb=new XRWebGLLayer(t,b,{antialias:qb.antialias,alpha:!0,depth:qb.depth,stencil:qb.stencil,framebufferScaleFactor:w}),t.updateRenderState({baseLayer:bb}),a.setPixelRatio(1),a.setSize(bb.framebufferWidth,bb.framebufferHeight,!1),pb=new Qf(bb.framebufferWidth,bb.framebufferHeight,
{format:1023,type:1009,colorSpace:a.outputColorSpace,stencilBuffer:qb.stencil});else{let tb=null,sb=null;var nb=null;qb.depth&&(nb=qb.stencil?b.DEPTH24_STENCIL8:b.DEPTH_COMPONENT24,tb=qb.stencil?1027:1026,sb=qb.stencil?1020:1014);nb={colorFormat:b.RGBA8,depthFormat:nb,scaleFactor:w};cb=new XRWebGLBinding(t,b);db=cb.createProjectionLayer(nb);t.updateRenderState({layers:[db]});a.setPixelRatio(1);a.setSize(db.textureWidth,db.textureHeight,!1);pb=new Qf(db.textureWidth,db.textureHeight,{format:1023,type:1009,
depthTexture:new yp(db.textureWidth,db.textureHeight,sb,void 0,void 0,void 0,void 0,void 0,void 0,tb),stencilBuffer:qb.stencil,colorSpace:a.outputColorSpace,samples:qb.antialias?4:0});a.properties.get(pb).__ignoreDepthValues=db.ignoreDepthValues}pb.isXRRenderTarget=!0;ib.setFoveation(z);ab=null;x=yield t.requestReferenceSpace(y);Sb.setContext(t);Sb.start();r.isPresenting=!0;r.dispatchEvent({type:"sessionstart"})}}())};this.getEnvironmentBlendMode=function(){if(null!==t)return t.environmentBlendMode};
const Pb=new mb,wd=new mb;this.updateCamera=function(hb){if(null!==t){null!==kb.texture&&(hb.near=kb.depthNear,hb.far=kb.depthFar);Gb.near=Fb.near=Cb.near=hb.near;Gb.far=Fb.far=Cb.far=hb.far;if(Nb!==Gb.near||Rb!==Gb.far)t.updateRenderState({depthNear:Gb.near,depthFar:Gb.far}),Nb=Gb.near,Rb=Gb.far,Cb.near=Nb,Cb.far=Rb,Fb.near=Nb,Fb.far=Rb,Cb.updateProjectionMatrix(),Fb.updateProjectionMatrix(),hb.updateProjectionMatrix();var ib=hb.parent,nb=Gb.cameras;n(Gb,ib);for(var tb=0;tb<nb.length;tb++)n(nb[tb],
ib);if(2===nb.length){Pb.setFromMatrixPosition(Cb.matrixWorld);wd.setFromMatrixPosition(Fb.matrixWorld);nb=Pb.distanceTo(wd);var sb=Cb.projectionMatrix.elements,zb=Fb.projectionMatrix.elements,Jb=sb[14]/(sb[10]-1);tb=sb[14]/(sb[10]+1);const lb=(sb[9]+1)/sb[5],Eb=(sb[9]-1)/sb[5];var Db=(sb[8]-1)/sb[0],yb=(zb[8]+1)/zb[0];zb=Jb*Db;sb=Jb*yb;yb=nb/(-Db+yb);Db=yb*-Db;Cb.matrixWorld.decompose(Gb.position,Gb.quaternion,Gb.scale);Gb.translateX(Db);Gb.translateZ(yb);Gb.matrixWorld.compose(Gb.position,Gb.quaternion,
Gb.scale);Gb.matrixWorldInverse.copy(Gb.matrixWorld).invert();Jb+=yb;yb=tb+yb;Gb.projectionMatrix.makePerspective(zb-Db,sb+(nb-Db),lb*tb/yb*Jb,Eb*tb/yb*Jb,Jb,yb);Gb.projectionMatrixInverse.copy(Gb.projectionMatrix).invert()}else Gb.projectionMatrix.copy(Cb.projectionMatrix);null===ib?hb.matrix.copy(Gb.matrixWorld):(hb.matrix.copy(ib.matrixWorld),hb.matrix.invert(),hb.matrix.multiply(Gb.matrixWorld));hb.matrix.decompose(hb.position,hb.quaternion,hb.scale);hb.updateMatrixWorld(!0);hb.projectionMatrix.copy(Gb.projectionMatrix);
hb.projectionMatrixInverse.copy(Gb.projectionMatrixInverse);hb.isPerspectiveCamera&&(hb.fov=2*Kj*Math.atan(1/hb.projectionMatrix.elements[5]),hb.zoom=1)}};this.getCamera=function(){return Gb};this.getFoveation=function(){if(null!==db||null!==bb)return z};this.setFoveation=function(hb){z=hb;null!==db&&(db.fixedFoveation=hb);null!==bb&&void 0!==bb.fixedFoveation&&(bb.fixedFoveation=hb)};this.hasDepthSensing=function(){return null!==kb.texture};let Yb=null;const Sb=new Uq;Sb.setAnimationLoop(function(hb,
ib){eb=ib.getViewerPose(ab||x);gb=ib;if(null!==eb){var nb=eb.views;null!==bb&&(a.setRenderTargetFramebuffer(pb,bb.framebuffer),a.setRenderTarget(pb));var tb=!1;nb.length!==Gb.cameras.length&&(Gb.cameras.length=0,tb=!0);for(var sb=0;sb<nb.length;sb++){const Jb=nb[sb];let Db;if(null!==bb)Db=bb.getViewport(Jb);else{var zb=cb.getViewSubImage(db,Jb);Db=zb.viewport;0===sb&&(a.setRenderTargetTextures(pb,zb.colorTexture,db.ignoreDepthValues?void 0:zb.depthStencilTexture),a.setRenderTarget(pb))}zb=Ob[sb];
void 0===zb&&(zb=new ff,zb.layers.enable(sb),zb.viewport=new Md,Ob[sb]=zb);zb.matrix.fromArray(Jb.transform.matrix);zb.matrix.decompose(zb.position,zb.quaternion,zb.scale);zb.projectionMatrix.fromArray(Jb.projectionMatrix);zb.projectionMatrixInverse.copy(zb.projectionMatrix).invert();zb.viewport.set(Db.x,Db.y,Db.width,Db.height);0===sb&&(Gb.matrix.copy(zb.matrix),Gb.matrix.decompose(Gb.position,Gb.quaternion,Gb.scale));!0===tb&&Gb.cameras.push(zb)}(tb=t.enabledFeatures)&&tb.includes("depth-sensing")&&
(nb=cb.getDepthInformation(nb[0]))&&nb.isValid&&nb.texture&&kb.init(a,nb,t.renderState)}for(nb=0;nb<ub.length;nb++)tb=rb[nb],sb=ub[nb],null!==tb&&void 0!==sb&&sb.update(tb,ib,ab||x);kb.render(a,Gb);Yb&&Yb(hb,ib);ib.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ib});gb=null});this.setAnimationLoop=function(hb){Yb=hb};this.dispose=function(){}}}const Kf=new Ff,Az=new gd;class Aw{constructor(a={}){function b(jb,vb){jb=kb.getContext(jb,vb);return null!==jb?jb:null}function e(){$d=new hy(Kb);
$d.init();Jf=new dy(Kb,$d,a);dg=new tv(Kb,$d);Gd=new xz(Kb);Ef=new ky(Kb);Ld=new nz;Pd=new yz(Kb,$d,Gd,Ld,Jf,dg,Ef);Xj=new fy(Sb);Yj=new gy(Sb);xk=new Zx(Kb);mj=new by(Kb,xk);tq=new iy(Kb,xk,Ef,mj);Zj=new my(Kb,tq,xk,Ef);Ww=new ly(Kb,Jf,Pd);eg=new ey(Ld);ug=new lz(Sb,Xj,Yj,$d,Jf,mj,eg);uq=new zz(Sb,Ld);vm=new pz;wm=new vz($d);fg=new $x(Sb,Xj,Yj,Gd,Zj,Ob,Ab);Zf=new wz(Sb,Zj,Jf);xm=new Bz(Kb,Ef,Jf,Gd);Xw=new cy(Kb,$d,Ef);Yw=new jy(Kb,$d,Ef);Ef.programs=ug.programs;Sb.capabilities=Jf;Sb.extensions=$d;
Sb.properties=Ld;Sb.renderLists=vm;Sb.shadowMap=Zf;Sb.state=Gd;Sb.info=Ef}function f(jb){jb.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");hb=!0}function h(){console.log("THREE.WebGLRenderer: Context Restored.");hb=!1;const jb=Ef.autoReset,vb=Zf.enabled,Hb=Zf.autoUpdate,Ib=Zf.needsUpdate,xb=Zf.type;e();Ef.autoReset=jb;Zf.enabled=vb;Zf.autoUpdate=Hb;Zf.needsUpdate=Ib;Zf.type=xb}function n(jb){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",jb.statusMessage)}
function r(jb){jb=jb.target;jb.removeEventListener("dispose",r);t(jb);Ld.remove(jb)}function t(jb){const vb=Ld.get(jb).programs;void 0!==vb&&(vb.forEach(function(Hb){ug.releaseProgram(Hb)}),jb.isShaderMaterial&&ug.releaseShaderCache(jb))}function w(jb,vb,Hb){!0===jb.transparent&&2===jb.side&&!1===jb.forceSinglePass?(jb.side=1,jb.needsUpdate=!0,db(jb,vb,Hb),jb.side=0,jb.needsUpdate=!0,db(jb,vb,Hb),jb.side=2):db(jb,vb,Hb)}function x(){nj.stop()}function y(){nj.start()}function z(jb,vb,Hb,Ib){if(!1!==
jb.visible){if(jb.layers.test(vb.layers))if(jb.isGroup)Hb=jb.renderOrder;else if(jb.isLOD)!0===jb.autoUpdate&&jb.update(vb);else if(jb.isLight)Pb.pushLight(jb),jb.castShadow&&Pb.pushShadow(jb);else if(jb.isSprite){if(!jb.frustumCulled||Cf.intersectsSprite(jb)){Ib&&Rf.setFromMatrixPosition(jb.matrixWorld).applyMatrix4(Tg);var xb=Zj.update(jb),Xb=jb.material;Xb.visible&&Rb.push(jb,xb,Xb,Hb,Rf.z,null)}}else if(jb.isMesh||jb.isLine||jb.isPoints)if(!jb.frustumCulled||Cf.intersectsObject(jb))if(xb=Zj.update(jb),
Xb=jb.material,Ib&&(void 0!==jb.boundingSphere?(null===jb.boundingSphere&&jb.computeBoundingSphere(),Rf.copy(jb.boundingSphere.center)):(null===xb.boundingSphere&&xb.computeBoundingSphere(),Rf.copy(xb.boundingSphere.center)),Rf.applyMatrix4(jb.matrixWorld).applyMatrix4(Tg)),Array.isArray(Xb)){const bd=xb.groups;for(let Zb=0,Od=bd.length;Zb<Od;Zb++){const Sd=bd[Zb],xd=Xb[Sd.materialIndex];xd&&xd.visible&&Rb.push(jb,xb,xd,Hb,Rf.z,Sd)}}else Xb.visible&&Rb.push(jb,xb,Xb,Hb,Rf.z,null);jb=jb.children;for(let bd=
0,Zb=jb.length;bd<Zb;bd++)z(jb[bd],vb,Hb,Ib)}}function ab(jb,vb,Hb,Ib){const xb=jb.opaque,Xb=jb.transmissive;jb=jb.transparent;Pb.setupLightsView(Hb);!0===pf&&eg.setGlobalState(Sb.clippingPlanes,Hb);if(0<Xb.length&&null===(!0===vb.isScene?vb.overrideMaterial:null)){null===Pb.state.transmissionRenderTarget&&(Pb.state.transmissionRenderTarget=new Qf(1,1,{generateMipmaps:!0,type:$d.has("EXT_color_buffer_half_float")||$d.has("EXT_color_buffer_float")?1016:1009,minFilter:1008,samples:4,stencilBuffer:pb}),
Ld.get(Pb.state.transmissionRenderTarget).__isTransmissionRenderTarget=!0);var bd=Pb.state.transmissionRenderTarget;Sb.getDrawingBufferSize(Cj);bd.setSize(Cj.x,Cj.y);var Zb=Sb.getRenderTarget();Sb.setRenderTarget(bd);Sb.getClearColor(lb);Eb=Sb.getClearAlpha();1>Eb&&Sb.setClearColor(16777215,.5);Sb.clear();var Od=Sb.toneMapping;Sb.toneMapping=0;eb(xb,vb,Hb);Pd.updateMultisampleRenderTarget(bd);Pd.updateRenderTargetMipmap(bd);var Sd=!1;for(let Id=0,$f=Xb.length;Id<$f;Id++){var xd=Xb[Id];const gg=xd.object,
ag=xd.geometry,Mf=xd.material;xd=xd.group;2===Mf.side&&gg.layers.test(Hb.layers)&&(Sd=Mf.side,Mf.side=1,Mf.needsUpdate=!0,cb(gg,vb,Hb,ag,Mf,xd),Mf.side=Sd,Sd=Mf.needsUpdate=!0)}!0===Sd&&(Pd.updateMultisampleRenderTarget(bd),Pd.updateRenderTargetMipmap(bd));Sb.setRenderTarget(Zb);Sb.setClearColor(lb,Eb);Sb.toneMapping=Od}Ib&&Gd.viewport(Jb.copy(Ib));0<xb.length&&eb(xb,vb,Hb);0<Xb.length&&eb(Xb,vb,Hb);0<jb.length&&eb(jb,vb,Hb);Gd.buffers.depth.setTest(!0);Gd.buffers.depth.setMask(!0);Gd.buffers.color.setMask(!0);
Gd.setPolygonOffset(!1)}function eb(jb,vb,Hb){const Ib=!0===vb.isScene?vb.overrideMaterial:null;for(let Xb=0,bd=jb.length;Xb<bd;Xb++){var xb=jb[Xb];const Zb=xb.object,Od=xb.geometry,Sd=null===Ib?xb.material:Ib;xb=xb.group;Zb.layers.test(Hb.layers)&&cb(Zb,vb,Hb,Od,Sd,xb)}}function cb(jb,vb,Hb,Ib,xb,Xb){jb.onBeforeRender(Sb,vb,Hb,Ib,xb,Xb);jb.modelViewMatrix.multiplyMatrices(Hb.matrixWorldInverse,jb.matrixWorld);jb.normalMatrix.getNormalMatrix(jb.modelViewMatrix);xb.onBeforeRender(Sb,vb,Hb,Ib,jb,Xb);
!0===xb.transparent&&2===xb.side&&!1===xb.forceSinglePass?(xb.side=1,xb.needsUpdate=!0,Sb.renderBufferDirect(Hb,vb,Ib,xb,jb,Xb),xb.side=0,xb.needsUpdate=!0,Sb.renderBufferDirect(Hb,vb,Ib,xb,jb,Xb),xb.side=2):Sb.renderBufferDirect(Hb,vb,Ib,xb,jb,Xb);jb.onAfterRender(Sb,vb,Hb,Ib,xb,Xb)}function db(jb,vb,Hb){!0!==vb.isScene&&(vb=Dj);const Ib=Ld.get(jb),xb=Pb.state.lights,Xb=xb.state.version,bd=ug.getParameters(jb,xb.state,Pb.state.shadowsArray,vb,Hb),Zb=ug.getProgramCacheKey(bd);let Od=Ib.programs;Ib.environment=
jb.isMeshStandardMaterial?vb.environment:null;Ib.fog=vb.fog;Ib.envMap=(jb.isMeshStandardMaterial?Yj:Xj).get(jb.envMap||Ib.environment);Ib.envMapRotation=null!==Ib.environment&&null===jb.envMap?vb.environmentRotation:jb.envMapRotation;void 0===Od&&(jb.addEventListener("dispose",r),Od=new Map,Ib.programs=Od);vb=Od.get(Zb);if(void 0!==vb){if(Ib.currentProgram===vb&&Ib.lightsStateVersion===Xb)return gb(jb,bd),vb}else bd.uniforms=ug.getUniforms(jb),jb.onBuild(Hb,bd,Sb),jb.onBeforeCompile(bd,Sb),vb=ug.acquireProgram(bd,
Zb),Od.set(Zb,vb),Ib.uniforms=bd.uniforms;Hb=Ib.uniforms;if(!jb.isShaderMaterial&&!jb.isRawShaderMaterial||!0===jb.clipping)Hb.clippingPlanes=eg.uniform;gb(jb,bd);Ib.needsLights=jb.isMeshLambertMaterial||jb.isMeshToonMaterial||jb.isMeshPhongMaterial||jb.isMeshStandardMaterial||jb.isShadowMaterial||jb.isShaderMaterial&&!0===jb.lights;Ib.lightsStateVersion=Xb;Ib.needsLights&&(Hb.ambientLightColor.value=xb.state.ambient,Hb.lightProbe.value=xb.state.probe,Hb.directionalLights.value=xb.state.directional,
Hb.directionalLightShadows.value=xb.state.directionalShadow,Hb.spotLights.value=xb.state.spot,Hb.spotLightShadows.value=xb.state.spotShadow,Hb.rectAreaLights.value=xb.state.rectArea,Hb.ltc_1.value=xb.state.rectAreaLTC1,Hb.ltc_2.value=xb.state.rectAreaLTC2,Hb.pointLights.value=xb.state.point,Hb.pointLightShadows.value=xb.state.pointShadow,Hb.hemisphereLights.value=xb.state.hemi,Hb.directionalShadowMap.value=xb.state.directionalShadowMap,Hb.directionalShadowMatrix.value=xb.state.directionalShadowMatrix,
Hb.spotShadowMap.value=xb.state.spotShadowMap,Hb.spotLightMatrix.value=xb.state.spotLightMatrix,Hb.spotLightMap.value=xb.state.spotLightMap,Hb.pointShadowMap.value=xb.state.pointShadowMap,Hb.pointShadowMatrix.value=xb.state.pointShadowMatrix);Ib.currentProgram=vb;Ib.uniformsList=null;return vb}function bb(jb){if(null===jb.uniformsList){const vb=jb.currentProgram.getUniforms();jb.uniformsList=Rk.seqWithValue(vb.seq,jb.uniforms)}return jb.uniformsList}function gb(jb,vb){jb=Ld.get(jb);jb.outputColorSpace=
vb.outputColorSpace;jb.batching=vb.batching;jb.instancing=vb.instancing;jb.instancingColor=vb.instancingColor;jb.instancingMorph=vb.instancingMorph;jb.skinning=vb.skinning;jb.morphTargets=vb.morphTargets;jb.morphNormals=vb.morphNormals;jb.morphColors=vb.morphColors;jb.morphTargetsCount=vb.morphTargetsCount;jb.numClippingPlanes=vb.numClippingPlanes;jb.numIntersection=vb.numClipIntersection;jb.vertexAlphas=vb.vertexAlphas;jb.vertexTangents=vb.vertexTangents;jb.toneMapping=vb.toneMapping}const {canvas:kb=
Oq(),context:qb=null,depth:ob=!0,stencil:pb=!1,alpha:ub=!1,antialias:rb=!1,premultipliedAlpha:Ab=!0,preserveDrawingBuffer:wb=!1,powerPreference:Cb="default",failIfMajorPerformanceCaveat:Fb=!1}=a;this.isWebGLRenderer=!0;let Ob;if(null!==qb){if("undefined"!==typeof WebGLRenderingContext&&qb instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");Ob=qb.getContextAttributes().alpha}else Ob=ub;const Gb=new Uint32Array(4),Nb=new Int32Array(4);let Rb=null,
Pb=null;const wd=[],Yb=[];this.domElement=kb;this.debug={checkShaderErrors:!0,onShaderError:null};this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this._outputColorSpace="srgb";this._useLegacyLights=!1;this.toneMapping=0;this.toneMappingExposure=1;const Sb=this;let hb=!1,ib=0,nb=0,tb=null,sb=-1,zb=null;const Jb=new Md,Db=new Md;let yb=null;const lb=new Tb(0);let Eb=0,Bb=kb.width,Qb=kb.height,Mb=1,Wb=
null,Dd=null;const Td=new Md(0,0,Bb,Qb),hf=new Md(0,0,Bb,Qb);let Jd=!1;const Cf=new hk;let pf=!1,Bj=!1;const Tg=new gd,Cj=new Lb,Rf=new mb,Dj={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Kb=qb;try{const jb={alpha:!0,depth:ob,stencil:pb,antialias:rb,premultipliedAlpha:Ab,preserveDrawingBuffer:wb,powerPreference:Cb,failIfMajorPerformanceCaveat:Fb};"setAttribute"in kb&&kb.setAttribute("data-engine","three.js r163");kb.addEventListener("webglcontextlost",f,!1);kb.addEventListener("webglcontextrestored",
h,!1);kb.addEventListener("webglcontextcreationerror",n,!1);if(null===Kb&&(Kb=b("webgl2",jb),null===Kb)){if(b("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.");}}catch(jb){throw console.error("THREE.WebGLRenderer: "+jb.message),jb;}let $d,Jf,Gd,Ef,Ld,Pd,Xj,Yj,xk,tq,Zj,ug,uq,vm,wm,eg,Zf,fg,Ww,Xw,Yw,dg,mj,xm;e();const tf=new iB(Sb,Kb);this.xr=tf;this.getContext=function(){return Kb};this.getContextAttributes=function(){return Kb.getContextAttributes()};
this.forceContextLoss=function(){const jb=$d.get("WEBGL_lose_context");jb&&jb.loseContext()};this.forceContextRestore=function(){const jb=$d.get("WEBGL_lose_context");jb&&jb.restoreContext()};this.getPixelRatio=function(){return Mb};this.setPixelRatio=function(jb){void 0!==jb&&(Mb=jb,this.setSize(Bb,Qb,!1))};this.getSize=function(jb){return jb.set(Bb,Qb)};this.setSize=function(jb,vb,Hb=!0){tf.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Bb=jb,
Qb=vb,kb.width=Math.floor(jb*Mb),kb.height=Math.floor(vb*Mb),!0===Hb&&(kb.style.width=jb+"px",kb.style.height=vb+"px"),this.setViewport(0,0,jb,vb))};this.getDrawingBufferSize=function(jb){return jb.set(Bb*Mb,Qb*Mb).floor()};this.setDrawingBufferSize=function(jb,vb,Hb){Bb=jb;Qb=vb;Mb=Hb;kb.width=Math.floor(jb*Hb);kb.height=Math.floor(vb*Hb);this.setViewport(0,0,jb,vb)};this.getCurrentViewport=function(jb){return jb.copy(Jb)};this.getViewport=function(jb){return jb.copy(Td)};this.setViewport=function(jb,
vb,Hb,Ib){jb.isVector4?Td.set(jb.x,jb.y,jb.z,jb.w):Td.set(jb,vb,Hb,Ib);Gd.viewport(Jb.copy(Td).multiplyScalar(Mb).round())};this.getScissor=function(jb){return jb.copy(hf)};this.setScissor=function(jb,vb,Hb,Ib){jb.isVector4?hf.set(jb.x,jb.y,jb.z,jb.w):hf.set(jb,vb,Hb,Ib);Gd.scissor(Db.copy(hf).multiplyScalar(Mb).round())};this.getScissorTest=function(){return Jd};this.setScissorTest=function(jb){Gd.setScissorTest(Jd=jb)};this.setOpaqueSort=function(jb){Wb=jb};this.setTransparentSort=function(jb){Dd=
jb};this.getClearColor=function(jb){return jb.copy(fg.getClearColor())};this.setClearColor=function(){fg.setClearColor.apply(fg,arguments)};this.getClearAlpha=function(){return fg.getClearAlpha()};this.setClearAlpha=function(){fg.setClearAlpha.apply(fg,arguments)};this.clear=function(jb=!0,vb=!0,Hb=!0){let Ib=0;if(jb)if(jb=!1,null!==tb&&(jb=tb.texture.format,jb=1033===jb||1031===jb||1029===jb),jb){jb=tb.texture.type;jb=1009===jb||1014===jb||1012===jb||1020===jb||1017===jb||1018===jb;var xb=fg.getClearColor();
const Xb=fg.getClearAlpha(),bd=xb.r,Zb=xb.g;xb=xb.b;jb?(Gb[0]=bd,Gb[1]=Zb,Gb[2]=xb,Gb[3]=Xb,Kb.clearBufferuiv(Kb.COLOR,0,Gb)):(Nb[0]=bd,Nb[1]=Zb,Nb[2]=xb,Nb[3]=Xb,Kb.clearBufferiv(Kb.COLOR,0,Nb))}else Ib|=Kb.COLOR_BUFFER_BIT;vb&&(Ib|=Kb.DEPTH_BUFFER_BIT);Hb&&(Ib|=Kb.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295));Kb.clear(Ib)};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(){kb.removeEventListener("webglcontextlost",f,!1);kb.removeEventListener("webglcontextrestored",h,!1);kb.removeEventListener("webglcontextcreationerror",n,!1);vm.dispose();wm.dispose();Ld.dispose();Xj.dispose();Yj.dispose();Zj.dispose();mj.dispose();xm.dispose();ug.dispose();tf.dispose();tf.removeEventListener("sessionstart",x);tf.removeEventListener("sessionend",y);nj.stop()};this.renderBufferDirect=function(jb,vb,Hb,Ib,xb,Xb){null===vb&&(vb=Dj);var bd=xb.isMesh&&0>xb.matrixWorld.determinant(),
Zb=vb;!0!==Zb.isScene&&(Zb=Dj);Pd.resetTextureUnits();vb=Zb.fog;var Od=Ib.isMeshStandardMaterial?Zb.environment:null,Sd=null===tb?Sb.outputColorSpace:!0===tb.isXRRenderTarget?tb.texture.colorSpace:"srgb-linear";Od=(Ib.isMeshStandardMaterial?Yj:Xj).get(Ib.envMap||Od);var xd=!0===Ib.vertexColors&&!!Hb.attributes.color&&4===Hb.attributes.color.itemSize,Id=!!Hb.attributes.tangent&&(!!Ib.normalMap||0<Ib.anisotropy),$f=!!Hb.morphAttributes.position,gg=!!Hb.morphAttributes.normal,ag=!!Hb.morphAttributes.color;
let Mf=0;!Ib.toneMapped||null!==tb&&!0!==tb.isXRRenderTarget||(Mf=Sb.toneMapping);var id=Hb.morphAttributes.position||Hb.morphAttributes.normal||Hb.morphAttributes.color;const jB=void 0!==id?id.length:0;id=Ld.get(Ib);const kB=Pb.state.lights;!0!==pf||!0!==Bj&&jb===zb||eg.setState(Ib,jb,jb===zb&&Ib.id===sb);let Ud=!1;Ib.version===id.__version?id.needsLights&&id.lightsStateVersion!==kB.state.version?Ud=!0:id.outputColorSpace!==Sd?Ud=!0:xb.isBatchedMesh&&!1===id.batching?Ud=!0:xb.isBatchedMesh||!0!==
id.batching?xb.isInstancedMesh&&!1===id.instancing?Ud=!0:xb.isInstancedMesh||!0!==id.instancing?xb.isSkinnedMesh&&!1===id.skinning?Ud=!0:xb.isSkinnedMesh||!0!==id.skinning?xb.isInstancedMesh&&!0===id.instancingColor&&null===xb.instanceColor?Ud=!0:xb.isInstancedMesh&&!1===id.instancingColor&&null!==xb.instanceColor?Ud=!0:xb.isInstancedMesh&&!0===id.instancingMorph&&null===xb.morphTexture?Ud=!0:xb.isInstancedMesh&&!1===id.instancingMorph&&null!==xb.morphTexture?Ud=!0:id.envMap!==Od?Ud=!0:!0===Ib.fog&&
id.fog!==vb?Ud=!0:void 0===id.numClippingPlanes||id.numClippingPlanes===eg.numPlanes&&id.numIntersection===eg.numIntersection?id.vertexAlphas!==xd?Ud=!0:id.vertexTangents!==Id?Ud=!0:id.morphTargets!==$f?Ud=!0:id.morphNormals!==gg?Ud=!0:id.morphColors!==ag?Ud=!0:id.toneMapping!==Mf?Ud=!0:id.morphTargetsCount!==jB&&(Ud=!0):Ud=!0:Ud=!0:Ud=!0:Ud=!0:(Ud=!0,id.__version=Ib.version);Sd=id.currentProgram;!0===Ud&&(Sd=db(Ib,Zb,xb));gg=$f=ag=!1;xd=Sd.getUniforms();Id=id.uniforms;Gd.useProgram(Sd.program)&&
(gg=$f=ag=!0);Ib.id!==sb&&(sb=Ib.id,$f=!0);if(ag||zb!==jb)xd.setValue(Kb,"projectionMatrix",jb.projectionMatrix),xd.setValue(Kb,"viewMatrix",jb.matrixWorldInverse),ag=xd.map.cameraPosition,void 0!==ag&&ag.setValue(Kb,Rf.setFromMatrixPosition(jb.matrixWorld)),Jf.logarithmicDepthBuffer&&xd.setValue(Kb,"logDepthBufFC",2/(Math.log(jb.far+1)/Math.LN2)),(Ib.isMeshPhongMaterial||Ib.isMeshToonMaterial||Ib.isMeshLambertMaterial||Ib.isMeshBasicMaterial||Ib.isMeshStandardMaterial||Ib.isShaderMaterial)&&xd.setValue(Kb,
"isOrthographic",!0===jb.isOrthographicCamera),zb!==jb&&(zb=jb,gg=$f=!0);xb.isSkinnedMesh&&(xd.setOptional(Kb,xb,"bindMatrix"),xd.setOptional(Kb,xb,"bindMatrixInverse"),jb=xb.skeleton)&&(null===jb.boneTexture&&jb.computeBoneTexture(),xd.setValue(Kb,"boneTexture",jb.boneTexture,Pd));xb.isBatchedMesh&&(xd.setOptional(Kb,xb,"batchingTexture"),xd.setValue(Kb,"batchingTexture",xb._matricesTexture,Pd));jb=Hb.morphAttributes;void 0===jb.position&&void 0===jb.normal&&void 0===jb.color||Ww.update(xb,Hb,Sd);
if($f||id.receiveShadow!==xb.receiveShadow)id.receiveShadow=xb.receiveShadow,xd.setValue(Kb,"receiveShadow",xb.receiveShadow);Ib.isMeshGouraudMaterial&&null!==Ib.envMap&&(Id.envMap.value=Od,Id.flipEnvMap.value=Od.isCubeTexture&&!1===Od.isRenderTargetTexture?-1:1);Ib.isMeshStandardMaterial&&null===Ib.envMap&&null!==Zb.environment&&(Id.envMapIntensity.value=Zb.environmentIntensity);$f&&(xd.setValue(Kb,"toneMappingExposure",Sb.toneMappingExposure),id.needsLights&&(Zb=gg,Id.ambientLightColor.needsUpdate=
Zb,Id.lightProbe.needsUpdate=Zb,Id.directionalLights.needsUpdate=Zb,Id.directionalLightShadows.needsUpdate=Zb,Id.pointLights.needsUpdate=Zb,Id.pointLightShadows.needsUpdate=Zb,Id.spotLights.needsUpdate=Zb,Id.spotLightShadows.needsUpdate=Zb,Id.rectAreaLights.needsUpdate=Zb,Id.hemisphereLights.needsUpdate=Zb),vb&&!0===Ib.fog&&uq.refreshFogUniforms(Id,vb),uq.refreshMaterialUniforms(Id,Ib,Mb,Qb,Pb.state.transmissionRenderTarget),Rk.upload(Kb,bb(id),Id,Pd));Ib.isShaderMaterial&&!0===Ib.uniformsNeedUpdate&&
(Rk.upload(Kb,bb(id),Id,Pd),Ib.uniformsNeedUpdate=!1);Ib.isSpriteMaterial&&xd.setValue(Kb,"center",xb.center);xd.setValue(Kb,"modelViewMatrix",xb.modelViewMatrix);xd.setValue(Kb,"normalMatrix",xb.normalMatrix);xd.setValue(Kb,"modelMatrix",xb.matrixWorld);if(Ib.isShaderMaterial||Ib.isRawShaderMaterial){vb=Ib.uniformsGroups;for(let vq=0,lB=vb.length;vq<lB;vq++)Zb=vb[vq],xm.update(Zb,Sd),xm.bind(Zb,Sd)}vb=Sd;Gd.setMaterial(Ib,bd);Zb=Hb.index;jb=1;if(!0===Ib.wireframe){Zb=tq.getWireframeAttribute(Hb);
if(void 0===Zb)return;jb=2}id=Hb.drawRange;Od=Hb.attributes.position;bd=id.start*jb;id=(id.start+id.count)*jb;null!==Xb&&(bd=Math.max(bd,Xb.start*jb),id=Math.min(id,(Xb.start+Xb.count)*jb));null!==Zb?(bd=Math.max(bd,0),id=Math.min(id,Zb.count)):void 0!==Od&&null!==Od&&(bd=Math.max(bd,0),id=Math.min(id,Od.count));Xb=id-bd;0>Xb||Infinity===Xb||(mj.setup(xb,Ib,vb,Hb,Zb),vb=Xw,null!==Zb&&(Zb=xk.get(Zb),vb=Yw,vb.setIndex(Zb)),xb.isMesh?!0===Ib.wireframe?(Gd.setLineWidth(Ib.wireframeLinewidth*(null===tb?
Mb:1)),vb.setMode(Kb.LINES)):vb.setMode(Kb.TRIANGLES):xb.isLine?(Ib=Ib.linewidth,void 0===Ib&&(Ib=1),Gd.setLineWidth(Ib*(null===tb?Mb:1)),xb.isLineSegments?vb.setMode(Kb.LINES):xb.isLineLoop?vb.setMode(Kb.LINE_LOOP):vb.setMode(Kb.LINE_STRIP)):xb.isPoints?vb.setMode(Kb.POINTS):xb.isSprite&&vb.setMode(Kb.TRIANGLES),xb.isBatchedMesh?vb.renderMultiDraw(xb._multiDrawStarts,xb._multiDrawCounts,xb._multiDrawCount):xb.isInstancedMesh?vb.renderInstances(bd,Xb,xb.count):Hb.isInstancedBufferGeometry?vb.renderInstances(bd,
Xb,Math.min(Hb.instanceCount,void 0!==Hb._maxInstanceCount?Hb._maxInstanceCount:Infinity)):vb.render(bd,Xb))};this.compile=function(jb,vb,Hb=null){null===Hb&&(Hb=jb);Pb=wm.get(Hb);Pb.init();Yb.push(Pb);Hb.traverseVisible(function(xb){xb.isLight&&xb.layers.test(vb.layers)&&(Pb.pushLight(xb),xb.castShadow&&Pb.pushShadow(xb))});jb!==Hb&&jb.traverseVisible(function(xb){xb.isLight&&xb.layers.test(vb.layers)&&(Pb.pushLight(xb),xb.castShadow&&Pb.pushShadow(xb))});Pb.setupLights(Sb._useLegacyLights);const Ib=
new Set;jb.traverse(function(xb){const Xb=xb.material;if(Xb)if(Array.isArray(Xb))for(let bd=0;bd<Xb.length;bd++){const Zb=Xb[bd];w(Zb,Hb,xb);Ib.add(Zb)}else w(Xb,Hb,xb),Ib.add(Xb)});Yb.pop();Pb=null;return Ib};this.compileAsync=function(jb,vb,Hb=null){const Ib=this.compile(jb,vb,Hb);return new Promise(xb=>{function Xb(){Ib.forEach(function(bd){Ld.get(bd).currentProgram.isReady()&&Ib.delete(bd)});0===Ib.size?xb(jb):setTimeout(Xb,10)}null!==$d.get("KHR_parallel_shader_compile")?Xb():setTimeout(Xb,10)})};
let wq=null;const nj=new Uq;nj.setAnimationLoop(function(jb){wq&&wq(jb)});"undefined"!==typeof self&&nj.setContext(self);this.setAnimationLoop=function(jb){wq=jb;tf.setAnimationLoop(jb);null===jb?nj.stop():nj.start()};tf.addEventListener("sessionstart",x);tf.addEventListener("sessionend",y);this.render=function(jb,vb){if(void 0!==vb&&!0!==vb.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else if(!0!==hb){!0===jb.matrixWorldAutoUpdate&&jb.updateMatrixWorld();
null===vb.parent&&!0===vb.matrixWorldAutoUpdate&&vb.updateMatrixWorld();!0===tf.enabled&&!0===tf.isPresenting&&(!0===tf.cameraAutoUpdate&&tf.updateCamera(vb),vb=tf.getCamera());if(!0===jb.isScene)jb.onBeforeRender(Sb,jb,vb,tb);Pb=wm.get(jb,Yb.length);Pb.init();Yb.push(Pb);Tg.multiplyMatrices(vb.projectionMatrix,vb.matrixWorldInverse);Cf.setFromProjectionMatrix(Tg);Bj=this.localClippingEnabled;pf=eg.init(this.clippingPlanes,Bj);Rb=vm.get(jb,wd.length);Rb.init();wd.push(Rb);z(jb,vb,0,Sb.sortObjects);
Rb.finish();!0===Sb.sortObjects&&Rb.sort(Wb,Dd);this.info.render.frame++;!0===pf&&eg.beginShadows();Zf.render(Pb.state.shadowsArray,jb,vb);!0===pf&&eg.endShadows();!0===this.info.autoReset&&this.info.reset();!1!==tf.enabled&&!1!==tf.isPresenting&&!1!==tf.hasDepthSensing()||fg.render(Rb,jb);Pb.setupLights(Sb._useLegacyLights);if(vb.isArrayCamera){const Hb=vb.cameras;for(let Ib=0,xb=Hb.length;Ib<xb;Ib++){const Xb=Hb[Ib];ab(Rb,jb,Xb,Xb.viewport)}}else ab(Rb,jb,vb);null!==tb&&(Pd.updateMultisampleRenderTarget(tb),
Pd.updateRenderTargetMipmap(tb));if(!0===jb.isScene)jb.onAfterRender(Sb,jb,vb);mj.resetDefaultState();sb=-1;zb=null;Yb.pop();Pb=0<Yb.length?Yb[Yb.length-1]:null;wd.pop();Rb=0<wd.length?wd[wd.length-1]:null}};this.getActiveCubeFace=function(){return ib};this.getActiveMipmapLevel=function(){return nb};this.getRenderTarget=function(){return tb};this.setRenderTargetTextures=function(jb,vb,Hb){Ld.get(jb.texture).__webglTexture=vb;Ld.get(jb.depthTexture).__webglTexture=Hb;jb=Ld.get(jb);jb.__hasExternalTextures=
!0;jb.__autoAllocateDepthBuffer=void 0===Hb;jb.__autoAllocateDepthBuffer||!0!==$d.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),jb.__useRenderToTexture=!1)};this.setRenderTargetFramebuffer=function(jb,vb){jb=Ld.get(jb);jb.__webglFramebuffer=vb;jb.__useDefaultFramebuffer=void 0===vb};this.setRenderTarget=function(jb,vb=0,Hb=0){tb=jb;ib=vb;nb=Hb;let Ib=!0;var xb=null;let Xb=!1,bd=!1;
if(jb){xb=Ld.get(jb);void 0!==xb.__useDefaultFramebuffer?(Gd.bindFramebuffer(Kb.FRAMEBUFFER,null),Ib=!1):void 0===xb.__webglFramebuffer?Pd.setupRenderTarget(jb):xb.__hasExternalTextures&&Pd.rebindTextures(jb,Ld.get(jb.texture).__webglTexture,Ld.get(jb.depthTexture).__webglTexture);xb=jb.texture;if(xb.isData3DTexture||xb.isDataArrayTexture||xb.isCompressedArrayTexture)bd=!0;xb=Ld.get(jb).__webglFramebuffer;jb.isWebGLCubeRenderTarget?(xb=Array.isArray(xb[vb])?xb[vb][Hb]:xb[vb],Xb=!0):xb=0<jb.samples&&
!1===Pd.useMultisampledRTT(jb)?Ld.get(jb).__webglMultisampledFramebuffer:Array.isArray(xb)?xb[Hb]:xb;Jb.copy(jb.viewport);Db.copy(jb.scissor);yb=jb.scissorTest}else Jb.copy(Td).multiplyScalar(Mb).floor(),Db.copy(hf).multiplyScalar(Mb).floor(),yb=Jd;Gd.bindFramebuffer(Kb.FRAMEBUFFER,xb)&&Ib&&Gd.drawBuffers(jb,xb);Gd.viewport(Jb);Gd.scissor(Db);Gd.setScissorTest(yb);Xb?(jb=Ld.get(jb.texture),Kb.framebufferTexture2D(Kb.FRAMEBUFFER,Kb.COLOR_ATTACHMENT0,Kb.TEXTURE_CUBE_MAP_POSITIVE_X+vb,jb.__webglTexture,
Hb)):bd&&(jb=Ld.get(jb.texture),Kb.framebufferTextureLayer(Kb.FRAMEBUFFER,Kb.COLOR_ATTACHMENT0,jb.__webglTexture,Hb||0,vb||0));sb=-1};this.readRenderTargetPixels=function(jb,vb,Hb,Ib,xb,Xb,bd){if(jb&&jb.isWebGLRenderTarget){var Zb=Ld.get(jb).__webglFramebuffer;jb.isWebGLCubeRenderTarget&&void 0!==bd&&(Zb=Zb[bd]);if(Zb){Gd.bindFramebuffer(Kb.FRAMEBUFFER,Zb);try{const Sd=jb.texture,xd=Sd.format,Id=Sd.type;if(1023!==xd&&dg.convert(xd)!==Kb.getParameter(Kb.IMPLEMENTATION_COLOR_READ_FORMAT))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
else{var Od=1016===Id&&($d.has("EXT_color_buffer_half_float")||$d.has("EXT_color_buffer_float"));1009===Id||dg.convert(Id)===Kb.getParameter(Kb.IMPLEMENTATION_COLOR_READ_TYPE)||1015===Id||Od?0<=vb&&vb<=jb.width-Ib&&0<=Hb&&Hb<=jb.height-xb&&Kb.readPixels(vb,Hb,Ib,xb,dg.convert(xd),dg.convert(Id),Xb):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}}finally{jb=null!==tb?Ld.get(tb).__webglFramebuffer:null,Gd.bindFramebuffer(Kb.FRAMEBUFFER,
jb)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(jb,vb,Hb=0){var Ib=Math.pow(2,-Hb);const xb=Math.floor(vb.image.width*Ib);Ib=Math.floor(vb.image.height*Ib);Pd.setTexture2D(vb,0);Kb.copyTexSubImage2D(Kb.TEXTURE_2D,Hb,0,0,jb.x,jb.y,xb,Ib);Gd.unbindTexture()};this.copyTextureToTexture=function(jb,vb,Hb,Ib=0){const xb=vb.image.width,Xb=vb.image.height,bd=dg.convert(Hb.format),Zb=dg.convert(Hb.type);
Pd.setTexture2D(Hb,0);Kb.pixelStorei(Kb.UNPACK_FLIP_Y_WEBGL,Hb.flipY);Kb.pixelStorei(Kb.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Hb.premultiplyAlpha);Kb.pixelStorei(Kb.UNPACK_ALIGNMENT,Hb.unpackAlignment);vb.isDataTexture?Kb.texSubImage2D(Kb.TEXTURE_2D,Ib,jb.x,jb.y,xb,Xb,bd,Zb,vb.image.data):vb.isCompressedTexture?Kb.compressedTexSubImage2D(Kb.TEXTURE_2D,Ib,jb.x,jb.y,vb.mipmaps[0].width,vb.mipmaps[0].height,bd,vb.mipmaps[0].data):Kb.texSubImage2D(Kb.TEXTURE_2D,Ib,jb.x,jb.y,bd,Zb,vb.image);0===Ib&&Hb.generateMipmaps&&
Kb.generateMipmap(Kb.TEXTURE_2D);Gd.unbindTexture()};this.copyTextureToTexture3D=function(jb,vb,Hb,Ib,xb=0){const Xb=Math.round(jb.max.x-jb.min.x),bd=Math.round(jb.max.y-jb.min.y),Zb=jb.max.z-jb.min.z+1,Od=dg.convert(Ib.format),Sd=dg.convert(Ib.type);let xd;if(Ib.isData3DTexture)Pd.setTexture3D(Ib,0),xd=Kb.TEXTURE_3D;else if(Ib.isDataArrayTexture||Ib.isCompressedArrayTexture)Pd.setTexture2DArray(Ib,0),xd=Kb.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");
return}Kb.pixelStorei(Kb.UNPACK_FLIP_Y_WEBGL,Ib.flipY);Kb.pixelStorei(Kb.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ib.premultiplyAlpha);Kb.pixelStorei(Kb.UNPACK_ALIGNMENT,Ib.unpackAlignment);const Id=Kb.getParameter(Kb.UNPACK_ROW_LENGTH),$f=Kb.getParameter(Kb.UNPACK_IMAGE_HEIGHT),gg=Kb.getParameter(Kb.UNPACK_SKIP_PIXELS),ag=Kb.getParameter(Kb.UNPACK_SKIP_ROWS),Mf=Kb.getParameter(Kb.UNPACK_SKIP_IMAGES),id=Hb.isCompressedTexture?Hb.mipmaps[xb]:Hb.image;Kb.pixelStorei(Kb.UNPACK_ROW_LENGTH,id.width);Kb.pixelStorei(Kb.UNPACK_IMAGE_HEIGHT,
id.height);Kb.pixelStorei(Kb.UNPACK_SKIP_PIXELS,jb.min.x);Kb.pixelStorei(Kb.UNPACK_SKIP_ROWS,jb.min.y);Kb.pixelStorei(Kb.UNPACK_SKIP_IMAGES,jb.min.z);Hb.isDataTexture||Hb.isData3DTexture?Kb.texSubImage3D(xd,xb,vb.x,vb.y,vb.z,Xb,bd,Zb,Od,Sd,id.data):Ib.isCompressedArrayTexture?Kb.compressedTexSubImage3D(xd,xb,vb.x,vb.y,vb.z,Xb,bd,Zb,Od,id.data):Kb.texSubImage3D(xd,xb,vb.x,vb.y,vb.z,Xb,bd,Zb,Od,Sd,id);Kb.pixelStorei(Kb.UNPACK_ROW_LENGTH,Id);Kb.pixelStorei(Kb.UNPACK_IMAGE_HEIGHT,$f);Kb.pixelStorei(Kb.UNPACK_SKIP_PIXELS,
gg);Kb.pixelStorei(Kb.UNPACK_SKIP_ROWS,ag);Kb.pixelStorei(Kb.UNPACK_SKIP_IMAGES,Mf);0===xb&&Ib.generateMipmaps&&Kb.generateMipmap(xd);Gd.unbindTexture()};this.initTexture=function(jb){jb.isCubeTexture?Pd.setTextureCube(jb,0):jb.isData3DTexture?Pd.setTexture3D(jb,0):jb.isDataArrayTexture||jb.isCompressedArrayTexture?Pd.setTexture2DArray(jb,0):Pd.setTexture2D(jb,0);Gd.unbindTexture()};this.resetState=function(){nb=ib=0;tb=null;Gd.reset();mj.reset()};"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",
{detail:this}))}get coordinateSystem(){return 2E3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(a){this._outputColorSpace=a;const b=this.getContext();b.drawingBufferColorSpace="display-p3"===a?"display-p3":"srgb";b.unpackColorSpace="display-p3-linear"===Fd.workingColorSpace?"display-p3":"srgb"}get useLegacyLights(){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.");
return this._useLegacyLights}set useLegacyLights(a){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.");this._useLegacyLights=a}}class Cp{constructor(a,b=2.5E-4){this.isFogExp2=!0;this.name="";this.color=new Tb(a);this.density=b}clone(){return new Cp(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),
density:this.density}}}class Bp{constructor(a,b=1,e=1E3){this.isFog=!0;this.name="";this.color=new Tb(a);this.near=b;this.far=e}clone(){return new Bp(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Pp extends Cd{constructor(){super();this.isScene=!0;this.type="Scene";this.fog=this.environment=this.background=null;this.backgroundBlurriness=0;this.backgroundIntensity=1;this.backgroundRotation=new Ff;this.environmentIntensity=
1;this.environmentRotation=new Ff;this.overrideMaterial=null;"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(a,b){super.copy(a,b);null!==a.background&&(this.background=a.background.clone());null!==a.environment&&(this.environment=a.environment.clone());null!==a.fog&&(this.fog=a.fog.clone());this.backgroundBlurriness=a.backgroundBlurriness;this.backgroundIntensity=a.backgroundIntensity;this.backgroundRotation.copy(a.backgroundRotation);
this.environmentIntensity=a.environmentIntensity;this.environmentRotation.copy(a.environmentRotation);null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.matrixAutoUpdate=a.matrixAutoUpdate;return this}toJSON(a){a=super.toJSON(a);null!==this.fog&&(a.object.fog=this.fog.toJSON());0<this.backgroundBlurriness&&(a.object.backgroundBlurriness=this.backgroundBlurriness);1!==this.backgroundIntensity&&(a.object.backgroundIntensity=this.backgroundIntensity);a.object.backgroundRotation=
this.backgroundRotation.toArray();1!==this.environmentIntensity&&(a.object.environmentIntensity=this.environmentIntensity);a.object.environmentRotation=this.environmentRotation.toArray();return a}}class qk{constructor(a,b){this.isInterleavedBuffer=!0;this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.usage=35044;this._updateRange={offset:0,count:-1};this.updateRanges=[];this.version=0;this.uuid=fd()}onUploadCallback(){}set needsUpdate(a){!0===a&&this.version++}setUsage(a){this.usage=
a;return this}addUpdateRange(a,b){this.updateRanges.push({start:a,count:b})}clearUpdateRanges(){this.updateRanges.length=0}copy(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.usage=a.usage;return this}copyAt(a,b,e){a*=this.stride;e*=b.stride;for(let f=0,h=this.stride;f<h;f++)this.array[a+f]=b.array[e+f];return this}set(a,b=0){this.array.set(a,b);return this}clone(a){void 0===a.arrayBuffers&&(a.arrayBuffers={});void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=
fd());void 0===a.arrayBuffers[this.array.buffer._uuid]&&(a.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);a=new this.array.constructor(a.arrayBuffers[this.array.buffer._uuid]);a=new this.constructor(a,this.stride);a.setUsage(this.usage);return a}onUpload(a){this.onUploadCallback=a;return this}toJSON(a){void 0===a.arrayBuffers&&(a.arrayBuffers={});void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=fd());void 0===a.arrayBuffers[this.array.buffer._uuid]&&(a.arrayBuffers[this.array.buffer._uuid]=
Array.from(new Uint32Array(this.array.buffer)));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Af=new mb;class bj{constructor(a,b,e,f=!1){this.isInterleavedBufferAttribute=!0;this.name="";this.data=a;this.itemSize=b;this.offset=e;this.normalized=f}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(a){this.data.needsUpdate=a}applyMatrix4(a){for(let b=0,e=this.data.count;b<e;b++)Af.fromBufferAttribute(this,
b),Af.applyMatrix4(a),this.setXYZ(b,Af.x,Af.y,Af.z);return this}applyNormalMatrix(a){for(let b=0,e=this.count;b<e;b++)Af.fromBufferAttribute(this,b),Af.applyNormalMatrix(a),this.setXYZ(b,Af.x,Af.y,Af.z);return this}transformDirection(a){for(let b=0,e=this.count;b<e;b++)Af.fromBufferAttribute(this,b),Af.transformDirection(a),this.setXYZ(b,Af.x,Af.y,Af.z);return this}getComponent(a,b){a=this.array[a*this.data.stride+this.offset+b];this.normalized&&(a=wf(a,this.array));return a}setComponent(a,b,e){this.normalized&&
(e=kd(e,this.array));this.data.array[a*this.data.stride+this.offset+b]=e;return this}setX(a,b){this.normalized&&(b=kd(b,this.array));this.data.array[a*this.data.stride+this.offset]=b;return this}setY(a,b){this.normalized&&(b=kd(b,this.array));this.data.array[a*this.data.stride+this.offset+1]=b;return this}setZ(a,b){this.normalized&&(b=kd(b,this.array));this.data.array[a*this.data.stride+this.offset+2]=b;return this}setW(a,b){this.normalized&&(b=kd(b,this.array));this.data.array[a*this.data.stride+
this.offset+3]=b;return this}getX(a){a=this.data.array[a*this.data.stride+this.offset];this.normalized&&(a=wf(a,this.array));return a}getY(a){a=this.data.array[a*this.data.stride+this.offset+1];this.normalized&&(a=wf(a,this.array));return a}getZ(a){a=this.data.array[a*this.data.stride+this.offset+2];this.normalized&&(a=wf(a,this.array));return a}getW(a){a=this.data.array[a*this.data.stride+this.offset+3];this.normalized&&(a=wf(a,this.array));return a}setXY(a,b,e){a=a*this.data.stride+this.offset;
this.normalized&&(b=kd(b,this.array),e=kd(e,this.array));this.data.array[a+0]=b;this.data.array[a+1]=e;return this}setXYZ(a,b,e,f){a=a*this.data.stride+this.offset;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array));this.data.array[a+0]=b;this.data.array[a+1]=e;this.data.array[a+2]=f;return this}setXYZW(a,b,e,f,h){a=a*this.data.stride+this.offset;this.normalized&&(b=kd(b,this.array),e=kd(e,this.array),f=kd(f,this.array),h=kd(h,this.array));this.data.array[a+0]=b;this.data.array[a+
1]=e;this.data.array[a+2]=f;this.data.array[a+3]=h;return this}clone(a){if(void 0===a){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");a=[];for(let b=0;b<this.count;b++){const e=b*this.data.stride+this.offset;for(let f=0;f<this.itemSize;f++)a.push(this.data.array[e+f])}return new Hd(new this.array.constructor(a),this.itemSize,this.normalized)}void 0===a.interleavedBuffers&&(a.interleavedBuffers={});void 0===a.interleavedBuffers[this.data.uuid]&&
(a.interleavedBuffers[this.data.uuid]=this.data.clone(a));return new bj(a.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(a){if(void 0===a){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");a=[];for(let b=0;b<this.count;b++){const e=b*this.data.stride+this.offset;for(let f=0;f<this.itemSize;f++)a.push(this.data.array[e+f])}return{itemSize:this.itemSize,type:this.array.constructor.name,
array:a,normalized:this.normalized}}void 0===a.interleavedBuffers&&(a.interleavedBuffers={});void 0===a.interleavedBuffers[this.data.uuid]&&(a.interleavedBuffers[this.data.uuid]=this.data.toJSON(a));return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Up extends Zd{constructor(a){super();this.isSpriteMaterial=!0;this.type="SpriteMaterial";this.color=new Tb(16777215);this.alphaMap=this.map=null;this.rotation=0;this.fog=
this.transparent=this.sizeAttenuation=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;this.alphaMap=a.alphaMap;this.rotation=a.rotation;this.sizeAttenuation=a.sizeAttenuation;this.fog=a.fog;return this}}let ak;const yk=new mb,bk=new mb,ck=new mb,Ej=new Lb,ik=new Lb,uv=new gd,ym=new mb,zk=new mb,zm=new mb,Zw=new Lb,xq=new Lb,$w=new Lb;class yw extends Cd{constructor(a=new Up){super();this.isSprite=!0;this.type="Sprite";if(void 0===ak){ak=new md;var b=new Float32Array([-.5,
-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new qk(b,5);ak.setIndex([0,1,2,0,2,3]);ak.setAttribute("position",new bj(b,3,0,!1));ak.setAttribute("uv",new bj(b,2,3,!1))}this.geometry=ak;this.material=a;this.center=new Lb(.5,.5)}raycast(a,b){null===a.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');bk.setFromMatrixScale(this.matrixWorld);uv.copy(a.camera.matrixWorld);this.modelViewMatrix.multiplyMatrices(a.camera.matrixWorldInverse,
this.matrixWorld);ck.setFromMatrixPosition(this.modelViewMatrix);a.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&bk.multiplyScalar(-ck.z);var e=this.material.rotation;let f;if(0!==e){f=Math.cos(e);var h=Math.sin(e)}e=this.center;Tk(ym.set(-.5,-.5,0),ck,e,bk,h,f);Tk(zk.set(.5,-.5,0),ck,e,bk,h,f);Tk(zm.set(.5,.5,0),ck,e,bk,h,f);Zw.set(0,0);xq.set(1,0);$w.set(1,1);let n=a.ray.intersectTriangle(ym,zk,zm,!1,yk);if(null===n&&(Tk(zk.set(-.5,.5,0),ck,e,bk,h,f),xq.set(0,1),n=a.ray.intersectTriangle(ym,
zm,zk,!1,yk),null===n))return;h=a.ray.origin.distanceTo(yk);h<a.near||h>a.far||b.push({distance:h,point:yk.clone(),uv:Hf.getInterpolation(yk,ym,zk,zm,Zw,xq,$w,new Lb),face:null,object:this})}copy(a,b){super.copy(a,b);void 0!==a.center&&this.center.copy(a.center);this.material=a.material;return this}}const Am=new mb,ax=new mb;class gw extends Cd{constructor(){super();this._currentLevel=0;this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}});this.autoUpdate=
!0}copy(a){super.copy(a,!1);const b=a.levels;for(let e=0,f=b.length;e<f;e++){const h=b[e];this.addLevel(h.object.clone(),h.distance,h.hysteresis)}this.autoUpdate=a.autoUpdate;return this}addLevel(a,b=0,e=0){b=Math.abs(b);const f=this.levels;let h;for(h=0;h<f.length&&!(b<f[h].distance);h++);f.splice(h,0,{distance:b,hysteresis:e,object:a});this.add(a);return this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(a){const b=this.levels;if(0<b.length){let e,f;e=1;for(f=b.length;e<f;e++){let h=
b[e].distance;b[e].object.visible&&(h-=h*b[e].hysteresis);if(a<h)break}return b[e-1].object}return null}raycast(a,b){if(0<this.levels.length){Am.setFromMatrixPosition(this.matrixWorld);const e=a.ray.origin.distanceTo(Am);this.getObjectForDistance(e).raycast(a,b)}}update(a){const b=this.levels;if(1<b.length){Am.setFromMatrixPosition(a.matrixWorld);ax.setFromMatrixPosition(this.matrixWorld);a=Am.distanceTo(ax)/a.zoom;b[0].object.visible=!0;let e,f;e=1;for(f=b.length;e<f;e++){let h=b[e].distance;b[e].object.visible&&
(h-=h*b[e].hysteresis);if(a>=h)b[e-1].object.visible=!1,b[e].object.visible=!0;else break}for(this._currentLevel=e-1;e<f;e++)b[e].object.visible=!1}}toJSON(a){a=super.toJSON(a);!1===this.autoUpdate&&(a.object.autoUpdate=!1);a.object.levels=[];const b=this.levels;for(let e=0,f=b.length;e<f;e++){const h=b[e];a.object.levels.push({object:h.object.uuid,distance:h.distance,hysteresis:h.hysteresis})}return a}}const bx=new mb,cx=new Md,dx=new Md,mB=new mb,ex=new gd,Bm=new mb,yq=new lf,fx=new gd,zq=new dj;
class Rp extends Bd{constructor(a,b){super(a,b);this.isSkinnedMesh=!0;this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new gd;this.bindMatrixInverse=new gd;this.boundingSphere=this.boundingBox=null}computeBoundingBox(){var a=this.geometry;null===this.boundingBox&&(this.boundingBox=new qf);this.boundingBox.makeEmpty();a=a.getAttribute("position");for(let b=0;b<a.count;b++)this.getVertexPosition(b,Bm),this.boundingBox.expandByPoint(Bm)}computeBoundingSphere(){var a=this.geometry;null===
this.boundingSphere&&(this.boundingSphere=new lf);this.boundingSphere.makeEmpty();a=a.getAttribute("position");for(let b=0;b<a.count;b++)this.getVertexPosition(b,Bm),this.boundingSphere.expandByPoint(Bm)}copy(a,b){super.copy(a,b);this.bindMode=a.bindMode;this.bindMatrix.copy(a.bindMatrix);this.bindMatrixInverse.copy(a.bindMatrixInverse);this.skeleton=a.skeleton;null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this}raycast(a,
b){const e=this.matrixWorld;void 0!==this.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),yq.copy(this.boundingSphere),yq.applyMatrix4(e),!1!==a.ray.intersectsSphere(yq)&&(fx.copy(e).invert(),zq.copy(a.ray).applyMatrix4(fx),null!==this.boundingBox&&!1===zq.intersectsBox(this.boundingBox)||this._computeIntersections(a,b,zq)))}getVertexPosition(a,b){super.getVertexPosition(a,b);this.applyBoneTransform(a,b);return b}bind(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),
this.skeleton.calculateInverses(),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.copy(b).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const a=new Md,b=this.geometry.attributes.skinWeight;for(let e=0,f=b.count;e<f;e++){a.fromBufferAttribute(b,e);const h=1/a.manhattanLength();Infinity!==h?a.multiplyScalar(h):a.set(1,0,0,0);b.setXYZW(e,a.x,a.y,a.z,a.w)}}updateMatrixWorld(a){super.updateMatrixWorld(a);"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():
"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(a,b){const e=this.skeleton;var f=this.geometry;cx.fromBufferAttribute(f.attributes.skinIndex,a);dx.fromBufferAttribute(f.attributes.skinWeight,a);bx.copy(b).applyMatrix4(this.bindMatrix);b.set(0,0,0);for(a=0;4>a;a++)if(f=dx.getComponent(a),0!==f){const h=cx.getComponent(a);ex.multiplyMatrices(e.bones[h].matrixWorld,e.boneInverses[h]);
b.addScaledVector(mB.copy(bx).applyMatrix4(ex),f)}return b.applyMatrix4(this.bindMatrixInverse)}}class Yk extends Cd{constructor(){super();this.isBone=!0;this.type="Bone"}}class Bg extends Rd{constructor(a=null,b=1,e=1,f,h,n,r,t,w=1003,x=1003,y,z){super(null,n,r,t,w,x,f,h,y,z);this.isDataTexture=!0;this.image={data:a,width:b,height:e};this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}}const gx=new gd,nB=new gd;class gm{constructor(a=[],b=[]){this.uuid=fd();this.bones=a.slice(0);this.boneInverses=
b;this.boneTexture=this.boneMatrices=null;this.init()}init(){const a=this.bones,b=this.boneInverses;this.boneMatrices=new Float32Array(16*a.length);if(0===b.length)this.calculateInverses();else if(a.length!==b.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.");this.boneInverses=[];for(let e=0,f=this.bones.length;e<f;e++)this.boneInverses.push(new gd)}}calculateInverses(){this.boneInverses.length=0;for(let a=0,b=this.bones.length;a<b;a++){const e=
new gd;this.bones[a]&&e.copy(this.bones[a].matrixWorld).invert();this.boneInverses.push(e)}}pose(){for(let b=0,e=this.bones.length;b<e;b++){var a=this.bones[b];a&&a.matrixWorld.copy(this.boneInverses[b]).invert()}for(let b=0,e=this.bones.length;b<e;b++)if(a=this.bones[b])a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)}update(){const a=this.bones,b=this.boneInverses,
e=this.boneMatrices,f=this.boneTexture;for(let h=0,n=a.length;h<n;h++)gx.multiplyMatrices(a[h]?a[h].matrixWorld:nB,b[h]),gx.toArray(e,16*h);null!==f&&(f.needsUpdate=!0)}clone(){return new gm(this.bones,this.boneInverses)}computeBoneTexture(){var a=Math.sqrt(4*this.bones.length);a=4*Math.ceil(a/4);a=Math.max(a,4);const b=new Float32Array(a*a*4);b.set(this.boneMatrices);a=new Bg(b,a,a,1023,1015);a.needsUpdate=!0;this.boneMatrices=b;this.boneTexture=a;return this}getBoneByName(a){for(let b=0,e=this.bones.length;b<
e;b++){const f=this.bones[b];if(f.name===a)return f}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(a,b){this.uuid=a.uuid;for(let e=0,f=a.bones.length;e<f;e++){const h=a.bones[e];let n=b[h];void 0===n&&(console.warn("THREE.Skeleton: No bone found with UUID:",h),n=new Yk);this.bones.push(n);this.boneInverses.push((new gd).fromArray(a.boneInverses[e]))}this.init();return this}toJSON(){const a={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},
bones:[],boneInverses:[]};a.uuid=this.uuid;const b=this.bones,e=this.boneInverses;for(let f=0,h=b.length;f<h;f++)a.bones.push(b[f].uuid),a.boneInverses.push(e[f].toArray());return a}}class aj extends Hd{constructor(a,b,e,f=1){super(a,b,e);this.isInstancedBufferAttribute=!0;this.meshPerAttribute=f}copy(a){super.copy(a);this.meshPerAttribute=a.meshPerAttribute;return this}toJSON(){const a=super.toJSON();a.meshPerAttribute=this.meshPerAttribute;a.isInstancedBufferAttribute=!0;return a}}const dk=new gd,
hx=new gd,Cm=[],ix=new qf,oB=new gd,Ak=new Bd,Bk=new lf;class cm extends Bd{constructor(a,b,e){super(a,b);this.isInstancedMesh=!0;this.instanceMatrix=new aj(new Float32Array(16*e),16);this.morphTexture=this.instanceColor=null;this.count=e;this.boundingSphere=this.boundingBox=null;for(a=0;a<e;a++)this.setMatrixAt(a,oB)}computeBoundingBox(){const a=this.geometry,b=this.count;null===this.boundingBox&&(this.boundingBox=new qf);null===a.boundingBox&&a.computeBoundingBox();this.boundingBox.makeEmpty();
for(let e=0;e<b;e++)this.getMatrixAt(e,dk),ix.copy(a.boundingBox).applyMatrix4(dk),this.boundingBox.union(ix)}computeBoundingSphere(){const a=this.geometry,b=this.count;null===this.boundingSphere&&(this.boundingSphere=new lf);null===a.boundingSphere&&a.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let e=0;e<b;e++)this.getMatrixAt(e,dk),Bk.copy(a.boundingSphere).applyMatrix4(dk),this.boundingSphere.union(Bk)}copy(a,b){super.copy(a,b);this.instanceMatrix.copy(a.instanceMatrix);null!==
a.morphTexture&&(this.morphTexture=a.morphTexture.clone());null!==a.instanceColor&&(this.instanceColor=a.instanceColor.clone());this.count=a.count;null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this}getColorAt(a,b){b.fromArray(this.instanceColor.array,3*a)}getMatrixAt(a,b){b.fromArray(this.instanceMatrix.array,16*a)}getMorphAt(a,b){b=b.morphTargetInfluences;const e=this.morphTexture.source.data.data;a=a*
(b.length+1)+1;for(let f=0;f<b.length;f++)b[f]=e[a+f]}raycast(a,b){const e=this.matrixWorld,f=this.count;Ak.geometry=this.geometry;Ak.material=this.material;if(void 0!==Ak.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Bk.copy(this.boundingSphere),Bk.applyMatrix4(e),!1!==a.ray.intersectsSphere(Bk)))for(let h=0;h<f;h++){this.getMatrixAt(h,dk);hx.multiplyMatrices(e,dk);Ak.matrixWorld=hx;Ak.raycast(a,Cm);for(let n=0,r=Cm.length;n<r;n++){const t=Cm[n];t.instanceId=h;t.object=this;
b.push(t)}Cm.length=0}}setColorAt(a,b){null===this.instanceColor&&(this.instanceColor=new aj(new Float32Array(3*this.instanceMatrix.count),3));b.toArray(this.instanceColor.array,3*a)}setMatrixAt(a,b){b.toArray(this.instanceMatrix.array,16*a)}setMorphAt(a,b){b=b.morphTargetInfluences;const e=b.length+1;null===this.morphTexture&&(this.morphTexture=new Bg(new Float32Array(e*this.count),e,this.count,1028,1015));const f=this.morphTexture.source.data.data;let h=0;for(let n=0;n<b.length;n++)h+=b[n];a*=e;
f[a]=this.geometry.morphTargetsRelative?1:1-h;f.set(b,a+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"});null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null);return this}}class pB{constructor(){this.index=0;this.pool=[];this.list=[]}push(a,b){var e=this.pool;const f=this.list;this.index>=e.length&&e.push({start:-1,count:-1,z:-1});e=e[this.index];f.push(e);this.index++;e.start=a.start;e.count=a.count;e.z=b}reset(){this.index=this.list.length=0}}const Kg=
new gd,jx=new gd,qB=new gd,kx=new gd,Aq=new hk,Dm=new qf,oj=new lf,Ck=new mb,Bq=new pB,uf=new Bd,Em=[];class Uv extends Bd{get maxGeometryCount(){return this._maxGeometryCount}constructor(a,b,e=2*b,f){super(new md,f);this.sortObjects=this.perObjectFrustumCulled=this.isBatchedMesh=!0;this.customSort=this.boundingSphere=this.boundingBox=null;this._drawRanges=[];this._reservedRanges=[];this._visibility=[];this._active=[];this._bounds=[];this._maxGeometryCount=a;this._maxVertexCount=b;this._maxIndexCount=
e;this._geometryInitialized=!1;this._geometryCount=0;this._multiDrawCounts=new Int32Array(a);this._multiDrawStarts=new Int32Array(a);this._multiDrawCount=0;this._visibilityChanged=!0;this._matricesTexture=null;this._initMatricesTexture()}_initMatricesTexture(){let a=Math.sqrt(4*this._maxGeometryCount);a=4*Math.ceil(a/4);a=Math.max(a,4);const b=new Float32Array(a*a*4);this._matricesTexture=new Bg(b,a,a,1023,1015)}_initializeGeometry(a){const b=this.geometry;var e=this._maxVertexCount;const f=this._maxGeometryCount,
h=this._maxIndexCount;if(!1===this._geometryInitialized){for(const t in a.attributes){var n=a.getAttribute(t),r=n.itemSize;const w=n.normalized;n=new n.array.constructor(e*r);r=new Hd(n,r,w);b.setAttribute(t,r)}null!==a.getIndex()&&(a=65536<e?new Uint32Array(h):new Uint16Array(h),b.setIndex(new Hd(a,1)));e=65536<f?new Uint32Array(e):new Uint16Array(e);b.setAttribute("batchId",new Hd(e,1));this._geometryInitialized=!0}}_validateGeometry(a){if(a.getAttribute("batchId"))throw Error('BatchedMesh: Geometry cannot use attribute "batchId"');
const b=this.geometry;if(!!a.getIndex()!==!!b.getIndex())throw Error('BatchedMesh: All geometries must consistently have "index".');for(const e in b.attributes){if("batchId"===e)continue;if(!a.hasAttribute(e))throw Error(`BatchedMesh: Added geometry missing "${e}". All geometries must have consistent attributes.`);const f=a.getAttribute(e),h=b.getAttribute(e);if(f.itemSize!==h.itemSize||f.normalized!==h.normalized)throw Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.");
}}setCustomSort(a){this.customSort=a;return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new qf);const a=this._geometryCount,b=this.boundingBox,e=this._active;b.makeEmpty();for(let f=0;f<a;f++)!1!==e[f]&&(this.getMatrixAt(f,Kg),this.getBoundingBoxAt(f,Dm).applyMatrix4(Kg),b.union(Dm))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new lf);const a=this._geometryCount,b=this.boundingSphere,e=this._active;b.makeEmpty();for(let f=0;f<a;f++)!1!==e[f]&&
(this.getMatrixAt(f,Kg),this.getBoundingSphereAt(f,oj).applyMatrix4(Kg),b.union(oj))}addGeometry(a,b=-1,e=-1){this._initializeGeometry(a);this._validateGeometry(a);if(this._geometryCount>=this._maxGeometryCount)throw Error("BatchedMesh: Maximum geometry count reached.");const f={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};var h=null,n=this._reservedRanges,r=this._drawRanges;const t=this._bounds;0!==this._geometryCount&&(h=n[n.length-1]);f.vertexCount=-1===b?a.getAttribute("position").count:
b;f.vertexStart=null===h?0:h.vertexStart+h.vertexCount;var w=a.getIndex();if(b=null!==w)f.indexCount=-1===e?w.count:e,f.indexStart=null===h?0:h.indexStart+h.indexCount;if(-1!==f.indexStart&&f.indexStart+f.indexCount>this._maxIndexCount||f.vertexStart+f.vertexCount>this._maxVertexCount)throw Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");e=this._active;h=this._matricesTexture;w=this._matricesTexture.image.data;this._visibility.push(!0);e.push(!0);e=this._geometryCount;
this._geometryCount++;qB.toArray(w,16*e);h.needsUpdate=!0;n.push(f);r.push({start:b?f.indexStart:f.vertexStart,count:-1});t.push({boxInitialized:!1,box:new qf,sphereInitialized:!1,sphere:new lf});n=this.geometry.getAttribute("batchId");for(r=0;r<f.vertexCount;r++)n.setX(f.vertexStart+r,e);n.needsUpdate=!0;this.setGeometryAt(e,a);return e}setGeometryAt(a,b){if(a>=this._geometryCount)throw Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(b);var e=this.geometry;const f=null!==
e.getIndex();var h=e.getIndex();const n=b.getIndex(),r=this._reservedRanges[a];if(f&&n.count>r.indexCount||b.attributes.position.count>r.vertexCount)throw Error("BatchedMesh: Reserved space not large enough for provided geometry.");const t=r.vertexStart;var w=r.vertexCount;for(const y in e.attributes){if("batchId"===y)continue;var x=b.getAttribute(y);const z=e.getAttribute(y);Ez(x,z,t);const ab=x.itemSize;for(let eb=x.count,cb=w;eb<cb;eb++){x=t+eb;for(let db=0;db<ab;db++)z.setComponent(x,db,0)}z.needsUpdate=
!0;z.addUpdateRange(t*ab,w*ab)}if(f){e=r.indexStart;for(w=0;w<n.count;w++)h.setX(e+w,t+n.getX(w));for(let y=n.count,z=r.indexCount;y<z;y++)h.setX(e+y,t);h.needsUpdate=!0;h.addUpdateRange(e,r.indexCount)}h=this._bounds[a];null!==b.boundingBox?(h.box.copy(b.boundingBox),h.boxInitialized=!0):h.boxInitialized=!1;null!==b.boundingSphere?(h.sphere.copy(b.boundingSphere),h.sphereInitialized=!0):h.sphereInitialized=!1;h=this._drawRanges[a];b=b.getAttribute("position");h.count=f?n.count:b.count;this._visibilityChanged=
!0;return a}deleteGeometry(a){const b=this._active;if(a>=b.length||!1===b[a])return this;b[a]=!1;this._visibilityChanged=!0;return this}getBoundingBoxAt(a,b){if(!1===this._active[a])return null;const e=this._bounds[a],f=e.box;var h=this.geometry;if(!1===e.boxInitialized){f.makeEmpty();const n=h.index;h=h.attributes.position;a=this._drawRanges[a];for(let r=a.start,t=a.start+a.count;r<t;r++)a=r,n&&(a=n.getX(a)),f.expandByPoint(Ck.fromBufferAttribute(h,a));e.boxInitialized=!0}b.copy(f);return b}getBoundingSphereAt(a,
b){if(!1===this._active[a])return null;const e=this._bounds[a],f=e.sphere;var h=this.geometry;if(!1===e.sphereInitialized){f.makeEmpty();this.getBoundingBoxAt(a,Dm);Dm.getCenter(f.center);const r=h.index;h=h.attributes.position;var n=this._drawRanges[a];a=0;for(let t=n.start,w=n.start+n.count;t<w;t++)n=t,r&&(n=r.getX(n)),Ck.fromBufferAttribute(h,n),a=Math.max(a,f.center.distanceToSquared(Ck));f.radius=Math.sqrt(a);e.sphereInitialized=!0}b.copy(f);return b}setMatrixAt(a,b){const e=this._active,f=this._matricesTexture;
if(a>=this._geometryCount||!1===e[a])return this;b.toArray(this._matricesTexture.image.data,16*a);f.needsUpdate=!0;return this}getMatrixAt(a,b){const e=this._active;return a>=this._geometryCount||!1===e[a]?null:b.fromArray(this._matricesTexture.image.data,16*a)}setVisibleAt(a,b){const e=this._visibility,f=this._active;if(a>=this._geometryCount||!1===f[a]||e[a]===b)return this;e[a]=b;this._visibilityChanged=!0;return this}getVisibleAt(a){const b=this._active;return a>=this._geometryCount||!1===b[a]?
!1:this._visibility[a]}raycast(a,b){const e=this._visibility,f=this._active,h=this._drawRanges,n=this._geometryCount,r=this.matrixWorld;var t=this.geometry;uf.material=this.material;uf.geometry.index=t.index;uf.geometry.attributes=t.attributes;null===uf.geometry.boundingBox&&(uf.geometry.boundingBox=new qf);null===uf.geometry.boundingSphere&&(uf.geometry.boundingSphere=new lf);for(t=0;t<n;t++)if(e[t]&&f[t]){var w=h[t];uf.geometry.setDrawRange(w.start,w.count);this.getMatrixAt(t,uf.matrixWorld).premultiply(r);
this.getBoundingBoxAt(t,uf.geometry.boundingBox);this.getBoundingSphereAt(t,uf.geometry.boundingSphere);uf.raycast(a,Em);for(let x=0,y=Em.length;x<y;x++)w=Em[x],w.object=this,w.batchId=t,b.push(w);Em.length=0}uf.material=null;uf.geometry.index=null;uf.geometry.attributes={};uf.geometry.setDrawRange(0,Infinity)}copy(a){super.copy(a);this.geometry=a.geometry.clone();this.perObjectFrustumCulled=a.perObjectFrustumCulled;this.sortObjects=a.sortObjects;this.boundingBox=null!==a.boundingBox?a.boundingBox.clone():
null;this.boundingSphere=null!==a.boundingSphere?a.boundingSphere.clone():null;this._drawRanges=a._drawRanges.map(b=>Object.assign({},b));this._reservedRanges=a._reservedRanges.map(b=>Object.assign({},b));this._visibility=a._visibility.slice();this._active=a._active.slice();this._bounds=a._bounds.map(b=>({boxInitialized:b.boxInitialized,box:b.box.clone(),sphereInitialized:b.sphereInitialized,sphere:b.sphere.clone()}));this._maxGeometryCount=a._maxGeometryCount;this._maxVertexCount=a._maxVertexCount;
this._maxIndexCount=a._maxIndexCount;this._geometryInitialized=a._geometryInitialized;this._geometryCount=a._geometryCount;this._multiDrawCounts=a._multiDrawCounts.slice();this._multiDrawStarts=a._multiDrawStarts.slice();this._matricesTexture=a._matricesTexture.clone();this._matricesTexture.image.data=this._matricesTexture.image.slice();return this}dispose(){this.geometry.dispose();this._matricesTexture.dispose();this._matricesTexture=null;return this}onBeforeRender(a,b,e,f,h){if(this._visibilityChanged||
this.perObjectFrustumCulled||this.sortObjects){b=f.getIndex();b=null===b?1:b.array.BYTES_PER_ELEMENT;var n=this._active,r=this._visibility;f=this._multiDrawStarts;var t=this._multiDrawCounts,w=this._drawRanges,x=this.perObjectFrustumCulled;x&&(kx.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).multiply(this.matrixWorld),Aq.setFromProjectionMatrix(kx,a.coordinateSystem));a=0;if(this.sortObjects){jx.copy(this.matrixWorld).invert();Ck.setFromMatrixPosition(e.matrixWorld).applyMatrix4(jx);for(let z=
0,ab=r.length;z<ab;z++)if(r[z]&&n[z]){this.getMatrixAt(z,Kg);this.getBoundingSphereAt(z,oj).applyMatrix4(Kg);var y=!1;x&&(y=!Aq.intersectsSphere(oj));y||(y=Ck.distanceTo(oj.center),Bq.push(w[z],y))}n=Bq.list;r=this.customSort;null===r?n.sort(h.transparent?Dz:Cz):r.call(this,n,e);for(let z=0,ab=n.length;z<ab;z++)e=n[z],f[a]=e.start*b,t[a]=e.count,a++;Bq.reset()}else for(let z=0,ab=r.length;z<ab;z++)r[z]&&n[z]&&(e=!1,x&&(this.getMatrixAt(z,Kg),this.getBoundingSphereAt(z,oj).applyMatrix4(Kg),e=!Aq.intersectsSphere(oj)),
e||(e=w[z],f[a]=e.start*b,t[a]=e.count,a++));this._multiDrawCount=a;this._visibilityChanged=!1}}onBeforeShadow(a,b,e,f,h,n){this.onBeforeRender(a,null,f,h,n)}}class mf extends Zd{constructor(a){super();this.isLineBasicMaterial=!0;this.type="LineBasicMaterial";this.color=new Tb(16777215);this.map=null;this.linewidth=1;this.linejoin=this.linecap="round";this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;this.linewidth=a.linewidth;this.linecap=a.linecap;this.linejoin=
a.linejoin;this.fog=a.fog;return this}}const lx=new mb,mx=new mb,nx=new gd,Cq=new dj,Dk=new lf;class cg extends Cd{constructor(a=new md,b=new mf){super();this.isLine=!0;this.type="Line";this.geometry=a;this.material=b;this.updateMorphTargets()}copy(a,b){super.copy(a,b);this.material=Array.isArray(a.material)?a.material.slice():a.material;this.geometry=a.geometry;return this}computeLineDistances(){const a=this.geometry;if(null===a.index){const b=a.attributes.position,e=[0];for(let f=1,h=b.count;f<
h;f++)lx.fromBufferAttribute(b,f-1),mx.fromBufferAttribute(b,f),e[f]=e[f-1],e[f]+=lx.distanceTo(mx);a.setAttribute("lineDistance",new $b(e,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(a,b){var e=this.geometry,f=this.matrixWorld,h=a.params.Line.threshold,n=e.drawRange;null===e.boundingSphere&&e.computeBoundingSphere();Dk.copy(e.boundingSphere);Dk.applyMatrix4(f);Dk.radius+=h;if(!1!==a.ray.intersectsSphere(Dk)){nx.copy(f).invert();
Cq.copy(a.ray).applyMatrix4(nx);f=h/((this.scale.x+this.scale.y+this.scale.z)/3);f*=f;h=new mb;var r=new mb,t=new mb,w=new mb,x=this.isLineSegments?2:1,y=e.index;e=e.attributes.position;if(null!==y){var z=Math.max(0,n.start);n=Math.min(y.count,n.start+n.count);for(let ab=z,eb=n-1;ab<eb;ab+=x)n=y.getX(ab),z=y.getX(ab+1),h.fromBufferAttribute(e,n),r.fromBufferAttribute(e,z),Cq.distanceSqToSegment(h,r,w,t)>f||(w.applyMatrix4(this.matrixWorld),n=a.ray.origin.distanceTo(w),n<a.near||n>a.far||b.push({distance:n,
point:t.clone().applyMatrix4(this.matrixWorld),index:ab,face:null,faceIndex:null,object:this}))}else{y=Math.max(0,n.start);n=Math.min(e.count,n.start+n.count);for(let ab=y,eb=n-1;ab<eb;ab+=x)h.fromBufferAttribute(e,ab),r.fromBufferAttribute(e,ab+1),Cq.distanceSqToSegment(h,r,w,t)>f||(w.applyMatrix4(this.matrixWorld),n=a.ray.origin.distanceTo(w),n<a.near||n>a.far||b.push({distance:n,point:t.clone().applyMatrix4(this.matrixWorld),index:ab,face:null,faceIndex:null,object:this}))}}}updateMorphTargets(){var a=
this.geometry.morphAttributes,b=Object.keys(a);if(0<b.length&&(a=a[b[0]],void 0!==a)){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let e=0,f=a.length;e<f;e++)b=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=e}}}const ox=new mb,px=new mb;class Vf extends cg{constructor(a,b){super(a,b);this.isLineSegments=!0;this.type="LineSegments"}computeLineDistances(){const a=this.geometry;if(null===a.index){const b=a.attributes.position,e=[];for(let f=0,
h=b.count;f<h;f+=2)ox.fromBufferAttribute(b,f),px.fromBufferAttribute(b,f+1),e[f]=0===f?0:e[f-1],e[f+1]=e[f]+ox.distanceTo(px);a.setAttribute("lineDistance",new $b(e,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Gp extends cg{constructor(a,b){super(a,b);this.isLineLoop=!0;this.type="LineLoop"}}class fm extends Zd{constructor(a){super();this.isPointsMaterial=!0;this.type="PointsMaterial";this.color=
new Tb(16777215);this.alphaMap=this.map=null;this.size=1;this.fog=this.sizeAttenuation=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;this.alphaMap=a.alphaMap;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;this.fog=a.fog;return this}}const qx=new gd,hp=new dj,Ek=new lf,Fm=new mb;class Lp extends Cd{constructor(a=new md,b=new fm){super();this.isPoints=!0;this.type="Points";this.geometry=a;this.material=b;this.updateMorphTargets()}copy(a,b){super.copy(a,
b);this.material=Array.isArray(a.material)?a.material.slice():a.material;this.geometry=a.geometry;return this}raycast(a,b){var e=this.geometry;const f=this.matrixWorld;var h=a.params.Points.threshold,n=e.drawRange;null===e.boundingSphere&&e.computeBoundingSphere();Ek.copy(e.boundingSphere);Ek.applyMatrix4(f);Ek.radius+=h;if(!1!==a.ray.intersectsSphere(Ek)){qx.copy(f).invert();hp.copy(a.ray).applyMatrix4(qx);h/=(this.scale.x+this.scale.y+this.scale.z)/3;h*=h;var r=e.index;e=e.attributes.position;if(null!==
r){const t=Math.max(0,n.start);n=Math.min(r.count,n.start+n.count);for(let w=t,x=n;w<x;w++)n=r.getX(w),Fm.fromBufferAttribute(e,n),vv(Fm,n,h,f,a,b,this)}else{r=Math.max(0,n.start);n=Math.min(e.count,n.start+n.count);for(let t=r,w=n;t<w;t++)Fm.fromBufferAttribute(e,t),vv(Fm,t,h,f,a,b,this)}}}updateMorphTargets(){var a=this.geometry.morphAttributes,b=Object.keys(a);if(0<b.length&&(a=a[b[0]],void 0!==a)){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let e=0,f=a.length;e<f;e++)b=a[e].name||
String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=e}}}class hm extends Rd{constructor(a,b,e,f,h,n,r,t,w){function x(){y.needsUpdate=!0;a.requestVideoFrameCallback(x)}super(a,b,e,f,h,n,r,t,w);this.isVideoTexture=!0;this.minFilter=void 0!==n?n:1006;this.magFilter=void 0!==h?h:1006;this.generateMipmaps=!1;const y=this;"requestVideoFrameCallback"in a&&a.requestVideoFrameCallback(x)}clone(){return(new this.constructor(this.image)).copy(this)}update(){const a=this.image;!1==="requestVideoFrameCallback"in
a&&a.readyState>=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class nA extends Rd{constructor(a,b){super({width:a,height:b});this.isFramebufferTexture=!0;this.minFilter=this.magFilter=1003;this.generateMipmaps=!1;this.needsUpdate=!0}}class $k extends Rd{constructor(a,b,e,f,h,n,r,t,w,x,y,z){super(null,n,r,t,w,x,f,h,y,z);this.isCompressedTexture=!0;this.image={width:b,height:e};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}}class eA extends $k{constructor(a,b,e,f,h,n){super(a,b,e,h,n);this.isCompressedArrayTexture=
!0;this.image.depth=f;this.wrapR=1001}}class fA extends $k{constructor(a,b,e){super(void 0,a[0].width,a[0].height,b,e,301);this.isCubeTexture=this.isCompressedCubeTexture=!0;this.image=a}}class dA extends Rd{constructor(a,b,e,f,h,n,r,t,w){super(a,b,e,f,h,n,r,t,w);this.needsUpdate=this.isCanvasTexture=!0}}class Sf{constructor(){this.type="Curve";this.arcLengthDivisions=200}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.");return null}getPointAt(a,b){a=this.getUtoTmapping(a);return this.getPoint(a,
b)}getPoints(a=5){const b=[];for(let e=0;e<=a;e++)b.push(this.getPoint(e/a));return b}getSpacedPoints(a=5){const b=[];for(let e=0;e<=a;e++)b.push(this.getPointAt(e/a));return b}getLength(){const a=this.getLengths();return a[a.length-1]}getLengths(a=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const b=[];let e,f=this.getPoint(0),h=0;b.push(0);for(let n=1;n<=a;n++)e=this.getPoint(n/a),h+=e.distanceTo(f),
b.push(h),f=e;return this.cacheArcLengths=b}updateArcLengths(){this.needsUpdate=!0;this.getLengths()}getUtoTmapping(a,b){const e=this.getLengths(),f=e.length;b=b?b:a*e[f-1];var h=0;let n=f-1,r;for(;h<=n;)if(a=Math.floor(h+(n-h)/2),r=e[a]-b,0>r)h=a+1;else if(0<r)n=a-1;else{n=a;break}a=n;if(e[a]===b)return a/(f-1);h=e[a];return(a+(b-h)/(e[a+1]-h))/(f-1)}getTangent(a,b){var e=a-1E-4;a+=1E-4;0>e&&(e=0);1<a&&(a=1);e=this.getPoint(e);a=this.getPoint(a);b=b||(e.isVector2?new Lb:new mb);b.copy(a).sub(e).normalize();
return b}getTangentAt(a,b){a=this.getUtoTmapping(a);return this.getTangent(a,b)}computeFrenetFrames(a,b){var e=new mb;const f=[],h=[],n=[];var r=new mb;const t=new gd;for(var w=0;w<=a;w++)f[w]=this.getTangentAt(w/a,new mb);h[0]=new mb;n[0]=new mb;w=Number.MAX_VALUE;const x=Math.abs(f[0].x),y=Math.abs(f[0].y),z=Math.abs(f[0].z);x<=w&&(w=x,e.set(1,0,0));y<=w&&(w=y,e.set(0,1,0));z<=w&&e.set(0,0,1);r.crossVectors(f[0],e).normalize();h[0].crossVectors(f[0],r);n[0].crossVectors(f[0],h[0]);for(e=1;e<=a;e++)h[e]=
h[e-1].clone(),n[e]=n[e-1].clone(),r.crossVectors(f[e-1],f[e]),r.length()>Number.EPSILON&&(r.normalize(),w=Math.acos(jd(f[e-1].dot(f[e]),-1,1)),h[e].applyMatrix4(t.makeRotationAxis(r,w))),n[e].crossVectors(f[e],h[e]);if(!0===b)for(b=Math.acos(jd(h[0].dot(h[a]),-1,1)),b/=a,0<f[0].dot(r.crossVectors(h[0],h[a]))&&(b=-b),r=1;r<=a;r++)h[r].applyMatrix4(t.makeRotationAxis(f[r],b*r)),n[r].crossVectors(f[r],h[r]);return{tangents:f,normals:h,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(a){this.arcLengthDivisions=
a.arcLengthDivisions;return this}toJSON(){const a={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};a.arcLengthDivisions=this.arcLengthDivisions;a.type=this.type;return a}fromJSON(a){this.arcLengthDivisions=a.arcLengthDivisions;return this}}class bm extends Sf{constructor(a=0,b=0,e=1,f=1,h=0,n=2*Math.PI,r=!1,t=0){super();this.isEllipseCurve=!0;this.type="EllipseCurve";this.aX=a;this.aY=b;this.xRadius=e;this.yRadius=f;this.aStartAngle=h;this.aEndAngle=n;this.aClockwise=r;this.aRotation=
t}getPoint(a,b=new Lb){for(var e=2*Math.PI,f=this.aEndAngle-this.aStartAngle,h=Math.abs(f)<Number.EPSILON;0>f;)f+=e;for(;f>e;)f-=e;f<Number.EPSILON&&(f=h?0:e);!0!==this.aClockwise||h||(f=f===e?-e:f-e);e=this.aStartAngle+a*f;a=this.aX+this.xRadius*Math.cos(e);var n=this.aY+this.yRadius*Math.sin(e);0!==this.aRotation&&(e=Math.cos(this.aRotation),f=Math.sin(this.aRotation),h=a-this.aX,n-=this.aY,a=h*e-n*f+this.aX,n=h*f+n*e+this.aY);return b.set(a,n)}copy(a){super.copy(a);this.aX=a.aX;this.aY=a.aY;this.xRadius=
a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this}toJSON(){const a=super.toJSON();a.aX=this.aX;a.aY=this.aY;a.xRadius=this.xRadius;a.yRadius=this.yRadius;a.aStartAngle=this.aStartAngle;a.aEndAngle=this.aEndAngle;a.aClockwise=this.aClockwise;a.aRotation=this.aRotation;return a}fromJSON(a){super.fromJSON(a);this.aX=a.aX;this.aY=a.aY;this.xRadius=a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=
a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this}}class Rv extends bm{constructor(a,b,e,f,h,n){super(a,b,e,e,f,h,n);this.isArcCurve=!0;this.type="ArcCurve"}}const Gm=new mb,Dq=new ip,Eq=new ip,Fq=new ip;class Wv extends Sf{constructor(a=[],b=!1,e="centripetal",f=.5){super();this.isCatmullRomCurve3=!0;this.type="CatmullRomCurve3";this.points=a;this.closed=b;this.curveType=e;this.tension=f}getPoint(a,b=new mb){var e=this.points,f=e.length;
a*=f-(this.closed?0:1);var h=Math.floor(a);a-=h;this.closed?h+=0<h?0:(Math.floor(Math.abs(h)/f)+1)*f:0===a&&h===f-1&&(h=f-2,a=1);let n;this.closed||0<h?n=e[(h-1)%f]:(Gm.subVectors(e[0],e[1]).add(e[0]),n=Gm);const r=e[h%f],t=e[(h+1)%f];this.closed||h+2<f?e=e[(h+2)%f]:(Gm.subVectors(e[f-1],e[f-2]).add(e[f-1]),e=Gm);if("centripetal"===this.curveType||"chordal"===this.curveType){var w="chordal"===this.curveType?.5:.25;f=Math.pow(n.distanceToSquared(r),w);h=Math.pow(r.distanceToSquared(t),w);w=Math.pow(t.distanceToSquared(e),
w);1E-4>h&&(h=1);1E-4>f&&(f=h);1E-4>w&&(w=h);Dq.initNonuniformCatmullRom(n.x,r.x,t.x,e.x,f,h,w);Eq.initNonuniformCatmullRom(n.y,r.y,t.y,e.y,f,h,w);Fq.initNonuniformCatmullRom(n.z,r.z,t.z,e.z,f,h,w)}else"catmullrom"===this.curveType&&(Dq.initCatmullRom(n.x,r.x,t.x,e.x,this.tension),Eq.initCatmullRom(n.y,r.y,t.y,e.y,this.tension),Fq.initCatmullRom(n.z,r.z,t.z,e.z,this.tension));b.set(Dq.calc(a),Eq.calc(a),Fq.calc(a));return b}copy(a){super.copy(a);this.points=[];for(let b=0,e=a.points.length;b<e;b++)this.points.push(a.points[b].clone());
this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this}toJSON(){const a=super.toJSON();a.points=[];for(let b=0,e=this.points.length;b<e;b++)a.points.push(this.points[b].toArray());a.closed=this.closed;a.curveType=this.curveType;a.tension=this.tension;return a}fromJSON(a){super.fromJSON(a);this.points=[];for(let b=0,e=a.points.length;b<e;b++){const f=a.points[b];this.points.push((new mb).fromArray(f))}this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;
return this}}class wp extends Sf{constructor(a=new Lb,b=new Lb,e=new Lb,f=new Lb){super();this.isCubicBezierCurve=!0;this.type="CubicBezierCurve";this.v0=a;this.v1=b;this.v2=e;this.v3=f}getPoint(a,b=new Lb){const e=this.v0,f=this.v1,h=this.v2,n=this.v3;b.set(kk(a,e.x,f.x,h.x,n.x),kk(a,e.y,f.y,h.y,n.y));return b}copy(a){super.copy(a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this}toJSON(){const a=super.toJSON();a.v0=this.v0.toArray();a.v1=this.v1.toArray();
a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a}fromJSON(a){super.fromJSON(a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);this.v3.fromArray(a.v3);return this}}class Zv extends Sf{constructor(a=new mb,b=new mb,e=new mb,f=new mb){super();this.isCubicBezierCurve3=!0;this.type="CubicBezierCurve3";this.v0=a;this.v1=b;this.v2=e;this.v3=f}getPoint(a,b=new mb){const e=this.v0,f=this.v1,h=this.v2,n=this.v3;b.set(kk(a,e.x,f.x,h.x,n.x),kk(a,e.y,f.y,h.y,n.y),kk(a,e.z,f.z,h.z,
n.z));return b}copy(a){super.copy(a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this}toJSON(){const a=super.toJSON();a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a}fromJSON(a){super.fromJSON(a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);this.v3.fromArray(a.v3);return this}}class Fp extends Sf{constructor(a=new Lb,b=new Lb){super();this.isLineCurve=!0;this.type="LineCurve";this.v1=
a;this.v2=b}getPoint(a,b=new Lb){1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),b.multiplyScalar(a).add(this.v1));return b}getPointAt(a,b){return this.getPoint(a,b)}getTangent(a,b=new Lb){return b.subVectors(this.v2,this.v1).normalize()}getTangentAt(a,b){return this.getTangent(a,b)}copy(a){super.copy(a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this}toJSON(){const a=super.toJSON();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a}fromJSON(a){super.fromJSON(a);this.v1.fromArray(a.v1);
this.v2.fromArray(a.v2);return this}}class iw extends Sf{constructor(a=new mb,b=new mb){super();this.isLineCurve3=!0;this.type="LineCurve3";this.v1=a;this.v2=b}getPoint(a,b=new mb){1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),b.multiplyScalar(a).add(this.v1));return b}getPointAt(a,b){return this.getPoint(a,b)}getTangent(a,b=new mb){return b.subVectors(this.v2,this.v1).normalize()}getTangentAt(a,b){return this.getTangent(a,b)}copy(a){super.copy(a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this}toJSON(){const a=
super.toJSON();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a}fromJSON(a){super.fromJSON(a);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this}}class Mp extends Sf{constructor(a=new Lb,b=new Lb,e=new Lb){super();this.isQuadraticBezierCurve=!0;this.type="QuadraticBezierCurve";this.v0=a;this.v1=b;this.v2=e}getPoint(a,b=new Lb){const e=this.v0,f=this.v1,h=this.v2;b.set(jk(a,e.x,f.x,h.x),jk(a,e.y,f.y,h.y));return b}copy(a){super.copy(a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);
return this}toJSON(){const a=super.toJSON();a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a}fromJSON(a){super.fromJSON(a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this}}class Np extends Sf{constructor(a=new mb,b=new mb,e=new mb){super();this.isQuadraticBezierCurve3=!0;this.type="QuadraticBezierCurve3";this.v0=a;this.v1=b;this.v2=e}getPoint(a,b=new mb){const e=this.v0,f=this.v1,h=this.v2;b.set(jk(a,e.x,f.x,h.x),jk(a,e.y,f.y,h.y),jk(a,
e.z,f.z,h.z));return b}copy(a){super.copy(a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);return this}toJSON(){const a=super.toJSON();a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a}fromJSON(a){super.fromJSON(a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this}}class Sp extends Sf{constructor(a=[]){super();this.isSplineCurve=!0;this.type="SplineCurve";this.points=a}getPoint(a,b=new Lb){var e=this.points,f=(e.length-1)*a;
a=Math.floor(f);f-=a;const h=e[0===a?a:a-1],n=e[a],r=e[a>e.length-2?e.length-1:a+1];e=e[a>e.length-3?e.length-1:a+2];b.set(wv(f,h.x,n.x,r.x,e.x),wv(f,h.y,n.y,r.y,e.y));return b}copy(a){super.copy(a);this.points=[];for(let b=0,e=a.points.length;b<e;b++)this.points.push(a.points[b].clone());return this}toJSON(){const a=super.toJSON();a.points=[];for(let b=0,e=this.points.length;b<e;b++)a.points.push(this.points[b].toArray());return a}fromJSON(a){super.fromJSON(a);this.points=[];for(let b=0,e=a.points.length;b<
e;b++){const f=a.points[b];this.points.push((new Lb).fromArray(f))}return this}}var Hm=Object.freeze({__proto__:null,ArcCurve:Rv,CatmullRomCurve3:Wv,CubicBezierCurve:wp,CubicBezierCurve3:Zv,EllipseCurve:bm,LineCurve:Fp,LineCurve3:iw,QuadraticBezierCurve:Mp,QuadraticBezierCurve3:Np,SplineCurve:Sp});class aw extends Sf{constructor(){super();this.type="CurvePath";this.curves=[];this.autoClose=!1}add(a){this.curves.push(a)}closePath(){const a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-
1].getPoint(1);a.equals(b)||this.curves.push(new Hm[!0===a.isVector2?"LineCurve":"LineCurve3"](b,a));return this}getPoint(a,b){var e=a*this.getLength(),f=this.getCurveLengths();for(a=0;a<f.length;){if(f[a]>=e)return e=f[a]-e,a=this.curves[a],f=a.getLength(),a.getPointAt(0===f?0:1-e/f,b);a++}return null}getLength(){const a=this.getCurveLengths();return a[a.length-1]}updateArcLengths(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===
this.curves.length)return this.cacheLengths;const a=[];let b=0;for(let e=0,f=this.curves.length;e<f;e++)b+=this.curves[e].getLength(),a.push(b);return this.cacheLengths=a}getSpacedPoints(a=40){const b=[];for(let e=0;e<=a;e++)b.push(this.getPoint(e/a));this.autoClose&&b.push(b[0]);return b}getPoints(a=12){const b=[];let e;for(let h=0,n=this.curves;h<n.length;h++){var f=n[h];f=f.getPoints(f.isEllipseCurve?2*a:f.isLineCurve||f.isLineCurve3?1:f.isSplineCurve?a*f.points.length:a);for(let r=0;r<f.length;r++){const t=
f[r];e&&e.equals(t)||(b.push(t),e=t)}}this.autoClose&&1<b.length&&!b[b.length-1].equals(b[0])&&b.push(b[0]);return b}copy(a){super.copy(a);this.curves=[];for(let b=0,e=a.curves.length;b<e;b++)this.curves.push(a.curves[b].clone());this.autoClose=a.autoClose;return this}toJSON(){const a=super.toJSON();a.autoClose=this.autoClose;a.curves=[];for(let b=0,e=this.curves.length;b<e;b++)a.curves.push(this.curves[b].toJSON());return a}fromJSON(a){super.fromJSON(a);this.autoClose=a.autoClose;this.curves=[];
for(let b=0,e=a.curves.length;b<e;b++){const f=a.curves[b];this.curves.push((new Hm[f.type]).fromJSON(f))}return this}}class sk extends aw{constructor(a){super();this.type="Path";this.currentPoint=new Lb;a&&this.setFromPoints(a)}setFromPoints(a){this.moveTo(a[0].x,a[0].y);for(let b=1,e=a.length;b<e;b++)this.lineTo(a[b].x,a[b].y);return this}moveTo(a,b){this.currentPoint.set(a,b);return this}lineTo(a,b){const e=new Fp(this.currentPoint.clone(),new Lb(a,b));this.curves.push(e);this.currentPoint.set(a,
b);return this}quadraticCurveTo(a,b,e,f){a=new Mp(this.currentPoint.clone(),new Lb(a,b),new Lb(e,f));this.curves.push(a);this.currentPoint.set(e,f);return this}bezierCurveTo(a,b,e,f,h,n){a=new wp(this.currentPoint.clone(),new Lb(a,b),new Lb(e,f),new Lb(h,n));this.curves.push(a);this.currentPoint.set(h,n);return this}splineThru(a){var b=[this.currentPoint.clone()].concat(a);b=new Sp(b);this.curves.push(b);this.currentPoint.copy(a[a.length-1]);return this}arc(a,b,e,f,h,n){this.absarc(a+this.currentPoint.x,
b+this.currentPoint.y,e,f,h,n);return this}absarc(a,b,e,f,h,n){this.absellipse(a,b,e,e,f,h,n);return this}ellipse(a,b,e,f,h,n,r,t){this.absellipse(a+this.currentPoint.x,b+this.currentPoint.y,e,f,h,n,r,t);return this}absellipse(a,b,e,f,h,n,r,t){a=new bm(a,b,e,f,h,n,r,t);0<this.curves.length&&(b=a.getPoint(0),b.equals(this.currentPoint)||this.lineTo(b.x,b.y));this.curves.push(a);a=a.getPoint(1);this.currentPoint.copy(a);return this}copy(a){super.copy(a);this.currentPoint.copy(a.currentPoint);return this}toJSON(){const a=
super.toJSON();a.currentPoint=this.currentPoint.toArray();return a}fromJSON(a){super.fromJSON(a);this.currentPoint.fromArray(a.currentPoint);return this}}class dm extends md{constructor(a=[new Lb(0,-.5),new Lb(.5,0),new Lb(0,.5)],b=12,e=0,f=2*Math.PI){super();this.type="LatheGeometry";this.parameters={points:a,segments:b,phiStart:e,phiLength:f};b=Math.floor(b);f=jd(f,0,2*Math.PI);const h=[],n=[],r=[];var t=[];const w=[];var x=1/b,y=new mb,z=new Lb,ab=new mb,eb=new mb,cb=new mb;let db;for(let gb=0;gb<=
a.length-1;gb++)switch(gb){case 0:var bb=a[gb+1].x-a[gb].x;db=a[gb+1].y-a[gb].y;ab.x=1*db;ab.y=-bb;ab.z=0*db;cb.copy(ab);ab.normalize();t.push(ab.x,ab.y,ab.z);break;case a.length-1:t.push(cb.x,cb.y,cb.z);break;default:bb=a[gb+1].x-a[gb].x,db=a[gb+1].y-a[gb].y,ab.x=1*db,ab.y=-bb,ab.z=0*db,eb.copy(ab),ab.x+=cb.x,ab.y+=cb.y,ab.z+=cb.z,ab.normalize(),t.push(ab.x,ab.y,ab.z),cb.copy(eb)}for(ab=0;ab<=b;ab++)for(cb=e+ab*x*f,eb=Math.sin(cb),cb=Math.cos(cb),bb=0;bb<=a.length-1;bb++)y.x=a[bb].x*eb,y.y=a[bb].y,
y.z=a[bb].x*cb,n.push(y.x,y.y,y.z),z.x=ab/b,z.y=bb/(a.length-1),r.push(z.x,z.y),w.push(t[3*bb]*eb,t[3*bb+1],t[3*bb]*cb);for(e=0;e<b;e++)for(f=0;f<a.length-1;f++)t=f+e*a.length,x=t+a.length,y=t+a.length+1,z=t+1,h.push(t,x,z),h.push(y,z,x);this.setIndex(h);this.setAttribute("position",new $b(n,3));this.setAttribute("uv",new $b(r,2));this.setAttribute("normal",new $b(w,3))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new dm(a.points,a.segments,
a.phiStart,a.phiLength)}}class tp extends dm{constructor(a=1,b=1,e=4,f=8){const h=new sk;h.absarc(0,-b/2,a,1.5*Math.PI,0);h.absarc(0,b/2,a,0,.5*Math.PI);super(h.getPoints(e),f);this.type="CapsuleGeometry";this.parameters={radius:a,length:b,capSegments:e,radialSegments:f}}static fromJSON(a){return new tp(a.radius,a.length,a.capSegments,a.radialSegments)}}class up extends md{constructor(a=1,b=32,e=0,f=2*Math.PI){super();this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:e,thetaLength:f};
b=Math.max(3,b);const h=[],n=[],r=[],t=[],w=new mb,x=new Lb;n.push(0,0,0);r.push(0,0,1);t.push(.5,.5);for(let y=0,z=3;y<=b;y++,z+=3){const ab=e+y/b*f;w.x=a*Math.cos(ab);w.y=a*Math.sin(ab);n.push(w.x,w.y,w.z);r.push(0,0,1);x.x=(n[z]/a+1)/2;x.y=(n[z+1]/a+1)/2;t.push(x.x,x.y)}for(a=1;a<=b;a++)h.push(a,a+1,0);this.setIndex(h);this.setAttribute("position",new $b(n,3));this.setAttribute("normal",new $b(r,3));this.setAttribute("uv",new $b(t,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);
return this}static fromJSON(a){return new up(a.radius,a.segments,a.thetaStart,a.thetaLength)}}class pk extends md{constructor(a=1,b=1,e=1,f=32,h=1,n=!1,r=0,t=2*Math.PI){function w(kb){const qb=cb;var ob=new Lb,pb=new mb;let ub=0;var rb=!0===kb?a:b;const Ab=!0===kb?1:-1;for(var wb=1;wb<=f;wb++)z.push(0,bb*Ab,0),ab.push(0,Ab,0),eb.push(.5,.5),cb++;wb=cb;for(let Fb=0;Fb<=f;Fb++){var Cb=Fb/f*t+r;const Ob=Math.cos(Cb);Cb=Math.sin(Cb);pb.x=rb*Cb;pb.y=bb*Ab;pb.z=rb*Ob;z.push(pb.x,pb.y,pb.z);ab.push(0,Ab,
0);ob.x=.5*Ob+.5;ob.y=.5*Cb*Ab+.5;eb.push(ob.x,ob.y);cb++}for(ob=0;ob<f;ob++)pb=qb+ob,rb=wb+ob,!0===kb?y.push(rb,rb+1,pb):y.push(rb+1,rb,pb),ub+=3;x.addGroup(gb,ub,!0===kb?1:2);gb+=ub}super();this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:e,radialSegments:f,heightSegments:h,openEnded:n,thetaStart:r,thetaLength:t};const x=this;f=Math.floor(f);h=Math.floor(h);const y=[],z=[],ab=[],eb=[];let cb=0;const db=[],bb=e/2;let gb=0;(function(){var kb=new mb,qb=new mb;let ob=
0;var pb=(b-a)/e;for(var ub=0;ub<=h;ub++){var rb=[];const wb=ub/h,Cb=wb*(b-a)+a;for(let Fb=0;Fb<=f;Fb++){const Ob=Fb/f;var Ab=Ob*t+r;const Gb=Math.sin(Ab);Ab=Math.cos(Ab);qb.x=Cb*Gb;qb.y=-wb*e+bb;qb.z=Cb*Ab;z.push(qb.x,qb.y,qb.z);kb.set(Gb,pb,Ab).normalize();ab.push(kb.x,kb.y,kb.z);eb.push(Ob,1-wb);rb.push(cb++)}db.push(rb)}for(kb=0;kb<f;kb++)for(qb=0;qb<h;qb++)pb=db[qb+1][kb],ub=db[qb+1][kb+1],rb=db[qb][kb+1],y.push(db[qb][kb],pb,rb),y.push(pb,ub,rb),ob+=6;x.addGroup(gb,ob,0);gb+=ob})();!1===n&&
(0<a&&w(!0),0<b&&w(!1));this.setIndex(y);this.setAttribute("position",new $b(z,3));this.setAttribute("normal",new $b(ab,3));this.setAttribute("uv",new $b(eb,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new pk(a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength)}}class vp extends pk{constructor(a=1,b=1,e=32,f=1,h=!1,n=0,r=2*Math.PI){super(0,a,b,e,f,h,n,r);this.type="ConeGeometry";
this.parameters={radius:a,height:b,radialSegments:e,heightSegments:f,openEnded:h,thetaStart:n,thetaLength:r}}static fromJSON(a){return new vp(a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength)}}class cj extends md{constructor(a=[],b=[],e=1,f=0){function h(x){t.push(x.x,x.y,x.z)}function n(x,y){x*=3;y.x=a[x+0];y.y=a[x+1];y.z=a[x+2]}function r(x,y,z,ab){0>ab&&1===x.x&&(w[y]=x.x-1);0===z.x&&0===z.z&&(w[y]=ab/2/Math.PI+.5)}super();this.type="PolyhedronGeometry";
this.parameters={vertices:a,indices:b,radius:e,detail:f};const t=[],w=[];(function(x){const y=new mb,z=new mb,ab=new mb;for(let bb=0;bb<b.length;bb+=3){n(b[bb+0],y);n(b[bb+1],z);n(b[bb+2],ab);const gb=x+1,kb=[];for(var eb=0;eb<=gb;eb++){kb[eb]=[];var cb=y.clone().lerp(ab,eb/gb),db=z.clone().lerp(ab,eb/gb);const qb=gb-eb;for(let ob=0;ob<=qb;ob++)kb[eb][ob]=0===ob&&eb===gb?cb:cb.clone().lerp(db,ob/qb)}for(eb=0;eb<gb;eb++)for(cb=0;cb<2*(gb-eb)-1;cb++)db=Math.floor(cb/2),0===cb%2?(h(kb[eb][db+1]),h(kb[eb+
1][db]),h(kb[eb][db])):(h(kb[eb][db+1]),h(kb[eb+1][db+1]),h(kb[eb+1][db]))}})(f);(function(x){const y=new mb;for(let z=0;z<t.length;z+=3)y.x=t[z+0],y.y=t[z+1],y.z=t[z+2],y.normalize().multiplyScalar(x),t[z+0]=y.x,t[z+1]=y.y,t[z+2]=y.z})(e);(function(){var x=new mb;for(var y=0;y<t.length;y+=3)x.x=t[y+0],x.y=t[y+1],x.z=t[y+2],w.push(Math.atan2(x.z,-x.x)/2/Math.PI+.5,1-(Math.atan2(-x.y,Math.sqrt(x.x*x.x+x.z*x.z))/Math.PI+.5));x=new mb;y=new mb;var z=new mb,ab=new mb,eb=new Lb;const cb=new Lb,db=new Lb;
for(let bb=0,gb=0;bb<t.length;bb+=9,gb+=6){x.set(t[bb+0],t[bb+1],t[bb+2]);y.set(t[bb+3],t[bb+4],t[bb+5]);z.set(t[bb+6],t[bb+7],t[bb+8]);eb.set(w[gb+0],w[gb+1]);cb.set(w[gb+2],w[gb+3]);db.set(w[gb+4],w[gb+5]);ab.copy(x).add(y).add(z).divideScalar(3);const kb=Math.atan2(ab.z,-ab.x);r(eb,gb+0,x,kb);r(cb,gb+2,y,kb);r(db,gb+4,z,kb)}for(x=0;x<w.length;x+=6)y=w[x+0],z=w[x+2],ab=w[x+4],eb=Math.min(y,z,ab),.9<Math.max(y,z,ab)&&.1>eb&&(.2>y&&(w[x+0]+=1),.2>z&&(w[x+2]+=1),.2>ab&&(w[x+4]+=1))})();this.setAttribute("position",
new $b(t,3));this.setAttribute("normal",new $b(t.slice(),3));this.setAttribute("uv",new $b(w,2));0===f?this.computeVertexNormals():this.normalizeNormals()}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new cj(a.vertices,a.indices,a.radius,a.details)}}class zp extends cj{constructor(a=1,b=0){const e=(1+Math.sqrt(5))/2,f=1/e;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-f,-e,0,-f,e,0,f,-e,0,f,e,-f,-e,0,-f,e,0,f,-e,0,
f,e,0,-e,0,-f,e,0,-f,-e,0,f,e,0,f],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b}}static fromJSON(a){return new zp(a.radius,a.detail)}}const Im=new mb,Jm=new mb,Gq=new mb,ek=new Hf;class dw extends md{constructor(a=
null,b=1){super();this.type="EdgesGeometry";this.parameters={geometry:a,thresholdAngle:b};if(null!==a){const r=Math.pow(10,4);b=Math.cos(hj*b);const t=a.getIndex();a=a.getAttribute("position");const w=t?t.count:a.count,x=[0,0,0],y=["a","b","c"],z=Array(3),ab={},eb=[];for(let cb=0;cb<w;cb+=3){t?(x[0]=t.getX(cb),x[1]=t.getX(cb+1),x[2]=t.getX(cb+2)):(x[0]=cb,x[1]=cb+1,x[2]=cb+2);var e=ek.a,f=ek.b,h=ek.c;e.fromBufferAttribute(a,x[0]);f.fromBufferAttribute(a,x[1]);h.fromBufferAttribute(a,x[2]);ek.getNormal(Gq);
z[0]=`${Math.round(e.x*r)},${Math.round(e.y*r)},${Math.round(e.z*r)}`;z[1]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`;z[2]=`${Math.round(h.x*r)},${Math.round(h.y*r)},${Math.round(h.z*r)}`;if(z[0]!==z[1]&&z[1]!==z[2]&&z[2]!==z[0])for(e=0;3>e;e++){f=(e+1)%3;var n=z[e];const db=z[f];h=ek[y[e]];const bb=ek[y[f]],gb=`${n}_${db}`;n=`${db}_${n}`;n in ab&&ab[n]?(Gq.dot(ab[n].normal)<=b&&(eb.push(h.x,h.y,h.z),eb.push(bb.x,bb.y,bb.z)),ab[n]=null):gb in ab||(ab[gb]={index0:x[e],index1:x[f],
normal:Gq.clone()})}}for(const cb in ab)if(ab[cb]){const {index0:db,index1:bb}=ab[cb];Im.fromBufferAttribute(a,db);Jm.fromBufferAttribute(a,bb);eb.push(Im.x,Im.y,Im.z);eb.push(Jm.x,Jm.y,Jm.z)}this.setAttribute("position",new $b(eb,3))}}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}}class ej extends sk{constructor(a){super(a);this.uuid=fd();this.type="Shape";this.holes=[]}getPointsHoles(a){const b=[];for(let e=0,f=this.holes.length;e<f;e++)b[e]=this.holes[e].getPoints(a);
return b}extractPoints(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}}copy(a){super.copy(a);this.holes=[];for(let b=0,e=a.holes.length;b<e;b++)this.holes.push(a.holes[b].clone());return this}toJSON(){const a=super.toJSON();a.uuid=this.uuid;a.holes=[];for(let b=0,e=this.holes.length;b<e;b++)a.holes.push(this.holes[b].toJSON());return a}fromJSON(a){super.fromJSON(a);this.uuid=a.uuid;this.holes=[];for(let b=0,e=a.holes.length;b<e;b++){const f=a.holes[b];this.holes.push((new sk).fromJSON(f))}return this}}
const rB={cA:function(a,b,e=2){var f=b&&b.length;const h=f?b[0]*e:a.length;var n=xv(a,0,h,e,!0);const r=[];if(!n||n.next===n.prev)return r;let t,w;var x;if(f){var y=n;n=[];var z;f=0;for(z=b.length;f<z;f++){var ab=b[f]*e;var eb=f<z-1?b[f+1]*e:a.length;var cb=xv(a,ab,eb,e,!1);cb===cb.next&&(cb.steiner=!0);ab=n;eb=ab.push;var db=cb,bb=cb;do{if(db.x<bb.x||db.x===bb.x&&db.y<bb.y)bb=db;db=db.next}while(db!==cb);eb.call(ab,bb)}n.sort(Gz);for(f=0;f<n.length;f++){z=void 0;b=n[f];b:{ab=y;eb=-Infinity;cb=b.x;
db=b.y;do{if(db<=ab.y&&db>=ab.next.y&&ab.next.y!==ab.y&&(bb=ab.x+(db-ab.y)*(ab.next.x-ab.x)/(ab.next.y-ab.y),bb<=cb&&bb>eb&&(eb=bb,z=ab.x<ab.next.x?ab:ab.next,bb===cb)))break b;ab=ab.next}while(ab!==y);if(z){var gb=z,kb=z.x,qb=z.y,ob=Infinity;ab=z;do{if(cb>=ab.x&&ab.x>=kb&&cb!==ab.x&&Fj(db<qb?cb:eb,db,kb,qb,db<qb?eb:cb,db,ab.x,ab.y)){bb=Math.abs(db-ab.y)/(cb-ab.x);var pb;if((pb=nk(ab,b))&&!(pb=bb<ob)&&(pb=bb===ob)&&!(pb=ab.x>z.x)&&(pb=ab.x===z.x)){pb=z;var ub=ab;pb=0>Vd(pb.prev,pb,ub.prev)&&0>Vd(ub.next,
pb,pb.next)}pb&&(z=ab,ob=bb)}ab=ab.next}while(ab!==gb)}else z=null}z&&(b=Av(z,b),Ug(b,b.next),y=Ug(z,z.next))}n=y}if(a.length>80*e){t=x=a[0];w=f=a[1];for(z=e;z<h;z+=e)b=a[z],y=a[z+1],b<t&&(t=b),y<w&&(w=y),b>x&&(x=b),y>f&&(f=y);x=Math.max(x-t,f-w);x=0!==x?32767/x:0}mk(n,r,e,t,w,x,0);return r}};class og{static area(a){const b=a.length;let e=0;for(let f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return.5*e}static isClockWise(a){return 0>og.area(a)}static triangulateShape(a,b){var e=[];const f=
[],h=[];Bv(a);Cv(e,a);a=a.length;b.forEach(Bv);for(let n=0;n<b.length;n++)f.push(a),a+=b[n].length,Cv(e,b[n]);b=rB.cA(e,f);for(e=0;e<b.length;e+=3)h.push(b.slice(e,e+3));return h}}class Ap extends md{constructor(a=new ej([new Lb(.5,.5),new Lb(-.5,.5),new Lb(-.5,-.5),new Lb(.5,-.5)]),b={}){function e(r){function t(zb,Jb,Db){Jb||console.error("THREE.ExtrudeGeometry: vec does not exist");return zb.clone().addScaledVector(Jb,Db)}function w(zb,Jb,Db){var yb=zb.x-Jb.x;var lb=zb.y-Jb.y;var Eb=Db.x-zb.x;
var Bb=Db.y-zb.y,Qb=yb*yb+lb*lb;if(Math.abs(yb*Bb-lb*Eb)>Number.EPSILON){const Mb=Math.sqrt(Qb),Wb=Math.sqrt(Eb*Eb+Bb*Bb);Qb=Jb.x-lb/Mb;Jb=Jb.y+yb/Mb;Bb=((Db.x-Bb/Wb-Qb)*Bb-(Db.y+Eb/Wb-Jb)*Eb)/(yb*Bb-lb*Eb);Eb=Qb+yb*Bb-zb.x;yb=Jb+lb*Bb-zb.y;lb=Eb*Eb+yb*yb;if(2>=lb)return new Lb(Eb,yb);lb=Math.sqrt(lb/2)}else zb=!1,yb>Number.EPSILON?Eb>Number.EPSILON&&(zb=!0):yb<-Number.EPSILON?Eb<-Number.EPSILON&&(zb=!0):Math.sign(lb)===Math.sign(Bb)&&(zb=!0),zb?(Eb=-lb,lb=Math.sqrt(Qb)):(Eb=yb,yb=lb,lb=Math.sqrt(Qb/
2));return new Lb(Eb/lb,yb/lb)}function x(zb,Jb){let Db=zb.length;for(;0<=--Db;){const Bb=Db;let Qb=Db-1;0>Qb&&(Qb=zb.length-1);for(let Mb=0,Wb=bb+2*ub;Mb<Wb;Mb++){const Dd=Yb*Mb;var yb=Yb*(Mb+1),lb=Jb+Qb+Dd,Eb=Jb+Qb+yb;yb=Jb+Bb+yb;ab(Jb+Bb+Dd);ab(lb);ab(yb);ab(lb);ab(Eb);ab(yb);lb=h.length/3;lb=Ab.generateSideWallUV(f,h,lb-6,lb-3,lb-2,lb-1);eb(lb[0]);eb(lb[1]);eb(lb[3]);eb(lb[1]);eb(lb[2]);eb(lb[3])}}}function y(zb,Jb,Db){cb.push(zb);cb.push(Jb);cb.push(Db)}function z(zb,Jb,Db){ab(zb);ab(Jb);ab(Db);
zb=h.length/3;zb=Ab.generateTopUV(f,h,zb-3,zb-2,zb-1);eb(zb[0]);eb(zb[1]);eb(zb[2])}function ab(zb){h.push(cb[3*zb]);h.push(cb[3*zb+1]);h.push(cb[3*zb+2])}function eb(zb){n.push(zb.x);n.push(zb.y)}const cb=[];var db=void 0!==b.curveSegments?b.curveSegments:12;const bb=void 0!==b.steps?b.steps:1,gb=void 0!==b.depth?b.depth:1;let kb=void 0!==b.bevelEnabled?b.bevelEnabled:!0,qb=void 0!==b.bevelThickness?b.bevelThickness:.2,ob=void 0!==b.bevelSize?b.bevelSize:qb-.1,pb=void 0!==b.bevelOffset?b.bevelOffset:
0,ub=void 0!==b.bevelSegments?b.bevelSegments:3;var rb=b.extrudePath;const Ab=void 0!==b.UVGenerator?b.UVGenerator:sB;let wb,Cb=!1;if(rb){wb=rb.getSpacedPoints(bb);Cb=!0;kb=!1;var Fb=rb.computeFrenetFrames(bb,!1);var Ob=new mb;var Gb=new mb;var Nb=new mb}kb||(pb=ob=qb=ub=0);r=r.extractPoints(db);rb=r.shape;const Rb=r.holes;if(!og.isClockWise(rb)){rb=rb.reverse();for(let zb=0,Jb=Rb.length;zb<Jb;zb++)r=Rb[zb],og.isClockWise(r)&&(Rb[zb]=r.reverse())}const Pb=og.triangulateShape(rb,Rb),wd=rb;for(let zb=
0,Jb=Rb.length;zb<Jb;zb++)rb=rb.concat(Rb[zb]);const Yb=rb.length,Sb=Pb.length;r=[];for(let zb=0,Jb=wd.length,Db=Jb-1,yb=zb+1;zb<Jb;zb++,Db++,yb++)Db===Jb&&(Db=0),yb===Jb&&(yb=0),r[zb]=w(wd[zb],wd[Db],wd[yb]);db=[];let hb=r.concat();for(let zb=0,Jb=Rb.length;zb<Jb;zb++){var ib=Rb[zb];var nb=[];for(let Db=0,yb=ib.length,lb=yb-1,Eb=Db+1;Db<yb;Db++,lb++,Eb++)lb===yb&&(lb=0),Eb===yb&&(Eb=0),nb[Db]=w(ib[Db],ib[lb],ib[Eb]);db.push(nb);hb=hb.concat(nb)}for(ib=0;ib<ub;ib++){nb=ib/ub;var tb=qb*Math.cos(nb*
Math.PI/2),sb=ob*Math.sin(nb*Math.PI/2)+pb;for(let zb=0,Jb=wd.length;zb<Jb;zb++)nb=t(wd[zb],r[zb],sb),y(nb.x,nb.y,-tb);for(let zb=0,Jb=Rb.length;zb<Jb;zb++){const Db=Rb[zb];nb=db[zb];for(let yb=0,lb=Db.length;yb<lb;yb++){const Eb=t(Db[yb],nb[yb],sb);y(Eb.x,Eb.y,-tb)}}}nb=ob+pb;for(ib=0;ib<Yb;ib++)tb=kb?t(rb[ib],hb[ib],nb):rb[ib],Cb?(Gb.copy(Fb.normals[0]).multiplyScalar(tb.x),Ob.copy(Fb.binormals[0]).multiplyScalar(tb.y),Nb.copy(wb[0]).add(Gb).add(Ob),y(Nb.x,Nb.y,Nb.z)):y(tb.x,tb.y,0);for(ib=1;ib<=
bb;ib++)for(tb=0;tb<Yb;tb++)sb=kb?t(rb[tb],hb[tb],nb):rb[tb],Cb?(Gb.copy(Fb.normals[ib]).multiplyScalar(sb.x),Ob.copy(Fb.binormals[ib]).multiplyScalar(sb.y),Nb.copy(wb[ib]).add(Gb).add(Ob),y(Nb.x,Nb.y,Nb.z)):y(sb.x,sb.y,gb/bb*ib);for(Fb=ub-1;0<=Fb;Fb--){Gb=Fb/ub;Ob=qb*Math.cos(Gb*Math.PI/2);Gb=ob*Math.sin(Gb*Math.PI/2)+pb;for(let zb=0,Jb=wd.length;zb<Jb;zb++)Nb=t(wd[zb],r[zb],Gb),y(Nb.x,Nb.y,gb+Ob);for(let zb=0,Jb=Rb.length;zb<Jb;zb++){Nb=Rb[zb];nb=db[zb];for(let Db=0,yb=Nb.length;Db<yb;Db++)rb=t(Nb[Db],
nb[Db],Gb),Cb?y(rb.x,rb.y+wb[bb-1].y,wb[bb-1].x+Ob):y(rb.x,rb.y,gb+Ob)}}(function(){const zb=h.length/3;if(kb){var Jb=0*Yb;for(var Db=0;Db<Sb;Db++){var yb=Pb[Db];z(yb[2]+Jb,yb[1]+Jb,yb[0]+Jb)}Jb=Yb*(bb+2*ub);for(Db=0;Db<Sb;Db++)yb=Pb[Db],z(yb[0]+Jb,yb[1]+Jb,yb[2]+Jb)}else{for(Jb=0;Jb<Sb;Jb++)Db=Pb[Jb],z(Db[2],Db[1],Db[0]);for(Jb=0;Jb<Sb;Jb++)Db=Pb[Jb],z(Db[0]+Yb*bb,Db[1]+Yb*bb,Db[2]+Yb*bb)}f.addGroup(zb,h.length/3-zb,0)})();(function(){const zb=h.length/3;let Jb=0;x(wd,Jb);Jb+=wd.length;for(let Db=
0,yb=Rb.length;Db<yb;Db++){const lb=Rb[Db];x(lb,Jb);Jb+=lb.length}f.addGroup(zb,h.length/3-zb,1)})()}super();this.type="ExtrudeGeometry";this.parameters={shapes:a,options:b};a=Array.isArray(a)?a:[a];const f=this,h=[],n=[];for(let r=0,t=a.length;r<t;r++)e(a[r]);this.setAttribute("position",new $b(h,3));this.setAttribute("uv",new $b(n,2));this.computeVertexNormals()}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}toJSON(){const a=super.toJSON();var b=this.parameters.shapes,
e=this.parameters.options;a.shapes=[];if(Array.isArray(b))for(let f=0,h=b.length;f<h;f++)a.shapes.push(b[f].uuid);else a.shapes.push(b.uuid);a.options=Object.assign({},e);void 0!==e.extrudePath&&(a.options.extrudePath=e.extrudePath.toJSON());return a}static fromJSON(a,b){const e=[];for(let f=0,h=a.shapes.length;f<h;f++)e.push(b[a.shapes[f]]);b=a.options.extrudePath;void 0!==b&&(a.options.extrudePath=(new Hm[b.type]).fromJSON(b));return new Ap(e,a.options)}}const sB={generateTopUV:function(a,b,e,f,
h){a=b[3*f];f=b[3*f+1];const n=b[3*h];h=b[3*h+1];return[new Lb(b[3*e],b[3*e+1]),new Lb(a,f),new Lb(n,h)]},generateSideWallUV:function(a,b,e,f,h,n){a=b[3*e];const r=b[3*e+1];e=b[3*e+2];const t=b[3*f],w=b[3*f+1];f=b[3*f+2];const x=b[3*h],y=b[3*h+1];h=b[3*h+2];const z=b[3*n],ab=b[3*n+1];b=b[3*n+2];return Math.abs(r-w)<Math.abs(a-t)?[new Lb(a,1-e),new Lb(t,1-f),new Lb(x,1-h),new Lb(z,1-b)]:[new Lb(r,1-e),new Lb(w,1-f),new Lb(y,1-h),new Lb(ab,1-b)]}};class Ep extends cj{constructor(a=1,b=0){const e=(1+
Math.sqrt(5))/2;super([-1,e,0,1,e,0,-1,-e,0,1,-e,0,0,-1,e,0,1,e,0,-1,-e,0,1,-e,e,0,-1,e,0,1,-e,0,-1,-e,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}}static fromJSON(a){return new Ep(a.radius,a.detail)}}class em extends cj{constructor(a=1,b=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,
2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}}static fromJSON(a){return new em(a.radius,a.detail)}}class Op extends md{constructor(a=.5,b=1,e=32,f=1,h=0,n=2*Math.PI){super();this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:e,phiSegments:f,thetaStart:h,thetaLength:n};e=Math.max(3,e);f=Math.max(1,f);const r=[],t=[],w=[],x=[];var y=a;a=(b-a)/f;var z=new mb,ab=new Lb;for(let eb=0;eb<=f;eb++){for(let cb=0;cb<=e;cb++){const db=h+cb/e*n;z.x=
y*Math.cos(db);z.y=y*Math.sin(db);t.push(z.x,z.y,z.z);w.push(0,0,1);ab.x=(z.x/b+1)/2;ab.y=(z.y/b+1)/2;x.push(ab.x,ab.y)}y+=a}for(b=0;b<f;b++)for(h=b*(e+1),n=0;n<e;n++)y=n+h,a=y+e+1,z=y+e+2,ab=y+1,r.push(y,a,ab),r.push(a,z,ab);this.setIndex(r);this.setAttribute("position",new $b(t,3));this.setAttribute("normal",new $b(w,3));this.setAttribute("uv",new $b(x,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new Op(a.innerRadius,a.outerRadius,
a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength)}}class Qp extends md{constructor(a=new ej([new Lb(0,.5),new Lb(-.5,-.5),new Lb(.5,-.5)]),b=12){function e(x){const y=h.length/3;var z=x.extractPoints(b);x=z.shape;var ab=z.holes;!1===og.isClockWise(x)&&(x=x.reverse());for(let eb=0,cb=ab.length;eb<cb;eb++)z=ab[eb],!0===og.isClockWise(z)&&(ab[eb]=z.reverse());z=og.triangulateShape(x,ab);for(let eb=0,cb=ab.length;eb<cb;eb++)x=x.concat(ab[eb]);for(let eb=0,cb=x.length;eb<cb;eb++)ab=x[eb],h.push(ab.x,
ab.y,0),n.push(0,0,1),r.push(ab.x,ab.y);for(let eb=0,cb=z.length;eb<cb;eb++)x=z[eb],f.push(x[0]+y,x[1]+y,x[2]+y),w+=3}super();this.type="ShapeGeometry";this.parameters={shapes:a,curveSegments:b};const f=[],h=[],n=[],r=[];let t=0,w=0;if(!1===Array.isArray(a))e(a);else for(let x=0;x<a.length;x++)e(a[x]),this.addGroup(t,w,x),t+=w,w=0;this.setIndex(f);this.setAttribute("position",new $b(h,3));this.setAttribute("normal",new $b(n,3));this.setAttribute("uv",new $b(r,2))}copy(a){super.copy(a);this.parameters=
Object.assign({},a.parameters);return this}toJSON(){const a=super.toJSON();var b=this.parameters.shapes;a.shapes=[];if(Array.isArray(b))for(let e=0,f=b.length;e<f;e++)a.shapes.push(b[e].uuid);else a.shapes.push(b.uuid);return a}static fromJSON(a,b){const e=[];for(let f=0,h=a.shapes.length;f<h;f++)e.push(b[a.shapes[f]]);return new Qp(e,a.curveSegments)}}class kg extends md{constructor(a=1,b=32,e=16,f=0,h=2*Math.PI,n=0,r=Math.PI){super();this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,
heightSegments:e,phiStart:f,phiLength:h,thetaStart:n,thetaLength:r};b=Math.max(3,Math.floor(b));e=Math.max(2,Math.floor(e));const t=Math.min(n+r,Math.PI);var w=0;const x=[];var y=new mb;const z=new mb,ab=[],eb=[],cb=[],db=[];for(let bb=0;bb<=e;bb++){const gb=[],kb=bb/e;let qb=0;0===bb&&0===n?qb=.5/b:bb===e&&t===Math.PI&&(qb=-.5/b);for(let ob=0;ob<=b;ob++){const pb=ob/b;y.x=-a*Math.cos(f+pb*h)*Math.sin(n+kb*r);y.y=a*Math.cos(n+kb*r);y.z=a*Math.sin(f+pb*h)*Math.sin(n+kb*r);eb.push(y.x,y.y,y.z);z.copy(y).normalize();
cb.push(z.x,z.y,z.z);db.push(pb+qb,1-kb);gb.push(w++)}x.push(gb)}for(a=0;a<e;a++)for(f=0;f<b;f++)h=x[a][f+1],r=x[a][f],w=x[a+1][f],y=x[a+1][f+1],(0!==a||0<n)&&ab.push(h,r,y),(a!==e-1||t<Math.PI)&&ab.push(r,w,y);this.setIndex(ab);this.setAttribute("position",new $b(eb,3));this.setAttribute("normal",new $b(cb,3));this.setAttribute("uv",new $b(db,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new kg(a.radius,a.widthSegments,a.heightSegments,
a.phiStart,a.phiLength,a.thetaStart,a.thetaLength)}}class Vp extends cj{constructor(a=1,b=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}}static fromJSON(a){return new Vp(a.radius,a.detail)}}class Wp extends md{constructor(a=1,b=.4,e=12,f=48,h=2*Math.PI){super();this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:e,tubularSegments:f,arc:h};e=Math.floor(e);f=Math.floor(f);const n=[],r=
[],t=[],w=[];var x=new mb,y=new mb;const z=new mb;for(let ab=0;ab<=e;ab++)for(let eb=0;eb<=f;eb++){const cb=eb/f*h,db=ab/e*Math.PI*2;y.x=(a+b*Math.cos(db))*Math.cos(cb);y.y=(a+b*Math.cos(db))*Math.sin(cb);y.z=b*Math.sin(db);r.push(y.x,y.y,y.z);x.x=a*Math.cos(cb);x.y=a*Math.sin(cb);z.subVectors(y,x).normalize();t.push(z.x,z.y,z.z);w.push(eb/f);w.push(ab/e)}for(a=1;a<=e;a++)for(b=1;b<=f;b++)h=(f+1)*(a-1)+b-1,x=(f+1)*(a-1)+b,y=(f+1)*a+b,n.push((f+1)*a+b-1,h,y),n.push(h,x,y);this.setIndex(n);this.setAttribute("position",
new $b(r,3));this.setAttribute("normal",new $b(t,3));this.setAttribute("uv",new $b(w,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}static fromJSON(a){return new Wp(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc)}}class Xp extends md{constructor(a=1,b=.4,e=64,f=8,h=2,n=3){function r(ob,pb,ub,rb,Ab){const wb=Math.sin(ob);pb=ub/pb*ob;ub=Math.cos(pb);Ab.x=rb*(2+ub)*.5*Math.cos(ob);Ab.y=rb*(2+ub)*wb*.5;Ab.z=rb*Math.sin(pb)*.5}super();this.type="TorusKnotGeometry";
this.parameters={radius:a,tube:b,tubularSegments:e,radialSegments:f,p:h,q:n};e=Math.floor(e);f=Math.floor(f);const t=[],w=[],x=[],y=[];var z=new mb;const ab=new mb,eb=new mb,cb=new mb,db=new mb,bb=new mb,gb=new mb;for(let ob=0;ob<=e;++ob){var kb=ob/e*h*Math.PI*2;r(kb,h,n,a,eb);r(kb+.01,h,n,a,cb);bb.subVectors(cb,eb);gb.addVectors(cb,eb);db.crossVectors(bb,gb);gb.crossVectors(db,bb);db.normalize();gb.normalize();for(kb=0;kb<=f;++kb){var qb=kb/f*Math.PI*2;const pb=-b*Math.cos(qb);qb=b*Math.sin(qb);
z.x=eb.x+(pb*gb.x+qb*db.x);z.y=eb.y+(pb*gb.y+qb*db.y);z.z=eb.z+(pb*gb.z+qb*db.z);w.push(z.x,z.y,z.z);ab.subVectors(z,eb).normalize();x.push(ab.x,ab.y,ab.z);y.push(ob/e);y.push(kb/f)}}for(a=1;a<=e;a++)for(b=1;b<=f;b++)h=(f+1)*a+(b-1),n=(f+1)*a+b,z=(f+1)*(a-1)+b,t.push((f+1)*(a-1)+(b-1),h,z),t.push(h,n,z);this.setIndex(t);this.setAttribute("position",new $b(w,3));this.setAttribute("normal",new $b(x,3));this.setAttribute("uv",new $b(y,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);
return this}static fromJSON(a){return new Xp(a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q)}}class Yp extends md{constructor(a=new Np(new mb(-1,-1,0),new mb(-1,1,0),new mb(1,1,0)),b=64,e=1,f=8,h=!1){function n(db){y=a.getPointAt(db/b,y);const bb=r.normals[db];db=r.binormals[db];for(let kb=0;kb<=f;kb++){var gb=kb/f*Math.PI*2;const qb=Math.sin(gb);gb=-Math.cos(gb);w.x=gb*bb.x+qb*db.x;w.y=gb*bb.y+qb*db.y;w.z=gb*bb.z+qb*db.z;w.normalize();ab.push(w.x,w.y,w.z);t.x=y.x+e*w.x;t.y=y.y+e*w.y;
t.z=y.z+e*w.z;z.push(t.x,t.y,t.z)}}super();this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:e,radialSegments:f,closed:h};const r=a.computeFrenetFrames(b,h);this.tangents=r.tangents;this.normals=r.normals;this.binormals=r.binormals;const t=new mb,w=new mb,x=new Lb;let y=new mb;const z=[],ab=[],eb=[],cb=[];(function(){for(var db=0;db<b;db++)n(db);n(!1===h?b:0);for(db=0;db<=b;db++)for(var bb=0;bb<=f;bb++)x.x=db/b,x.y=bb/f,eb.push(x.x,x.y);for(db=1;db<=b;db++)for(bb=1;bb<=f;bb++){const gb=
(f+1)*db+(bb-1),kb=(f+1)*db+bb,qb=(f+1)*(db-1)+bb;cb.push((f+1)*(db-1)+(bb-1),gb,qb);cb.push(gb,kb,qb)}})();this.setIndex(cb);this.setAttribute("position",new $b(z,3));this.setAttribute("normal",new $b(ab,3));this.setAttribute("uv",new $b(eb,2))}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}toJSON(){const a=super.toJSON();a.path=this.parameters.path.toJSON();return a}static fromJSON(a){return new Yp((new Hm[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,
a.radialSegments,a.closed)}}class Bw extends md{constructor(a=null){super();this.type="WireframeGeometry";this.parameters={geometry:a};if(null!==a){const n=[],r=new Set,t=new mb,w=new mb;if(null!==a.index){var b=a.attributes.position,e=a.index;a=a.groups;0===a.length&&(a=[{start:0,count:e.count,materialIndex:0}]);for(let x=0,y=a.length;x<y;++x){var f=a[x],h=f.start;f=f.count;for(let z=h,ab=h+f;z<ab;z+=3)for(h=0;3>h;h++){f=e.getX(z+h);const eb=e.getX(z+(h+1)%3);t.fromBufferAttribute(b,f);w.fromBufferAttribute(b,
eb);!0===Dv(t,w,r)&&(n.push(t.x,t.y,t.z),n.push(w.x,w.y,w.z))}}}else{b=a.attributes.position;for(let x=0,y=b.count/3;x<y;x++)for(e=0;3>e;e++)a=3*x+(e+1)%3,t.fromBufferAttribute(b,3*x+e),w.fromBufferAttribute(b,a),!0===Dv(t,w,r)&&(n.push(t.x,t.y,t.z),n.push(w.x,w.y,w.z))}this.setAttribute("position",new $b(n,3))}}copy(a){super.copy(a);this.parameters=Object.assign({},a.parameters);return this}}var rx=Object.freeze({__proto__:null,BoxGeometry:Sg,CapsuleGeometry:tp,CircleGeometry:up,ConeGeometry:vp,
CylinderGeometry:pk,DodecahedronGeometry:zp,EdgesGeometry:dw,ExtrudeGeometry:Ap,IcosahedronGeometry:Ep,LatheGeometry:dm,OctahedronGeometry:em,PlaneGeometry:Df,PolyhedronGeometry:cj,RingGeometry:Op,ShapeGeometry:Qp,SphereGeometry:kg,TetrahedronGeometry:Vp,TorusGeometry:Wp,TorusKnotGeometry:Xp,TubeGeometry:Yp,WireframeGeometry:Bw});class ww extends Zd{constructor(a){super();this.isShadowMaterial=!0;this.type="ShadowMaterial";this.color=new Tb(0);this.fog=this.transparent=!0;this.setValues(a)}copy(a){super.copy(a);
this.color.copy(a.color);this.fog=a.fog;return this}}class sw extends Of{constructor(a){super(a);this.isRawShaderMaterial=!0;this.type="RawShaderMaterial"}}class Gj extends Zd{constructor(a){super();this.isMeshStandardMaterial=!0;this.defines={STANDARD:""};this.type="MeshStandardMaterial";this.color=new Tb(16777215);this.roughness=1;this.metalness=0;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new Tb(0);this.emissiveIntensity=1;this.bumpMap=
this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapRotation=new Ff;this.envMapIntensity=1;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.flatShading=!1;this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.defines={STANDARD:""};this.color.copy(a.color);
this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=
a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapRotation.copy(a.envMapRotation);this.envMapIntensity=a.envMapIntensity;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.flatShading=a.flatShading;this.fog=a.fog;return this}}class Wf extends Gj{constructor(a){super();
this.isMeshPhysicalMaterial=!0;this.defines={STANDARD:"",PHYSICAL:""};this.type="MeshPhysicalMaterial";this.anisotropyRotation=0;this.clearcoatMap=this.anisotropyMap=null;this.clearcoatRoughness=0;this.clearcoatRoughnessMap=null;this.clearcoatNormalScale=new Lb(1,1);this.clearcoatNormalMap=null;this.ior=1.5;Object.defineProperty(this,"reflectivity",{get:function(){return jd(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(b){this.ior=(1+.4*b)/(1-.4*b)}});this.iridescenceMap=null;this.iridescenceIOR=
1.3;this.iridescenceThicknessRange=[100,400];this.iridescenceThicknessMap=null;this.sheenColor=new Tb(0);this.sheenColorMap=null;this.sheenRoughness=1;this.transmissionMap=this.sheenRoughnessMap=null;this.thickness=0;this.thicknessMap=null;this.attenuationDistance=Infinity;this.attenuationColor=new Tb(1,1,1);this.specularIntensity=1;this.specularIntensityMap=null;this.specularColor=new Tb(1,1,1);this.specularColorMap=null;this._transmission=this._sheen=this._iridescence=this._clearcoat=this._anisotropy=
0;this.setValues(a)}get anisotropy(){return this._anisotropy}set anisotropy(a){0<this._anisotropy!==0<a&&this.version++;this._anisotropy=a}get clearcoat(){return this._clearcoat}set clearcoat(a){0<this._clearcoat!==0<a&&this.version++;this._clearcoat=a}get iridescence(){return this._iridescence}set iridescence(a){0<this._iridescence!==0<a&&this.version++;this._iridescence=a}get sheen(){return this._sheen}set sheen(a){0<this._sheen!==0<a&&this.version++;this._sheen=a}get transmission(){return this._transmission}set transmission(a){0<
this._transmission!==0<a&&this.version++;this._transmission=a}copy(a){super.copy(a);this.defines={STANDARD:"",PHYSICAL:""};this.anisotropy=a.anisotropy;this.anisotropyRotation=a.anisotropyRotation;this.anisotropyMap=a.anisotropyMap;this.clearcoat=a.clearcoat;this.clearcoatMap=a.clearcoatMap;this.clearcoatRoughness=a.clearcoatRoughness;this.clearcoatRoughnessMap=a.clearcoatRoughnessMap;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.ior=a.ior;
this.iridescence=a.iridescence;this.iridescenceMap=a.iridescenceMap;this.iridescenceIOR=a.iridescenceIOR;this.iridescenceThicknessRange=[...a.iridescenceThicknessRange];this.iridescenceThicknessMap=a.iridescenceThicknessMap;this.sheen=a.sheen;this.sheenColor.copy(a.sheenColor);this.sheenColorMap=a.sheenColorMap;this.sheenRoughness=a.sheenRoughness;this.sheenRoughnessMap=a.sheenRoughnessMap;this.transmission=a.transmission;this.transmissionMap=a.transmissionMap;this.thickness=a.thickness;this.thicknessMap=
a.thicknessMap;this.attenuationDistance=a.attenuationDistance;this.attenuationColor.copy(a.attenuationColor);this.specularIntensity=a.specularIntensity;this.specularIntensityMap=a.specularIntensityMap;this.specularColor.copy(a.specularColor);this.specularColorMap=a.specularColorMap;return this}}class ow extends Zd{constructor(a){super();this.isMeshPhongMaterial=!0;this.type="MeshPhongMaterial";this.color=new Tb(16777215);this.specular=new Tb(1118481);this.shininess=30;this.lightMap=this.map=null;
this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new Tb(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.envMapRotation=new Ff;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
this.wireframeLinecap="round";this.flatShading=!1;this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;
this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapRotation.copy(a.envMapRotation);this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=
a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.flatShading=a.flatShading;this.fog=a.fog;return this}}class pw extends Zd{constructor(a){super();this.isMeshToonMaterial=!0;this.defines={TOON:""};this.type="MeshToonMaterial";this.color=new Tb(16777215);this.lightMap=this.gradientMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new Tb(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=
0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=null;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;this.gradientMap=a.gradientMap;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=
a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;
this.fog=a.fog;return this}}class nw extends Zd{constructor(a){super();this.isMeshNormalMaterial=!0;this.type="MeshNormalMaterial";this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.flatShading=!1;this.setValues(a)}copy(a){super.copy(a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=
a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.flatShading=a.flatShading;return this}}class lw extends Zd{constructor(a){super();this.isMeshLambertMaterial=!0;this.type="MeshLambertMaterial";this.color=new Tb(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=
1;this.emissive=new Tb(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.envMapRotation=new Ff;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.flatShading=!1;this.fog=
!0;this.setValues(a)}copy(a){super.copy(a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=
a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapRotation.copy(a.envMapRotation);this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.flatShading=a.flatShading;this.fog=a.fog;return this}}class mw extends Zd{constructor(a){super();
this.isMeshMatcapMaterial=!0;this.defines={MATCAP:""};this.type="MeshMatcapMaterial";this.color=new Tb(16777215);this.bumpMap=this.map=this.matcap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new Lb(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=null;this.flatShading=!1;this.fog=!0;this.setValues(a)}copy(a){super.copy(a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=
a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.flatShading=a.flatShading;this.fog=a.fog;return this}}class jw extends mf{constructor(a){super();this.isLineDashedMaterial=!0;this.type="LineDashedMaterial";this.scale=1;this.dashSize=3;this.gapSize=1;this.setValues(a)}copy(a){super.copy(a);
this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this}}const Uz={convertArray:Vg,isTypedArray:Ev,getKeyframeOrder:Fv,sortedArray:lp,flattenJSON:mp,subclip:function(a,b,e,f,h=30){a=a.clone();a.name=b;b=[];for(let r=0;r<a.tracks.length;++r){const t=a.tracks[r],w=t.getValueSize(),x=[],y=[];for(let z=0;z<t.times.length;++z){var n=t.times[z]*h;if(!(n<e||n>=f))for(x.push(t.times[z]),n=0;n<w;++n)y.push(t.values[z*w+n])}0!==x.length&&(t.times=Vg(x,t.times.constructor),t.values=Vg(y,
t.values.constructor),b.push(t))}a.tracks=b;e=Infinity;for(f=0;f<a.tracks.length;++f)e>a.tracks[f].times[0]&&(e=a.tracks[f].times[0]);for(f=0;f<a.tracks.length;++f)a.tracks[f].shift(-1*e);a.resetDuration();return a},makeClipAdditive:function(a,b=0,e=a,f=30){0>=f&&(f=30);const h=e.tracks.length;b/=f;for(f=0;f<h;++f){const x=e.tracks[f],y=x.ValueTypeName;if("bool"===y||"string"===y)continue;const z=a.tracks.find(function(cb){return cb.name===x.name&&cb.ValueTypeName===y});if(void 0===z)continue;var n=
0,r=x.getValueSize();x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(n=r/3);let ab=0;const eb=z.getValueSize();z.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(ab=eb/3);var t=x.times.length-1;if(b<=x.times[0])n=x.values.slice(n,r-n);else if(b>=x.times[t])t=t*r+n,n=x.values.slice(t,t+r-n);else{t=x.createInterpolant();var w=n;n=r-n;t.evaluate(b);n=t.resultBuffer.slice(w,n)}"quaternion"===y&&(new rf).fromArray(n).normalize().conjugate().toArray(n);r=z.times.length;for(t=
0;t<r;++t)if(w=t*eb+ab,"quaternion"===y)rf.multiplyQuaternionsFlat(z.values,w,n,0,z.values,w);else{const cb=eb-2*ab;for(let db=0;db<cb;++db)z.values[w+db]-=n[db]}}a.blendMode=2501;return a}};class Jj{constructor(a,b,e,f){this.parameterPositions=a;this._cachedIndex=0;this.resultBuffer=void 0!==f?f:new b.constructor(e);this.sampleValues=b;this.valueSize=e;this.settings=null;this.DefaultSettings_={}}evaluate(a){const b=this.parameterPositions;let e=this._cachedIndex;var f=b[e],h=b[e-1];a:{b:{c:{d:if(!(a<
f)){for(var n=e+2;;){if(void 0===f){if(a<h)break d;this._cachedIndex=e=b.length;return this.copySampleValue_(e-1)}if(e===n)break;h=f;f=b[++e];if(a<f)break b}h=b.length;break c}if(a>=h)break a;else{f=b[1];a<f&&(e=2,h=f);for(n=e-2;;){if(void 0===h)return this._cachedIndex=0,this.copySampleValue_(0);if(e===n)break;f=h;h=b[--e-1];if(a>=h)break b}h=e;e=0}}for(;e<h;)f=e+h>>>1,a<b[f]?h=f:e=f+1;f=b[e];h=b[e-1];if(void 0===h)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===f)return this._cachedIndex=
e=b.length,this.copySampleValue_(e-1)}this._cachedIndex=e;this.intervalChanged_(e,h,f)}return this.interpolate_(e,h,a,f)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(a){const b=this.resultBuffer,e=this.sampleValues,f=this.valueSize;a*=f;for(let h=0;h!==f;++h)b[h]=e[a+h];return b}interpolate_(){throw Error("call to abstract method");}intervalChanged_(){}}class $v extends Jj{constructor(a,b,e,f){super(a,b,e,f);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=
-0;this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(a,b,e){var f=this.parameterPositions;let h=a-2,n=a+1,r=f[h],t=f[n];if(void 0===r)switch(this.getSettings_().endingStart){case 2401:h=a;r=2*b-e;break;case 2402:h=f.length-2;r=b+f[h]-f[h+1];break;default:h=a,r=e}if(void 0===t)switch(this.getSettings_().endingEnd){case 2401:n=a;t=2*e-b;break;case 2402:n=1;t=e+f[1]-f[0];break;default:n=a-1,t=b}a=.5*(e-b);f=this.valueSize;this._weightPrev=a/(b-r);this._weightNext=a/(t-e);this._offsetPrev=
h*f;this._offsetNext=n*f}interpolate_(a,b,e,f){const h=this.resultBuffer,n=this.sampleValues,r=this.valueSize;a*=r;const t=a-r,w=this._offsetPrev,x=this._offsetNext;var y=this._weightPrev,z=this._weightNext,ab=(e-b)/(f-b);e=ab*ab;f=e*ab;b=-y*f+2*y*e-y*ab;y=(1+y)*f+(-1.5-2*y)*e+(-.5+y)*ab+1;ab=(-1-z)*f+(1.5+z)*e+.5*ab;z=z*f-z*e;for(e=0;e!==r;++e)h[e]=b*n[w+e]+y*n[t+e]+ab*n[a+e]+z*n[x+e];return h}}class Hp extends Jj{constructor(a,b,e,f){super(a,b,e,f)}interpolate_(a,b,e,f){const h=this.resultBuffer,
n=this.sampleValues,r=this.valueSize;a*=r;const t=a-r;b=(e-b)/(f-b);e=1-b;for(f=0;f!==r;++f)h[f]=n[t+f]*e+n[a+f]*b;return h}}class cw extends Jj{constructor(a,b,e,f){super(a,b,e,f)}interpolate_(a){return this.copySampleValue_(a-1)}}class Uf{constructor(a,b,e,f){if(void 0===a)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===b||0===b.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+a);this.name=a;this.times=Vg(b,this.TimeBufferType);this.values=Vg(e,this.ValueBufferType);
this.setInterpolation(f||this.DefaultInterpolation)}static toJSON(a){var b=a.constructor;if(b.toJSON!==this.toJSON)b=b.toJSON(a);else{b={name:a.name,times:Vg(a.times,Array),values:Vg(a.values,Array)};const e=a.getInterpolation();e!==a.DefaultInterpolation&&(b.interpolation=e)}b.type=a.ValueTypeName;return b}InterpolantFactoryMethodDiscrete(a){return new cw(this.times,this.values,this.getValueSize(),a)}InterpolantFactoryMethodLinear(a){return new Hp(this.times,this.values,this.getValueSize(),a)}InterpolantFactoryMethodSmooth(a){return new $v(this.times,
this.values,this.getValueSize(),a)}setInterpolation(a){switch(a){case 2300:var b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(b);console.warn("THREE.KeyframeTrack:",
b);return this}this.createInterpolant=b;return this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(a){if(0!==a){const b=this.times;for(let e=0,f=b.length;e!==f;++e)b[e]+=a}return this}scale(a){if(1!==a){const b=this.times;for(let e=0,f=b.length;e!==f;++e)b[e]*=a}return this}trim(a,
b){const e=this.times,f=e.length;let h=0,n=f-1;for(;h!==f&&e[h]<a;)++h;for(;-1!==n&&e[n]>b;)--n;++n;if(0!==h||n!==f)h>=n&&(n=Math.max(n,1),h=n-1),a=this.getValueSize(),this.times=e.slice(h,n),this.values=this.values.slice(h*a,n*a);return this}validate(){let a=!0;var b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var e=this.times;b=this.values;const f=e.length;0===f&&(console.error("THREE.KeyframeTrack: Track is empty.",this),
a=!1);let h=null;for(let n=0;n!==f;n++){const r=e[n];if("number"===typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,n,r);a=!1;break}if(null!==h&&h>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,n,r,h);a=!1;break}h=r}if(void 0!==b&&Ev(b))for(let n=0,r=b.length;n!==r;++n)if(e=b[n],isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,n,e);a=!1;break}return a}optimize(){const a=this.times.slice(),b=this.values.slice(),
e=this.getValueSize(),f=2302===this.getInterpolation(),h=a.length-1;let n=1;for(let x=1;x<h;++x){var r=!1,t=a[x];if(t!==a[x+1]&&(1!==x||t!==a[0]))if(f)r=!0;else{t=x*e;var w=t-e;const y=t+e;for(let z=0;z!==e;++z){const ab=b[t+z];if(ab!==b[w+z]||ab!==b[y+z]){r=!0;break}}}if(r){if(x!==n)for(a[n]=a[x],r=x*e,t=n*e,w=0;w!==e;++w)b[t+w]=b[r+w];++n}}if(0<h){a[n]=a[h];for(let x=h*e,y=n*e,z=0;z!==e;++z)b[y+z]=b[x+z];++n}n!==a.length?(this.times=a.slice(0,n),this.values=b.slice(0,n*e)):(this.times=a,this.values=
b);return this}clone(){const a=new this.constructor(this.name,this.times.slice(),this.values.slice());a.createInterpolant=this.createInterpolant;return a}}Uf.prototype.TimeBufferType=Float32Array;Uf.prototype.ValueBufferType=Float32Array;Uf.prototype.DefaultInterpolation=2301;class Yg extends Uf{}Yg.prototype.ValueTypeName="bool";Yg.prototype.ValueBufferType=Array;Yg.prototype.DefaultInterpolation=2300;Yg.prototype.InterpolantFactoryMethodLinear=void 0;Yg.prototype.InterpolantFactoryMethodSmooth=
void 0;class np extends Uf{}np.prototype.ValueTypeName="color";class Wg extends Uf{}Wg.prototype.ValueTypeName="number";class rw extends Jj{constructor(a,b,e,f){super(a,b,e,f)}interpolate_(a,b,e,f){const h=this.resultBuffer,n=this.sampleValues,r=this.valueSize;b=(e-b)/(f-b);a*=r;for(e=a+r;a!==e;a+=4)rf.slerpFlat(h,0,n,a-r,n,a,b);return h}}class zg extends Uf{InterpolantFactoryMethodLinear(a){return new rw(this.times,this.values,this.getValueSize(),a)}}zg.prototype.ValueTypeName="quaternion";zg.prototype.DefaultInterpolation=
2301;zg.prototype.InterpolantFactoryMethodSmooth=void 0;class Zg extends Uf{}Zg.prototype.ValueTypeName="string";Zg.prototype.ValueBufferType=Array;Zg.prototype.DefaultInterpolation=2300;Zg.prototype.InterpolantFactoryMethodLinear=void 0;Zg.prototype.InterpolantFactoryMethodSmooth=void 0;class Xg extends Uf{}Xg.prototype.ValueTypeName="vector";class Ij{constructor(a="",b=-1,e=[],f=2500){this.name=a;this.tracks=e;this.duration=b;this.blendMode=f;this.uuid=fd();0>this.duration&&this.resetDuration()}static parse(a){var b=
[];const e=a.tracks,f=1/(a.fps||1);for(let t=0,w=e.length;t!==w;++t){var h=b,n=h.push;var r=e[t];if(void 0===r.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");const x=Hz(r.type);if(void 0===r.times){const y=[],z=[];mp(r.keys,y,z,"value");r.times=y;r.values=z}r=void 0!==x.parse?x.parse(r):new x(r.name,r.times,r.values,r.interpolation);n.call(h,r.scale(f))}b=new this(a.name,a.duration,b,a.blendMode);b.uuid=a.uuid;return b}static toJSON(a){const b=[],e=a.tracks;a={name:a.name,
duration:a.duration,tracks:b,uuid:a.uuid,blendMode:a.blendMode};for(let f=0,h=e.length;f!==h;++f)b.push(Uf.toJSON(e[f]));return a}static CreateFromMorphTargetSequence(a,b,e,f){const h=b.length,n=[];for(let r=0;r<h;r++){let t=[],w=[];t.push((r+h-1)%h,r,(r+1)%h);w.push(0,1,0);const x=Fv(t);t=lp(t,1,x);w=lp(w,1,x);f||0!==t[0]||(t.push(h),w.push(w[0]));n.push((new Wg(".morphTargetInfluences["+b[r].name+"]",t,w)).scale(1/e))}return new this(a,-1,n)}static findByName(a,b){let e=a;Array.isArray(a)||(e=a.geometry&&
a.geometry.animations||a.animations);for(a=0;a<e.length;a++)if(e[a].name===b)return e[a];return null}static CreateClipsFromMorphTargetSequences(a,b,e){const f={},h=/^([\w-]*?)([\d]+)$/;for(let r=0,t=a.length;r<t;r++){const w=a[r];var n=w.name.match(h);if(n&&1<n.length){n=n[1];let x=f[n];x||(f[n]=x=[]);x.push(w)}}a=[];for(const r in f)a.push(this.CreateFromMorphTargetSequence(r,f[r],b,e));return a}static parseAnimation(a,b){function e(y,z,ab,eb,cb){if(0!==ab.length){const db=[],bb=[];mp(ab,db,bb,eb);
0!==db.length&&cb.push(new y(z,db,bb))}}if(!a)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const f=[],h=a.name||"default",n=a.fps||30,r=a.blendMode;var t=a.length||-1;a=a.hierarchy||[];for(let y=0;y<a.length;y++){const z=a[y].keys;if(z&&0!==z.length)if(z[0].morphTargets){t={};var w=void 0;for(w=0;w<z.length;w++)if(z[w].morphTargets)for(var x=0;x<z[w].morphTargets.length;x++)t[z[w].morphTargets[x]]=-1;for(const ab in t){x=[];const eb=[];for(let cb=0;cb!==z[w].morphTargets.length;++cb){const db=
z[w];x.push(db.time);eb.push(db.morphTarget===ab?1:0)}f.push(new Wg(".morphTargetInfluence["+ab+"]",x,eb))}t=t.length*n}else w=".bones["+b[y].name+"]",e(Xg,w+".position",z,"pos",f),e(zg,w+".quaternion",z,"rot",f),e(Xg,w+".scale",z,"scl",f)}return 0===f.length?null:new this(h,t,f,r)}resetDuration(){var a=this.tracks;let b=0;for(let e=0,f=a.length;e!==f;++e)a=this.tracks[e],b=Math.max(b,a.times[a.times.length-1]);this.duration=b;return this}trim(){for(let a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,
this.duration);return this}validate(){let a=!0;for(let b=0;b<this.tracks.length;b++)a=a&&this.tracks[b].validate();return a}optimize(){for(let a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}clone(){const a=[];for(let b=0;b<this.tracks.length;b++)a.push(this.tracks[b].clone());return new this.constructor(this.name,this.duration,a,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}const mg={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==
this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};class Ip{constructor(a,b,e){const f=this;let h=!1,n=0,r=0,t=void 0;const w=[];this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=e;this.itemStart=function(x){r++;if(!1===h&&void 0!==f.onStart)f.onStart(x,n,r);h=!0};this.itemEnd=function(x){n++;if(void 0!==f.onProgress)f.onProgress(x,n,r);if(n===r&&(h=!1,void 0!==f.onLoad))f.onLoad()};this.itemError=function(x){if(void 0!==f.onError)f.onError(x)};
this.resolveURL=function(x){return t?t(x):x};this.setURLModifier=function(x){t=x;return this};this.addHandler=function(x,y){w.push(x,y);return this};this.removeHandler=function(x){x=w.indexOf(x);-1!==x&&w.splice(x,2);return this};this.getHandler=function(x){for(let y=0,z=w.length;y<z;y+=2){const ab=w[y],eb=w[y+1];ab.global&&(ab.lastIndex=0);if(ab.test(x))return eb}return null}}}const bw=new Ip;class yf{constructor(a){this.manager=void 0!==a?a:bw;this.crossOrigin="anonymous";this.withCredentials=!1;
this.resourcePath=this.path="";this.requestHeader={}}load(){}loadAsync(a,b){const e=this;return new Promise(function(f,h){e.load(a,f,b,h)})}parse(){}setCrossOrigin(a){this.crossOrigin=a;return this}setWithCredentials(a){this.withCredentials=a;return this}setPath(a){this.path=a;return this}setResourcePath(a){this.resourcePath=a;return this}setRequestHeader(a){this.requestHeader=a;return this}}yf.DEFAULT_MATERIAL_NAME="__DEFAULT";const vg={};class tB extends Error{constructor(a,b){super(a);this.response=
b}}class Tf extends yf{constructor(a){super(a)}load(a,b,e,f){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);const h=mg.get(a);if(void 0!==h)return this.manager.itemStart(a),setTimeout(()=>{b&&b(h);this.manager.itemEnd(a)},0),h;if(void 0!==vg[a])vg[a].push({onLoad:b,onProgress:e,onError:f});else{vg[a]=[];vg[a].push({onLoad:b,onProgress:e,onError:f});e=new Request(a,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});
var n=this.mimeType,r=this.responseType;fetch(e).then(t=>{if(200===t.status||0===t.status){0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");if("undefined"===typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const w=vg[a],x=t.body.getReader(),y=(t=t.headers.get("Content-Length")||t.headers.get("X-File-Size"))?parseInt(t):0,z=0!==y;let ab=0;t=new ReadableStream({start(eb){function cb(){x.read().then(({done:db,value:bb})=>{if(db)eb.close();else{ab+=bb.byteLength;
db=new ProgressEvent("progress",{lengthComputable:z,loaded:ab,total:y});for(let gb=0,kb=w.length;gb<kb;gb++){const qb=w[gb];if(qb.onProgress)qb.onProgress(db)}eb.enqueue(bb);cb()}})}cb()}});return new Response(t)}throw new tB(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t);}).then(t=>{switch(r){case "arraybuffer":return t.arrayBuffer();case "blob":return t.blob();case "document":return t.text().then(y=>(new DOMParser).parseFromString(y,n));case "json":return t.json();default:if(void 0===
n)return t.text();const w=/charset="?([^;"\s]*)"?/i.exec(n),x=new TextDecoder(w&&w[1]?w[1].toLowerCase():void 0);return t.arrayBuffer().then(y=>x.decode(y))}}).then(t=>{mg.add(a,t);const w=vg[a];delete vg[a];for(let x=0,y=w.length;x<y;x++){const z=w[x];if(z.onLoad)z.onLoad(t)}}).catch(t=>{const w=vg[a];if(void 0===w)throw this.manager.itemError(a),t;delete vg[a];for(let x=0,y=w.length;x<y;x++){const z=w[x];if(z.onError)z.onError(t)}this.manager.itemError(a)}).finally(()=>{this.manager.itemEnd(a)});
this.manager.itemStart(a)}}setResponseType(a){this.responseType=a;return this}setMimeType(a){this.mimeType=a;return this}}class Rz extends yf{constructor(a){super(a)}load(a,b,e,f){const h=this,n=new Tf(this.manager);n.setPath(this.path);n.setRequestHeader(this.requestHeader);n.setWithCredentials(this.withCredentials);n.load(a,function(r){try{b(h.parse(JSON.parse(r)))}catch(t){f?f(t):console.error(t),h.manager.itemError(a)}},e,f)}parse(a){const b=[];for(let e=0;e<a.length;e++){const f=Ij.parse(a[e]);
b.push(f)}return b}}class gA extends yf{constructor(a){super(a)}load(a,b,e,f){function h(y){w.load(a[y],function(z){z=n.parse(z,!0);r[y]={width:z.width,height:z.height,format:z.format,mipmaps:z.mipmaps};x+=1;6===x&&(1===z.mipmapCount&&(t.minFilter=1006),t.image=r,t.format=z.format,t.needsUpdate=!0,b&&b(t))},e,f)}const n=this,r=[],t=new $k,w=new Tf(this.manager);w.setPath(this.path);w.setResponseType("arraybuffer");w.setRequestHeader(this.requestHeader);w.setWithCredentials(n.withCredentials);let x=
0;if(Array.isArray(a))for(let y=0,z=a.length;y<z;++y)h(y);else w.load(a,function(y){y=n.parse(y,!0);if(y.isCubemap){const z=y.mipmaps.length/y.mipmapCount;for(let ab=0;ab<z;ab++){r[ab]={mipmaps:[]};for(let eb=0;eb<y.mipmapCount;eb++)r[ab].mipmaps.push(y.mipmaps[ab*y.mipmapCount+eb]),r[ab].format=y.format,r[ab].width=y.width,r[ab].height=y.height}t.image=r}else t.image.width=y.width,t.image.height=y.height,t.mipmaps=y.mipmaps;1===y.mipmapCount&&(t.minFilter=1006);t.format=y.format;t.needsUpdate=!0;
b&&b(t)},e,f);return t}}class sh extends yf{constructor(a){super(a)}load(a,b,e,f){function h(){r();mg.add(a,this);b&&b(this);t.manager.itemEnd(a)}function n(y){r();f&&f(y);t.manager.itemError(a);t.manager.itemEnd(a)}function r(){x.removeEventListener("load",h,!1);x.removeEventListener("error",n,!1)}void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);const t=this,w=mg.get(a);if(void 0!==w)return t.manager.itemStart(a),setTimeout(function(){b&&b(w);t.manager.itemEnd(a)},0),w;const x=wj("img");
x.addEventListener("load",h,!1);x.addEventListener("error",n,!1);"data:"!==a.slice(0,5)&&void 0!==this.crossOrigin&&(x.crossOrigin=this.crossOrigin);t.manager.itemStart(a);x.src=a;return x}}class hA extends yf{constructor(a){super(a)}load(a,b,e,f){function h(w){r.load(a[w],function(x){n.images[w]=x;t++;6===t&&(n.needsUpdate=!0,b&&b(n))},void 0,f)}const n=new ok;n.colorSpace="srgb";const r=new sh(this.manager);r.setCrossOrigin(this.crossOrigin);r.setPath(this.path);let t=0;for(e=0;e<a.length;++e)h(e);
return n}}class jA extends yf{constructor(a){super(a)}load(a,b,e,f){const h=this,n=new Bg,r=new Tf(this.manager);r.setResponseType("arraybuffer");r.setRequestHeader(this.requestHeader);r.setPath(this.path);r.setWithCredentials(h.withCredentials);r.load(a,function(t){let w;try{w=h.parse(t)}catch(x){if(void 0!==f)f(x);else{console.error(x);return}}void 0!==w.image?n.image=w.image:void 0!==w.data&&(n.image.width=w.width,n.image.height=w.height,n.image.data=w.data);n.wrapS=void 0!==w.wrapS?w.wrapS:1001;
n.wrapT=void 0!==w.wrapT?w.wrapT:1001;n.magFilter=void 0!==w.magFilter?w.magFilter:1006;n.minFilter=void 0!==w.minFilter?w.minFilter:1006;n.anisotropy=void 0!==w.anisotropy?w.anisotropy:1;void 0!==w.colorSpace&&(n.colorSpace=w.colorSpace);void 0!==w.flipY&&(n.flipY=w.flipY);void 0!==w.format&&(n.format=w.format);void 0!==w.type&&(n.type=w.type);void 0!==w.mipmaps&&(n.mipmaps=w.mipmaps,n.minFilter=1008);1===w.mipmapCount&&(n.minFilter=1006);void 0!==w.generateMipmaps&&(n.generateMipmaps=w.generateMipmaps);
n.needsUpdate=!0;b&&b(n,w)},e,f);return n}}class gj extends yf{constructor(a){super(a)}load(a,b,e,f){const h=new Rd,n=new sh(this.manager);n.setCrossOrigin(this.crossOrigin);n.setPath(this.path);n.load(a,function(r){h.image=r;h.needsUpdate=!0;void 0!==b&&b(h)},e,f);return h}}class Cg extends Cd{constructor(a,b=1){super();this.isLight=!0;this.type="Light";this.color=new Tb(a);this.intensity=b}dispose(){}copy(a,b){super.copy(a,b);this.color.copy(a.color);this.intensity=a.intensity;return this}toJSON(a){a=
super.toJSON(a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}}class Dp extends Cg{constructor(a,b,e){super(a,e);this.isHemisphereLight=
!0;this.type="HemisphereLight";this.position.copy(Cd.DEFAULT_UP);this.updateMatrix();this.groundColor=new Tb(b)}copy(a,b){super.copy(a,b);this.groundColor.copy(a.groundColor);return this}}const Hq=new gd,sx=new mb,tx=new mb;class Iq{constructor(a){this.camera=a;this.normalBias=this.bias=0;this.radius=1;this.blurSamples=8;this.mapSize=new Lb(512,512);this.mapPass=this.map=null;this.matrix=new gd;this.autoUpdate=!0;this.needsUpdate=!1;this._frustum=new hk;this._frameExtents=new Lb(1,1);this._viewportCount=
1;this._viewports=[new Md(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(a){const b=this.camera,e=this.matrix;sx.setFromMatrixPosition(a.matrixWorld);b.position.copy(sx);tx.setFromMatrixPosition(a.target.matrixWorld);b.lookAt(tx);b.updateMatrixWorld();Hq.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);this._frustum.setFromProjectionMatrix(Hq);e.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);e.multiply(Hq)}getViewport(a){return this._viewports[a]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&
this.map.dispose();this.mapPass&&this.mapPass.dispose()}copy(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize);return this}clone(){return(new this.constructor).copy(this)}toJSON(){const a={};0!==this.bias&&(a.bias=this.bias);0!==this.normalBias&&(a.normalBias=this.normalBias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix;
return a}}class uB extends Iq{constructor(){super(new ff(50,1,.5,500));this.isSpotLightShadow=!0;this.focus=1}updateMatrices(a){const b=this.camera,e=2*Kj*a.angle*this.focus,f=this.mapSize.width/this.mapSize.height,h=a.distance||b.far;if(e!==b.fov||f!==b.aspect||h!==b.far)b.fov=e,b.aspect=f,b.far=h,b.updateProjectionMatrix();super.updateMatrices(a)}copy(a){super.copy(a);this.focus=a.focus;return this}}class Tp extends Cg{constructor(a,b,e=0,f=Math.PI/3,h=0,n=2){super(a,b);this.isSpotLight=!0;this.type=
"SpotLight";this.position.copy(Cd.DEFAULT_UP);this.updateMatrix();this.target=new Cd;this.distance=e;this.angle=f;this.penumbra=h;this.decay=n;this.map=null;this.shadow=new uB}dispose(){this.shadow.dispose()}copy(a,b){super.copy(a,b);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this}}const ux=new gd,Fk=new mb,Jq=new mb;class vB extends Iq{constructor(){super(new ff(90,1,.5,500));this.isPointLightShadow=
!0;this._frameExtents=new Lb(4,2);this._viewportCount=6;this._viewports=[new Md(2,1,1,1),new Md(0,1,1,1),new Md(3,1,1,1),new Md(1,1,1,1),new Md(3,0,1,1),new Md(1,0,1,1)];this._cubeDirections=[new mb(1,0,0),new mb(-1,0,0),new mb(0,0,1),new mb(0,0,-1),new mb(0,1,0),new mb(0,-1,0)];this._cubeUps=[new mb(0,1,0),new mb(0,1,0),new mb(0,1,0),new mb(0,1,0),new mb(0,0,1),new mb(0,0,-1)]}updateMatrices(a,b=0){const e=this.camera,f=this.matrix,h=a.distance||e.far;h!==e.far&&(e.far=h,e.updateProjectionMatrix());
Fk.setFromMatrixPosition(a.matrixWorld);e.position.copy(Fk);Jq.copy(e.position);Jq.add(this._cubeDirections[b]);e.up.copy(this._cubeUps[b]);e.lookAt(Jq);e.updateMatrixWorld();f.makeTranslation(-Fk.x,-Fk.y,-Fk.z);ux.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);this._frustum.setFromProjectionMatrix(ux)}}class Kp extends Cg{constructor(a,b,e=0,f=2){super(a,b);this.isPointLight=!0;this.type="PointLight";this.distance=e;this.decay=f;this.shadow=new vB}dispose(){this.shadow.dispose()}copy(a,
b){super.copy(a,b);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}}class wB extends Iq{constructor(){super(new rk(-5,5,5,-5,.5,500));this.isDirectionalLightShadow=!0}}class am extends Cg{constructor(a,b){super(a,b);this.isDirectionalLight=!0;this.type="DirectionalLight";this.position.copy(Cd.DEFAULT_UP);this.updateMatrix();this.target=new Cd;this.shadow=new wB}dispose(){this.shadow.dispose()}copy(a){super.copy(a);this.target=a.target.clone();this.shadow=a.shadow.clone();
return this}}class Pv extends Cg{constructor(a,b){super(a,b);this.isAmbientLight=!0;this.type="AmbientLight"}}class uw extends Cg{constructor(a,b,e=10,f=10){super(a,b);this.isRectAreaLight=!0;this.type="RectAreaLight";this.width=e;this.height=f}copy(a){super.copy(a);this.width=a.width;this.height=a.height;return this}toJSON(a){a=super.toJSON(a);a.object.width=this.width;a.object.height=this.height;return a}}class xw{constructor(){this.isSphericalHarmonics3=!0;this.coefficients=[];for(let a=0;9>a;a++)this.coefficients.push(new mb)}set(a){for(let b=
0;9>b;b++)this.coefficients[b].copy(a[b]);return this}zero(){for(let a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this}getAt(a,b){const e=a.x,f=a.y;a=a.z;const h=this.coefficients;b.copy(h[0]).multiplyScalar(.282095);b.addScaledVector(h[1],.488603*f);b.addScaledVector(h[2],.488603*a);b.addScaledVector(h[3],.488603*e);b.addScaledVector(h[4],1.092548*e*f);b.addScaledVector(h[5],1.092548*f*a);b.addScaledVector(h[6],.315392*(3*a*a-1));b.addScaledVector(h[7],1.092548*e*a);b.addScaledVector(h[8],
.546274*(e*e-f*f));return b}getIrradianceAt(a,b){const e=a.x,f=a.y;a=a.z;const h=this.coefficients;b.copy(h[0]).multiplyScalar(.886227);b.addScaledVector(h[1],1.023328*f);b.addScaledVector(h[2],1.023328*a);b.addScaledVector(h[3],1.023328*e);b.addScaledVector(h[4],.858086*e*f);b.addScaledVector(h[5],.858086*f*a);b.addScaledVector(h[6],.743125*a*a-.247708);b.addScaledVector(h[7],.858086*e*a);b.addScaledVector(h[8],.429043*(e*e-f*f));return b}add(a){for(let b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);
return this}addScaledSH(a,b){for(let e=0;9>e;e++)this.coefficients[e].addScaledVector(a.coefficients[e],b);return this}scale(a){for(let b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this}lerp(a,b){for(let e=0;9>e;e++)this.coefficients[e].lerp(a.coefficients[e],b);return this}equals(a){for(let b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0}copy(a){return this.set(a.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(a,b=0){const e=this.coefficients;
for(let f=0;9>f;f++)e[f].fromArray(a,b+3*f);return this}toArray(a=[],b=0){const e=this.coefficients;for(let f=0;9>f;f++)e[f].toArray(a,b+3*f);return a}static getBasisAt(a,b){const e=a.x,f=a.y;a=a.z;b[0]=.282095;b[1]=.488603*f;b[2]=.488603*a;b[3]=.488603*e;b[4]=1.092548*e*f;b[5]=1.092548*f*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*e*a;b[8]=.546274*(e*e-f*f)}}class hw extends Cg{constructor(a=new xw,b=1){super(void 0,b);this.isLightProbe=!0;this.sh=a}copy(a){super.copy(a);this.sh.copy(a.sh);return this}fromJSON(a){this.intensity=
a.intensity;this.sh.fromArray(a.sh);return this}toJSON(a){a=super.toJSON(a);a.object.sh=this.sh.toArray();return a}}class Jp extends yf{constructor(a){super(a);this.textures={}}load(a,b,e,f){const h=this,n=new Tf(h.manager);n.setPath(h.path);n.setRequestHeader(h.requestHeader);n.setWithCredentials(h.withCredentials);n.load(a,function(r){try{b(h.parse(JSON.parse(r)))}catch(t){f?f(t):console.error(t),h.manager.itemError(a)}},e,f)}parse(a){function b(n){void 0===e[n]&&console.warn("THREE.MaterialLoader: Undefined texture",
n);return e[n]}const e=this.textures,f=Jp.createMaterialFromType(a.type);void 0!==a.uuid&&(f.uuid=a.uuid);void 0!==a.name&&(f.name=a.name);void 0!==a.color&&void 0!==f.color&&f.color.setHex(a.color);void 0!==a.roughness&&(f.roughness=a.roughness);void 0!==a.metalness&&(f.metalness=a.metalness);void 0!==a.sheen&&(f.sheen=a.sheen);void 0!==a.sheenColor&&(f.sheenColor=(new Tb).setHex(a.sheenColor));void 0!==a.sheenRoughness&&(f.sheenRoughness=a.sheenRoughness);void 0!==a.emissive&&void 0!==f.emissive&&
f.emissive.setHex(a.emissive);void 0!==a.specular&&void 0!==f.specular&&f.specular.setHex(a.specular);void 0!==a.specularIntensity&&(f.specularIntensity=a.specularIntensity);void 0!==a.specularColor&&void 0!==f.specularColor&&f.specularColor.setHex(a.specularColor);void 0!==a.shininess&&(f.shininess=a.shininess);void 0!==a.clearcoat&&(f.clearcoat=a.clearcoat);void 0!==a.clearcoatRoughness&&(f.clearcoatRoughness=a.clearcoatRoughness);void 0!==a.iridescence&&(f.iridescence=a.iridescence);void 0!==a.iridescenceIOR&&
(f.iridescenceIOR=a.iridescenceIOR);void 0!==a.iridescenceThicknessRange&&(f.iridescenceThicknessRange=a.iridescenceThicknessRange);void 0!==a.transmission&&(f.transmission=a.transmission);void 0!==a.thickness&&(f.thickness=a.thickness);void 0!==a.attenuationDistance&&(f.attenuationDistance=a.attenuationDistance);void 0!==a.attenuationColor&&void 0!==f.attenuationColor&&f.attenuationColor.setHex(a.attenuationColor);void 0!==a.anisotropy&&(f.anisotropy=a.anisotropy);void 0!==a.anisotropyRotation&&
(f.anisotropyRotation=a.anisotropyRotation);void 0!==a.fog&&(f.fog=a.fog);void 0!==a.flatShading&&(f.flatShading=a.flatShading);void 0!==a.blending&&(f.blending=a.blending);void 0!==a.combine&&(f.combine=a.combine);void 0!==a.side&&(f.side=a.side);void 0!==a.shadowSide&&(f.shadowSide=a.shadowSide);void 0!==a.opacity&&(f.opacity=a.opacity);void 0!==a.transparent&&(f.transparent=a.transparent);void 0!==a.alphaTest&&(f.alphaTest=a.alphaTest);void 0!==a.alphaHash&&(f.alphaHash=a.alphaHash);void 0!==a.depthFunc&&
(f.depthFunc=a.depthFunc);void 0!==a.depthTest&&(f.depthTest=a.depthTest);void 0!==a.depthWrite&&(f.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(f.colorWrite=a.colorWrite);void 0!==a.blendSrc&&(f.blendSrc=a.blendSrc);void 0!==a.blendDst&&(f.blendDst=a.blendDst);void 0!==a.blendEquation&&(f.blendEquation=a.blendEquation);void 0!==a.blendSrcAlpha&&(f.blendSrcAlpha=a.blendSrcAlpha);void 0!==a.blendDstAlpha&&(f.blendDstAlpha=a.blendDstAlpha);void 0!==a.blendEquationAlpha&&(f.blendEquationAlpha=a.blendEquationAlpha);
void 0!==a.blendColor&&void 0!==f.blendColor&&f.blendColor.setHex(a.blendColor);void 0!==a.blendAlpha&&(f.blendAlpha=a.blendAlpha);void 0!==a.stencilWriteMask&&(f.stencilWriteMask=a.stencilWriteMask);void 0!==a.stencilFunc&&(f.stencilFunc=a.stencilFunc);void 0!==a.stencilRef&&(f.stencilRef=a.stencilRef);void 0!==a.stencilFuncMask&&(f.stencilFuncMask=a.stencilFuncMask);void 0!==a.stencilFail&&(f.stencilFail=a.stencilFail);void 0!==a.stencilZFail&&(f.stencilZFail=a.stencilZFail);void 0!==a.stencilZPass&&
(f.stencilZPass=a.stencilZPass);void 0!==a.stencilWrite&&(f.stencilWrite=a.stencilWrite);void 0!==a.wireframe&&(f.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(f.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(f.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(f.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.rotation&&(f.rotation=a.rotation);void 0!==a.linewidth&&(f.linewidth=a.linewidth);void 0!==a.dashSize&&(f.dashSize=a.dashSize);void 0!==a.gapSize&&
(f.gapSize=a.gapSize);void 0!==a.scale&&(f.scale=a.scale);void 0!==a.polygonOffset&&(f.polygonOffset=a.polygonOffset);void 0!==a.polygonOffsetFactor&&(f.polygonOffsetFactor=a.polygonOffsetFactor);void 0!==a.polygonOffsetUnits&&(f.polygonOffsetUnits=a.polygonOffsetUnits);void 0!==a.dithering&&(f.dithering=a.dithering);void 0!==a.alphaToCoverage&&(f.alphaToCoverage=a.alphaToCoverage);void 0!==a.premultipliedAlpha&&(f.premultipliedAlpha=a.premultipliedAlpha);void 0!==a.forceSinglePass&&(f.forceSinglePass=
a.forceSinglePass);void 0!==a.visible&&(f.visible=a.visible);void 0!==a.toneMapped&&(f.toneMapped=a.toneMapped);void 0!==a.userData&&(f.userData=a.userData);void 0!==a.vertexColors&&(f.vertexColors="number"===typeof a.vertexColors?0<a.vertexColors?!0:!1:a.vertexColors);if(void 0!==a.uniforms)for(var h in a.uniforms){const n=a.uniforms[h];f.uniforms[h]={};switch(n.type){case "t":f.uniforms[h].value=b(n.value);break;case "c":f.uniforms[h].value=(new Tb).setHex(n.value);break;case "v2":f.uniforms[h].value=
(new Lb).fromArray(n.value);break;case "v3":f.uniforms[h].value=(new mb).fromArray(n.value);break;case "v4":f.uniforms[h].value=(new Md).fromArray(n.value);break;case "m3":f.uniforms[h].value=(new qd).fromArray(n.value);break;case "m4":f.uniforms[h].value=(new gd).fromArray(n.value);break;default:f.uniforms[h].value=n.value}}void 0!==a.defines&&(f.defines=a.defines);void 0!==a.vertexShader&&(f.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(f.fragmentShader=a.fragmentShader);void 0!==a.glslVersion&&
(f.glslVersion=a.glslVersion);if(void 0!==a.extensions)for(const n in a.extensions)f.extensions[n]=a.extensions[n];void 0!==a.lights&&(f.lights=a.lights);void 0!==a.clipping&&(f.clipping=a.clipping);void 0!==a.size&&(f.size=a.size);void 0!==a.sizeAttenuation&&(f.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(f.map=b(a.map));void 0!==a.matcap&&(f.matcap=b(a.matcap));void 0!==a.alphaMap&&(f.alphaMap=b(a.alphaMap));void 0!==a.bumpMap&&(f.bumpMap=b(a.bumpMap));void 0!==a.bumpScale&&(f.bumpScale=
a.bumpScale);void 0!==a.normalMap&&(f.normalMap=b(a.normalMap));void 0!==a.normalMapType&&(f.normalMapType=a.normalMapType);void 0!==a.normalScale&&(h=a.normalScale,!1===Array.isArray(h)&&(h=[h,h]),f.normalScale=(new Lb).fromArray(h));void 0!==a.displacementMap&&(f.displacementMap=b(a.displacementMap));void 0!==a.displacementScale&&(f.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(f.displacementBias=a.displacementBias);void 0!==a.roughnessMap&&(f.roughnessMap=b(a.roughnessMap));
void 0!==a.metalnessMap&&(f.metalnessMap=b(a.metalnessMap));void 0!==a.emissiveMap&&(f.emissiveMap=b(a.emissiveMap));void 0!==a.emissiveIntensity&&(f.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(f.specularMap=b(a.specularMap));void 0!==a.specularIntensityMap&&(f.specularIntensityMap=b(a.specularIntensityMap));void 0!==a.specularColorMap&&(f.specularColorMap=b(a.specularColorMap));void 0!==a.envMap&&(f.envMap=b(a.envMap));void 0!==a.envMapRotation&&f.envMapRotation.fromArray(a.envMapRotation);
void 0!==a.envMapIntensity&&(f.envMapIntensity=a.envMapIntensity);void 0!==a.reflectivity&&(f.reflectivity=a.reflectivity);void 0!==a.refractionRatio&&(f.refractionRatio=a.refractionRatio);void 0!==a.lightMap&&(f.lightMap=b(a.lightMap));void 0!==a.lightMapIntensity&&(f.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(f.aoMap=b(a.aoMap));void 0!==a.aoMapIntensity&&(f.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(f.gradientMap=b(a.gradientMap));void 0!==a.clearcoatMap&&(f.clearcoatMap=
b(a.clearcoatMap));void 0!==a.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap=b(a.clearcoatRoughnessMap));void 0!==a.clearcoatNormalMap&&(f.clearcoatNormalMap=b(a.clearcoatNormalMap));void 0!==a.clearcoatNormalScale&&(f.clearcoatNormalScale=(new Lb).fromArray(a.clearcoatNormalScale));void 0!==a.iridescenceMap&&(f.iridescenceMap=b(a.iridescenceMap));void 0!==a.iridescenceThicknessMap&&(f.iridescenceThicknessMap=b(a.iridescenceThicknessMap));void 0!==a.transmissionMap&&(f.transmissionMap=b(a.transmissionMap));
void 0!==a.thicknessMap&&(f.thicknessMap=b(a.thicknessMap));void 0!==a.anisotropyMap&&(f.anisotropyMap=b(a.anisotropyMap));void 0!==a.sheenColorMap&&(f.sheenColorMap=b(a.sheenColorMap));void 0!==a.sheenRoughnessMap&&(f.sheenRoughnessMap=b(a.sheenRoughnessMap));return f}setTextures(a){this.textures=a;return this}static createMaterialFromType(a){return new {ShadowMaterial:ww,SpriteMaterial:Up,RawShaderMaterial:sw,ShaderMaterial:Of,PointsMaterial:fm,MeshPhysicalMaterial:Wf,MeshStandardMaterial:Gj,MeshPhongMaterial:ow,
MeshToonMaterial:pw,MeshNormalMaterial:nw,MeshLambertMaterial:lw,MeshDepthMaterial:fp,MeshDistanceMaterial:gp,MeshBasicMaterial:Qd,MeshMatcapMaterial:mw,LineDashedMaterial:jw,LineBasicMaterial:mf,Material:Zd}[a]}}class Dg{static decodeText(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);let b="";for(let e=0,f=a.length;e<f;e++)b+=String.fromCharCode(a[e]);try{return decodeURIComponent(escape(b))}catch(e){return b}}static extractUrlBase(a){const b=a.lastIndexOf("/");return-1===
b?"./":a.slice(0,b+1)}static resolveURL(a,b){if("string"!==typeof a||""===a)return"";/^https?:\/\//i.test(b)&&/^\//.test(a)&&(b=b.replace(/(^https?:\/\/[^\/]+).*/i,"$1"));return/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)?a:b+a}}class fw extends md{constructor(){super();this.isInstancedBufferGeometry=!0;this.type="InstancedBufferGeometry";this.instanceCount=Infinity}copy(a){super.copy(a);this.instanceCount=a.instanceCount;return this}toJSON(){const a=super.toJSON();a.instanceCount=
this.instanceCount;a.isInstancedBufferGeometry=!0;return a}}class Vv extends yf{constructor(a){super(a)}load(a,b,e,f){const h=this,n=new Tf(h.manager);n.setPath(h.path);n.setRequestHeader(h.requestHeader);n.setWithCredentials(h.withCredentials);n.load(a,function(r){try{b(h.parse(JSON.parse(r)))}catch(t){f?f(t):console.error(t),h.manager.itemError(a)}},e,f)}parse(a){function b(z,ab){if(void 0!==e[ab])return e[ab];const eb=z.interleavedBuffers[ab];var cb=eb.buffer;void 0!==f[cb]?cb=f[cb]:(z=(new Uint32Array(z.arrayBuffers[cb])).buffer,
cb=f[cb]=z);cb=new Lj[eb.type](cb);cb=new qk(cb,eb.stride);cb.uuid=eb.uuid;return e[ab]=cb}const e={},f={},h=a.isInstancedBufferGeometry?new fw:new md;var n=a.data.index;void 0!==n&&(n=new Lj[n.type](n.array),h.setIndex(new Hd(n,1)));n=a.data.attributes;for(var r in n){var t=n[r],w=void 0;t.isInterleavedBufferAttribute?(w=b(a.data,t.data),w=new bj(w,t.itemSize,t.offset,t.normalized)):(w=new Lj[t.type](t.array),w=new (t.isInstancedBufferAttribute?aj:Hd)(w,t.itemSize,t.normalized));void 0!==t.name&&
(w.name=t.name);void 0!==t.usage&&w.setUsage(t.usage);h.setAttribute(r,w)}if(r=a.data.morphAttributes)for(var x in r){n=r[x];t=[];for(let z=0,ab=n.length;z<ab;z++){w=n[z];var y=void 0;w.isInterleavedBufferAttribute?(y=b(a.data,w.data),y=new bj(y,w.itemSize,w.offset,w.normalized)):(y=new Lj[w.type](w.array),y=new Hd(y,w.itemSize,w.normalized));void 0!==w.name&&(y.name=w.name);t.push(y)}h.morphAttributes[x]=t}a.data.morphTargetsRelative&&(h.morphTargetsRelative=!0);x=a.data.groups||a.data.drawcalls||
a.data.offsets;if(void 0!==x)for(let z=0,ab=x.length;z!==ab;++z)r=x[z],h.addGroup(r.start,r.count,r.materialIndex);x=a.data.boundingSphere;void 0!==x&&(r=new mb,void 0!==x.center&&r.fromArray(x.center),h.boundingSphere=new lf(r,x.radius));a.name&&(h.name=a.name);a.userData&&(h.userData=a.userData);return h}}class xA extends yf{constructor(a){super(a)}load(a,b,e,f){const h=this;var n=""===this.path?Dg.extractUrlBase(a):this.path;this.resourcePath=this.resourcePath||n;n=new Tf(this.manager);n.setPath(this.path);
n.setRequestHeader(this.requestHeader);n.setWithCredentials(this.withCredentials);n.load(a,function(r){let t=null;try{t=JSON.parse(r)}catch(w){void 0!==f&&f(w);console.error("THREE:ObjectLoader: Can't parse "+a+".",w.message);return}r=t.metadata;void 0===r||void 0===r.type||"geometry"===r.type.toLowerCase()?(void 0!==f&&f(Error("THREE.ObjectLoader: Can't load "+a)),console.error("THREE.ObjectLoader: Can't load "+a)):h.parse(t,b)},e,f)}loadAsync(a,b){const e=this;return Vx(function*(){var f=""===e.path?
Dg.extractUrlBase(a):e.path;e.resourcePath=e.resourcePath||f;f=new Tf(e.manager);f.setPath(e.path);f.setRequestHeader(e.requestHeader);f.setWithCredentials(e.withCredentials);f=yield f.loadAsync(a,b);f=JSON.parse(f);const h=f.metadata;if(void 0===h||void 0===h.type||"geometry"===h.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+a);return yield e.parseAsync(f)}())}parse(a,b){const e=this.parseAnimations(a.animations);var f=this.parseShapes(a.shapes);const h=this.parseGeometries(a.geometries,
f);f=this.parseImages(a.images,function(){void 0!==b&&b(t)});const n=this.parseTextures(a.textures,f),r=this.parseMaterials(a.materials,n),t=this.parseObject(a.object,h,r,n,e);a=this.parseSkeletons(a.skeletons,t);this.bindSkeletons(t,a);if(void 0!==b){a=!1;for(const w in f)if(f[w].data instanceof HTMLImageElement){a=!0;break}!1===a&&b(t)}return t}parseAsync(a){const b=this;return Vx(function*(){var e=b.parseAnimations(a.animations),f=b.parseShapes(a.shapes);f=b.parseGeometries(a.geometries,f);var h=
yield b.parseImagesAsync(a.images);h=b.parseTextures(a.textures,h);const n=b.parseMaterials(a.materials,h);e=b.parseObject(a.object,f,n,h,e);f=b.parseSkeletons(a.skeletons,e);b.bindSkeletons(e,f);return e}())}parseShapes(a){const b={};if(void 0!==a)for(let e=0,f=a.length;e<f;e++){const h=(new ej).fromJSON(a[e]);b[h.uuid]=h}return b}parseSkeletons(a,b){const e={},f={};b.traverse(function(h){h.isBone&&(f[h.uuid]=h)});if(void 0!==a)for(let h=0,n=a.length;h<n;h++)b=(new gm).fromJSON(a[h],f),e[b.uuid]=
b;return e}parseGeometries(a,b){const e={};if(void 0!==a){const f=new Vv;for(let h=0,n=a.length;h<n;h++){let r;const t=a[h];switch(t.type){case "BufferGeometry":case "InstancedBufferGeometry":r=f.parse(t);break;default:t.type in rx?r=rx[t.type].fromJSON(t,b):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${t.type}"`)}r.uuid=t.uuid;void 0!==t.name&&(r.name=t.name);void 0!==t.userData&&(r.userData=t.userData);e[t.uuid]=r}}return e}parseMaterials(a,b){const e={},f={};if(void 0!==a){const h=
new Jp;h.setTextures(b);for(let n=0,r=a.length;n<r;n++)b=a[n],void 0===e[b.uuid]&&(e[b.uuid]=h.parse(b)),f[b.uuid]=e[b.uuid]}return f}parseAnimations(a){const b={};if(void 0!==a)for(let e=0;e<a.length;e++){const f=Ij.parse(a[e]);b[f.uuid]=f}return b}parseImages(a,b){function e(w){h.manager.itemStart(w);return r.load(w,function(){h.manager.itemEnd(w)},void 0,function(){h.manager.itemError(w);h.manager.itemEnd(w)})}function f(w){return"string"===typeof w?e(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(w)?w:h.resourcePath+
w):w.data?{data:new Lj[w.type](w.data),width:w.width,height:w.height}:null}const h=this,n={};let r;if(void 0!==a&&0<a.length){b=new Ip(b);r=new sh(b);r.setCrossOrigin(this.crossOrigin);for(let w=0,x=a.length;w<x;w++){b=a[w];var t=b.url;if(Array.isArray(t)){const y=[];for(let z=0,ab=t.length;z<ab;z++){const eb=f(t[z]);null!==eb&&(eb instanceof HTMLImageElement?y.push(eb):y.push(new Bg(eb.data,eb.width,eb.height)))}n[b.uuid]=new fj(y)}else t=f(b.url),n[b.uuid]=new fj(t)}}return n}parseImagesAsync(a){const b=
this;return Vx(function*(){function e(t){return Vx(function*(){return"string"===typeof t?yield n.loadAsync(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:f.resourcePath+t):t.data?{data:new Lj[t.type](t.data),width:t.width,height:t.height}:null}())}const f=b,h={};let n;if(void 0!==a&&0<a.length){n=new sh(b.manager);n.setCrossOrigin(b.crossOrigin);for(let t=0,w=a.length;t<w;t++){const x=a[t];var r=x.url;if(Array.isArray(r)){const y=[];for(let z=0,ab=r.length;z<ab;z++){const eb=yield e(r[z]);null!==eb&&(eb instanceof
HTMLImageElement?y.push(eb):y.push(new Bg(eb.data,eb.width,eb.height)))}h[x.uuid]=new fj(y)}else r=yield e(x.url),h[x.uuid]=new fj(r)}}return h}())}parseTextures(a,b){function e(h,n){if("number"===typeof h)return h;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",h);return n[h]}const f={};if(void 0!==a)for(let h=0,n=a.length;h<n;h++){const r=a[h];void 0===r.image&&console.warn('THREE.ObjectLoader: No "image" specified for',r.uuid);void 0===b[r.image]&&console.warn("THREE.ObjectLoader: Undefined image",
r.image);const t=b[r.image],w=t.data;let x;Array.isArray(w)?(x=new ok,6===w.length&&(x.needsUpdate=!0)):(x=w&&w.data?new Bg:new Rd,w&&(x.needsUpdate=!0));x.source=t;x.uuid=r.uuid;void 0!==r.name&&(x.name=r.name);void 0!==r.mapping&&(x.mapping=e(r.mapping,xB));void 0!==r.channel&&(x.channel=r.channel);void 0!==r.offset&&x.offset.fromArray(r.offset);void 0!==r.repeat&&x.repeat.fromArray(r.repeat);void 0!==r.center&&x.center.fromArray(r.center);void 0!==r.rotation&&(x.rotation=r.rotation);void 0!==r.wrap&&
(x.wrapS=e(r.wrap[0],vx),x.wrapT=e(r.wrap[1],vx));void 0!==r.format&&(x.format=r.format);void 0!==r.internalFormat&&(x.internalFormat=r.internalFormat);void 0!==r.type&&(x.type=r.type);void 0!==r.colorSpace&&(x.colorSpace=r.colorSpace);void 0!==r.minFilter&&(x.minFilter=e(r.minFilter,wx));void 0!==r.magFilter&&(x.magFilter=e(r.magFilter,wx));void 0!==r.anisotropy&&(x.anisotropy=r.anisotropy);void 0!==r.flipY&&(x.flipY=r.flipY);void 0!==r.generateMipmaps&&(x.generateMipmaps=r.generateMipmaps);void 0!==
r.premultiplyAlpha&&(x.premultiplyAlpha=r.premultiplyAlpha);void 0!==r.unpackAlignment&&(x.unpackAlignment=r.unpackAlignment);void 0!==r.compareFunction&&(x.compareFunction=r.compareFunction);void 0!==r.userData&&(x.userData=r.userData);f[r.uuid]=x}return f}parseObject(a,b,e,f,h){function n(z){void 0===b[z]&&console.warn("THREE.ObjectLoader: Undefined geometry",z);return b[z]}function r(z){if(void 0!==z){if(Array.isArray(z)){const ab=[];for(let eb=0,cb=z.length;eb<cb;eb++){const db=z[eb];void 0===
e[db]&&console.warn("THREE.ObjectLoader: Undefined material",db);ab.push(e[db])}return ab}void 0===e[z]&&console.warn("THREE.ObjectLoader: Undefined material",z);return e[z]}}function t(z){void 0===f[z]&&console.warn("THREE.ObjectLoader: Undefined texture",z);return f[z]}switch(a.type){case "Scene":var w=new Pp;void 0!==a.background&&(w.background=Number.isInteger(a.background)?new Tb(a.background):t(a.background));void 0!==a.environment&&(w.environment=t(a.environment));void 0!==a.fog&&("Fog"===
a.fog.type?w.fog=new Bp(a.fog.color,a.fog.near,a.fog.far):"FogExp2"===a.fog.type&&(w.fog=new Cp(a.fog.color,a.fog.density)),""!==a.fog.name&&(w.fog.name=a.fog.name));void 0!==a.backgroundBlurriness&&(w.backgroundBlurriness=a.backgroundBlurriness);void 0!==a.backgroundIntensity&&(w.backgroundIntensity=a.backgroundIntensity);void 0!==a.backgroundRotation&&w.backgroundRotation.fromArray(a.backgroundRotation);void 0!==a.environmentIntensity&&(w.environmentIntensity=a.environmentIntensity);void 0!==a.environmentRotation&&
w.environmentRotation.fromArray(a.environmentRotation);break;case "PerspectiveCamera":w=new ff(a.fov,a.aspect,a.near,a.far);void 0!==a.focus&&(w.focus=a.focus);void 0!==a.zoom&&(w.zoom=a.zoom);void 0!==a.filmGauge&&(w.filmGauge=a.filmGauge);void 0!==a.filmOffset&&(w.filmOffset=a.filmOffset);void 0!==a.view&&(w.view=Object.assign({},a.view));break;case "OrthographicCamera":w=new rk(a.left,a.right,a.top,a.bottom,a.near,a.far);void 0!==a.zoom&&(w.zoom=a.zoom);void 0!==a.view&&(w.view=Object.assign({},
a.view));break;case "AmbientLight":w=new Pv(a.color,a.intensity);break;case "DirectionalLight":w=new am(a.color,a.intensity);break;case "PointLight":w=new Kp(a.color,a.intensity,a.distance,a.decay);break;case "RectAreaLight":w=new uw(a.color,a.intensity,a.width,a.height);break;case "SpotLight":w=new Tp(a.color,a.intensity,a.distance,a.angle,a.penumbra,a.decay);break;case "HemisphereLight":w=new Dp(a.color,a.groundColor,a.intensity);break;case "LightProbe":w=(new hw).fromJSON(a);break;case "SkinnedMesh":var x=
n(a.geometry);w=r(a.material);w=new Rp(x,w);void 0!==a.bindMode&&(w.bindMode=a.bindMode);void 0!==a.bindMatrix&&w.bindMatrix.fromArray(a.bindMatrix);void 0!==a.skeleton&&(w.skeleton=a.skeleton);break;case "Mesh":x=n(a.geometry);w=r(a.material);w=new Bd(x,w);break;case "InstancedMesh":x=n(a.geometry);w=r(a.material);var y=a.instanceMatrix;const z=a.instanceColor;w=new cm(x,w,a.count);w.instanceMatrix=new aj(new Float32Array(y.array),16);void 0!==z&&(w.instanceColor=new aj(new Float32Array(z.array),
z.itemSize));break;case "BatchedMesh":x=n(a.geometry);w=r(a.material);w=new Uv(a.maxGeometryCount,a.maxVertexCount,a.maxIndexCount,w);w.geometry=x;w.perObjectFrustumCulled=a.perObjectFrustumCulled;w.sortObjects=a.sortObjects;w._drawRanges=a.drawRanges;w._reservedRanges=a.reservedRanges;w._visibility=a.visibility;w._active=a.active;w._bounds=a.bounds.map(ab=>{const eb=new qf;eb.min.fromArray(ab.boxMin);eb.max.fromArray(ab.boxMax);const cb=new lf;cb.radius=ab.sphereRadius;cb.center.fromArray(ab.sphereCenter);
return{boxInitialized:ab.boxInitialized,box:eb,sphereInitialized:ab.sphereInitialized,sphere:cb}});w._maxGeometryCount=a.maxGeometryCount;w._maxVertexCount=a.maxVertexCount;w._maxIndexCount=a.maxIndexCount;w._geometryInitialized=a.geometryInitialized;w._geometryCount=a.geometryCount;w._matricesTexture=t(a.matricesTexture.uuid);break;case "LOD":w=new gw;break;case "Line":w=new cg(n(a.geometry),r(a.material));break;case "LineLoop":w=new Gp(n(a.geometry),r(a.material));break;case "LineSegments":w=new Vf(n(a.geometry),
r(a.material));break;case "PointCloud":case "Points":w=new Lp(n(a.geometry),r(a.material));break;case "Sprite":w=new yw(r(a.material));break;case "Group":w=new af;break;case "Bone":w=new Yk;break;default:w=new Cd}w.uuid=a.uuid;void 0!==a.name&&(w.name=a.name);void 0!==a.matrix?(w.matrix.fromArray(a.matrix),void 0!==a.matrixAutoUpdate&&(w.matrixAutoUpdate=a.matrixAutoUpdate),w.matrixAutoUpdate&&w.matrix.decompose(w.position,w.quaternion,w.scale)):(void 0!==a.position&&w.position.fromArray(a.position),
void 0!==a.rotation&&w.rotation.fromArray(a.rotation),void 0!==a.quaternion&&w.quaternion.fromArray(a.quaternion),void 0!==a.scale&&w.scale.fromArray(a.scale));void 0!==a.up&&w.up.fromArray(a.up);void 0!==a.castShadow&&(w.castShadow=a.castShadow);void 0!==a.receiveShadow&&(w.receiveShadow=a.receiveShadow);a.shadow&&(void 0!==a.shadow.bias&&(w.shadow.bias=a.shadow.bias),void 0!==a.shadow.normalBias&&(w.shadow.normalBias=a.shadow.normalBias),void 0!==a.shadow.radius&&(w.shadow.radius=a.shadow.radius),
void 0!==a.shadow.mapSize&&w.shadow.mapSize.fromArray(a.shadow.mapSize),void 0!==a.shadow.camera&&(w.shadow.camera=this.parseObject(a.shadow.camera)));void 0!==a.visible&&(w.visible=a.visible);void 0!==a.frustumCulled&&(w.frustumCulled=a.frustumCulled);void 0!==a.renderOrder&&(w.renderOrder=a.renderOrder);void 0!==a.userData&&(w.userData=a.userData);void 0!==a.layers&&(w.layers.mask=a.layers);if(void 0!==a.children)for(x=a.children,y=0;y<x.length;y++)w.add(this.parseObject(x[y],b,e,f,h));if(void 0!==
a.animations)for(x=a.animations,y=0;y<x.length;y++)w.animations.push(h[x[y]]);if("LOD"===a.type)for(void 0!==a.autoUpdate&&(w.autoUpdate=a.autoUpdate),a=a.levels,h=0;h<a.length;h++)x=a[h],y=w.getObjectByProperty("uuid",x.object),void 0!==y&&w.addLevel(y,x.distance,x.hysteresis);return w}bindSkeletons(a,b){0!==Object.keys(b).length&&a.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const f=b[e.skeleton];void 0===f?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):
e.bind(f,e.bindMatrix)}})}}const xB={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},vx={RepeatWrapping:1E3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},wx={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};class ew extends yf{constructor(a){super(a);this.isImageBitmapLoader=
!0;"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"}}setOptions(a){this.options=a;return this}load(a,b,e,f){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);const h=this,n=mg.get(a);if(void 0!==n){h.manager.itemStart(a);if(n.then){n.then(r=>{b&&b(r);h.manager.itemEnd(a)}).catch(r=>
{f&&f(r)});return}setTimeout(function(){b&&b(n);h.manager.itemEnd(a)},0);return n}e={};e.credentials="anonymous"===this.crossOrigin?"same-origin":"include";e.headers=this.requestHeader;e=fetch(a,e).then(function(r){return r.blob()}).then(function(r){return createImageBitmap(r,Object.assign(h.options,{colorSpaceConversion:"none"}))}).then(function(r){mg.add(a,r);b&&b(r);h.manager.itemEnd(a);return r}).catch(function(r){f&&f(r);mg.remove(a);h.manager.itemError(a);h.manager.itemEnd(a)});mg.add(a,e);
h.manager.itemStart(a)}}let Km;class sp{static getContext(){void 0===Km&&(Km=new (window.AudioContext||window.webkitAudioContext));return Km}static setContext(a){Km=a}}class Yz extends yf{constructor(a){super(a)}load(a,b,e,f){function h(t){f?f(t):console.error(t);n.manager.itemError(a)}const n=this,r=new Tf(this.manager);r.setResponseType("arraybuffer");r.setPath(this.path);r.setRequestHeader(this.requestHeader);r.setWithCredentials(this.withCredentials);r.load(a,function(t){try{const w=t.slice(0);
sp.getContext().decodeAudioData(w,function(x){b(x)}).catch(h)}catch(w){h(w)}},e,f)}}const xx=new gd,yx=new gd,pj=new gd;class GA{constructor(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ff;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new ff;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(a){const b=this._cache;if(b.focus!==a.focus||
b.fov!==a.fov||b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;pj.copy(a.projectionMatrix);var e=b.eyeSep/2;const f=e*b.near/b.focus,h=b.near*Math.tan(hj*b.fov*.5)/b.zoom;let n;yx.elements[12]=-e;xx.elements[12]=e;e=-h*b.aspect+f;n=h*b.aspect+f;pj.elements[0]=2*b.near/(n-e);pj.elements[8]=(n+e)/(n-e);this.cameraL.projectionMatrix.copy(pj);
e=-h*b.aspect-f;n=h*b.aspect-f;pj.elements[0]=2*b.near/(n-e);pj.elements[8]=(n+e)/(n-e);this.cameraR.projectionMatrix.copy(pj)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(yx);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(xx)}}class Xv{constructor(a=!0){this.autoStart=a;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}start(){this.oldTime=this.startTime=Gv();this.elapsedTime=0;this.running=!0}stop(){this.getElapsedTime();this.autoStart=this.running=!1}getElapsedTime(){this.getDelta();
return this.elapsedTime}getDelta(){let a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const b=Gv();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}}const qj=new mb,zx=new rf,yB=new mb,rj=new mb;class Xz extends Cd{constructor(){super();this.type="AudioListener";this.context=sp.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new Xv}getInput(){return this.gain}removeFilter(){null!==
this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this}getFilter(){return this.filter}setFilter(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(a){this.gain.gain.setTargetAtTime(a,
this.context.currentTime,.01);return this}updateMatrixWorld(a){super.updateMatrixWorld(a);a=this.context.listener;const b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(qj,zx,yB);rj.set(0,0,-1).applyQuaternion(zx);if(a.positionX){const e=this.context.currentTime+this.timeDelta;a.positionX.linearRampToValueAtTime(qj.x,e);a.positionY.linearRampToValueAtTime(qj.y,e);a.positionZ.linearRampToValueAtTime(qj.z,e);a.forwardX.linearRampToValueAtTime(rj.x,e);a.forwardY.linearRampToValueAtTime(rj.y,
e);a.forwardZ.linearRampToValueAtTime(rj.z,e);a.upX.linearRampToValueAtTime(b.x,e);a.upY.linearRampToValueAtTime(b.y,e);a.upZ.linearRampToValueAtTime(b.z,e)}else a.setPosition(qj.x,qj.y,qj.z),a.setOrientation(rj.x,rj.y,rj.z,b.x,b.y,b.z)}}class Tv extends Cd{constructor(a){super();this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.loopEnd=this.loopStart=
0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.source=null;this.sourceType="empty";this._progress=this._startedAt=0;this._connected=!1;this.filters=[]}getOutput(){return this.gain}setNodeSource(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this}setMediaElementSource(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this}setMediaStreamSource(a){this.hasPlaybackControl=
!1;this.sourceType="mediaStreamNode";this.source=this.context.createMediaStreamSource(a);this.connect();return this}setBuffer(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this}play(a=0){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this._startedAt=this.context.currentTime+a,a=this.context.createBufferSource(),a.buffer=this.buffer,
a.loop=this.loop,a.loopStart=this.loopStart,a.loopEnd=this.loopEnd,a.onended=this.onEnded.bind(this),a.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=a,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,
!0===this.loop&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(let a=1,b=this.filters.length;a<b;a++)this.filters[a-1].connect(this.filters[a]);
this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());this._connected=!0;return this}disconnect(){if(!1!==this._connected){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(let a=1,b=this.filters.length;a<b;a++)this.filters[a-1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());this._connected=!1;return this}}getFilters(){return this.filters}setFilters(a){a||
(a=[]);!0===this._connected?(this.disconnect(),this.filters=a.slice(),this.connect()):this.filters=a.slice();return this}setDetune(a){this.detune=a;!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01);return this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(a){return this.setFilters(a?[a]:[])}setPlaybackRate(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");
else return this.playbackRate=a,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.loop=a,!0===this.isPlaying&&(this.source.loop=
this.loop),this}setLoopStart(a){this.loopStart=a;return this}setLoopEnd(a){this.loopEnd=a;return this}getVolume(){return this.gain.gain.value}setVolume(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this}}const sj=new mb,Ax=new rf,zB=new mb,tj=new mb;class BA extends Tv{constructor(a){super(a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}connect(){super.connect();this.panner.connect(this.gain)}disconnect(){super.disconnect();
this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(a){this.panner.refDistance=a;return this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(a){this.panner.rolloffFactor=a;return this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(a){this.panner.distanceModel=a;return this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(a){this.panner.maxDistance=a;return this}setDirectionalCone(a,
b,e){this.panner.coneInnerAngle=a;this.panner.coneOuterAngle=b;this.panner.coneOuterGain=e;return this}updateMatrixWorld(a){super.updateMatrixWorld(a);if(!0!==this.hasPlaybackControl||!1!==this.isPlaying)if(this.matrixWorld.decompose(sj,Ax,zB),tj.set(0,0,1).applyQuaternion(Ax),a=this.panner,a.positionX){const b=this.context.currentTime+this.listener.timeDelta;a.positionX.linearRampToValueAtTime(sj.x,b);a.positionY.linearRampToValueAtTime(sj.y,b);a.positionZ.linearRampToValueAtTime(sj.z,b);a.orientationX.linearRampToValueAtTime(tj.x,
b);a.orientationY.linearRampToValueAtTime(tj.y,b);a.orientationZ.linearRampToValueAtTime(tj.z,b)}else a.setPosition(sj.x,sj.y,sj.z),a.setOrientation(tj.x,tj.y,tj.z)}}class Wz{constructor(a,b=2048){this.analyser=a.context.createAnalyser();this.analyser.fftSize=b;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}getFrequencyData(){this.analyser.getByteFrequencyData(this.data);return this.data}getAverageFrequency(){let a=0;const b=this.getFrequencyData();
for(let e=0;e<b.length;e++)a+=b[e];return a/b.length}}class qw{constructor(a,b,e){this.binding=a;this.valueSize=e;let f;switch(b){case "quaternion":a=this._slerp;b=this._slerpAdditive;f=this._setAdditiveIdentityQuaternion;this.buffer=new Float64Array(6*e);this._workIndex=5;break;case "string":case "bool":b=a=this._select;f=this._setAdditiveIdentityOther;this.buffer=Array(5*e);break;default:a=this._lerp,b=this._lerpAdditive,f=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*e)}this._mixBufferRegion=
a;this._mixBufferRegionAdditive=b;this._setIdentity=f;this._origIndex=3;this._addIndex=4;this.referenceCount=this.useCount=this.cumulativeWeightAdditive=this.cumulativeWeight=0}accumulate(a,b){const e=this.buffer,f=this.valueSize;a=a*f+f;var h=this.cumulativeWeight;if(0===h){for(h=0;h!==f;++h)e[a+h]=e[h];h=b}else h+=b,this._mixBufferRegion(e,a,0,b/h,f);this.cumulativeWeight=h}accumulateAdditive(a){const b=this.buffer,e=this.valueSize,f=e*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity();
this._mixBufferRegionAdditive(b,f,0,a,e);this.cumulativeWeightAdditive+=a}apply(a){const b=this.valueSize,e=this.buffer;a=a*b+b;const f=this.cumulativeWeight,h=this.cumulativeWeightAdditive,n=this.binding;this.cumulativeWeightAdditive=this.cumulativeWeight=0;1>f&&this._mixBufferRegion(e,a,b*this._origIndex,1-f,b);0<h&&this._mixBufferRegionAdditive(e,a,this._addIndex*b,1,b);for(let r=b,t=b+b;r!==t;++r)if(e[r]!==e[r+b]){n.setValue(e,a);break}}saveOriginalState(){const a=this.buffer,b=this.valueSize,
e=b*this._origIndex;this.binding.getValue(a,e);for(let f=b,h=e;f!==h;++f)a[f]=a[e+f%b];this._setIdentity();this.cumulativeWeightAdditive=this.cumulativeWeight=0}restoreOriginalState(){this.binding.setValue(this.buffer,3*this.valueSize)}_setAdditiveIdentityNumeric(){var a=this._addIndex*this.valueSize;const b=a+this.valueSize;for(;a<b;a++)this.buffer[a]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric();this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const a=
this._origIndex*this.valueSize,b=this._addIndex*this.valueSize;for(let e=0;e<this.valueSize;e++)this.buffer[b+e]=this.buffer[a+e]}_select(a,b,e,f,h){if(.5<=f)for(f=0;f!==h;++f)a[b+f]=a[e+f]}_slerp(a,b,e,f){rf.slerpFlat(a,b,a,b,a,e,f)}_slerpAdditive(a,b,e,f,h){h*=this._workIndex;rf.multiplyQuaternionsFlat(a,h,a,b,a,e);rf.slerpFlat(a,b,a,b,a,h,f)}_lerp(a,b,e,f,h){const n=1-f;for(let r=0;r!==h;++r){const t=b+r;a[t]=a[t]*n+a[e+r]*f}}_lerpAdditive(a,b,e,f,h){for(let n=0;n!==h;++n){const r=b+n;a[r]+=a[e+
n]*f}}}const AB=RegExp("[\\[\\]\\.:\\/]","g"),BB=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),CB=/(WCOD+)?/.source.replace("WCOD","[^\\[\\]:\\/]"),DB=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),EB=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),FB=new RegExp("^"+BB+CB+DB+EB+"$"),GB=["material","materials","bones","map"];class HB{constructor(a,b,e){e=e||Ed.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,e)}getValue(a,b){this.bind();
const e=this._bindings[this._targetGroup.nCachedObjects_];void 0!==e&&e.getValue(a,b)}setValue(a,b){const e=this._bindings;for(let f=this._targetGroup.nCachedObjects_,h=e.length;f!==h;++f)e[f].setValue(a,b)}bind(){const a=this._bindings;for(let b=this._targetGroup.nCachedObjects_,e=a.length;b!==e;++b)a[b].bind()}unbind(){const a=this._bindings;for(let b=this._targetGroup.nCachedObjects_,e=a.length;b!==e;++b)a[b].unbind()}}class Ed{constructor(a,b,e){this.path=b;this.parsedPath=e||Ed.parseTrackName(b);
this.node=Ed.findNode(a,this.parsedPath.nodeName);this.rootNode=a;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}static create(a,b,e){return a&&a.isAnimationObjectGroup?new Ed.Composite(a,b,e):new Ed(a,b,e)}static sanitizeNodeName(a){return a.replace(/\s/g,"_").replace(AB,"")}static parseTrackName(a){var b=FB.exec(a);if(null===b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};
const e=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==e&&-1!==e){const f=b.nodeName.substring(e+1);-1!==GB.indexOf(f)&&(b.nodeName=b.nodeName.substring(0,e),b.objectName=f)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b}static findNode(a,b){if(void 0===b||""===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){const e=a.skeleton.getBoneByName(b);if(void 0!==e)return e}if(a.children){const e=
function(f){for(let n=0;n<f.length;n++){var h=f[n];if(h.name===b||h.uuid===b||(h=e(h.children)))return h}return null};if(a=e(a.children))return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(a,b){a[b]=this.targetObject[this.propertyName]}_getValue_array(a,b){const e=this.resolvedProperty;for(let f=0,h=e.length;f!==h;++f)a[b++]=e[f]}_getValue_arrayElement(a,b){a[b]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(a,b){this.resolvedProperty.toArray(a,b)}_setValue_direct(a,
b){this.targetObject[this.propertyName]=a[b]}_setValue_direct_setNeedsUpdate(a,b){this.targetObject[this.propertyName]=a[b];this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(a,b){this.targetObject[this.propertyName]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(a,b){const e=this.resolvedProperty;for(let f=0,h=e.length;f!==h;++f)e[f]=a[b++]}_setValue_array_setNeedsUpdate(a,b){const e=this.resolvedProperty;for(let f=0,h=e.length;f!==h;++f)e[f]=a[b++];this.targetObject.needsUpdate=
!0}_setValue_array_setMatrixWorldNeedsUpdate(a,b){const e=this.resolvedProperty;for(let f=0,h=e.length;f!==h;++f)e[f]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(a,b){this.resolvedProperty[this.propertyIndex]=a[b]}_setValue_arrayElement_setNeedsUpdate(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.matrixWorldNeedsUpdate=
!0}_setValue_fromArray(a,b){this.resolvedProperty.fromArray(a,b)}_setValue_fromArray_setNeedsUpdate(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(a,b){this.bind();this.getValue(a,b)}_setValue_unbound(a,b){this.bind();this.setValue(a,b)}bind(){let a=this.node;var b=this.parsedPath,e=b.objectName;const f=b.propertyName;let h=
b.propertyIndex;a||(this.node=a=Ed.findNode(this.rootNode,b.nodeName));this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(e){var n=b.objectIndex;switch(e){case "materials":if(!a.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!a.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}a=
a.material.materials;break;case "bones":if(!a.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}a=a.skeleton.bones;for(e=0;e<a.length;e++)if(a[e].name===n){n=e;break}break;case "map":if("map"in a){a=a.map;break}if(!a.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!a.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",
this);return}a=a.material.map;break;default:if(void 0===a[e]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}a=a[e]}if(void 0!==n){if(void 0===a[n]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,a);return}a=a[n]}}n=a[f];if(void 0===n)console.error("THREE.PropertyBinding: Trying to update property for track: "+b.nodeName+"."+f+" but it wasn't found.",a);else{b=this.Versioning.None;this.targetObject=
a;void 0!==a.needsUpdate?b=this.Versioning.NeedsUpdate:void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate);e=this.BindingType.Direct;if(void 0!==h){if("morphTargetInfluences"===f){if(!a.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!a.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",
this);return}void 0!==a.morphTargetDictionary[h]&&(h=a.morphTargetDictionary[h])}e=this.BindingType.ArrayElement;this.resolvedProperty=n;this.propertyIndex=h}else void 0!==n.fromArray&&void 0!==n.toArray?(e=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(e=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=f;this.getValue=this.GetterByBindingType[e];this.setValue=this.SetterByBindingTypeAndVersioning[e][b]}}else console.warn("THREE.PropertyBinding: No target node found for track: "+
this.path+".")}unbind(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}}Ed.Composite=HB;Ed.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ed.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ed.prototype.GetterByBindingType=[Ed.prototype._getValue_direct,Ed.prototype._getValue_array,Ed.prototype._getValue_arrayElement,Ed.prototype._getValue_toArray];Ed.prototype.SetterByBindingTypeAndVersioning=[[Ed.prototype._setValue_direct,
Ed.prototype._setValue_direct_setNeedsUpdate,Ed.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ed.prototype._setValue_array,Ed.prototype._setValue_array_setNeedsUpdate,Ed.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ed.prototype._setValue_arrayElement,Ed.prototype._setValue_arrayElement_setNeedsUpdate,Ed.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ed.prototype._setValue_fromArray,Ed.prototype._setValue_fromArray_setNeedsUpdate,Ed.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];
class Tz{constructor(){this.isAnimationObjectGroup=!0;this.uuid=fd();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;const a={};this._indicesByUUID=a;for(let e=0,f=arguments.length;e!==f;++e)a[arguments[e].uuid]=e;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};const b=this;this.stats={objects:{get total(){return b._objects.length},get In(){return this.total-b.nCachedObjects_}},get QA(){return b._bindings.length}}}add(){const a=this._objects,
b=this._indicesByUUID,e=this._paths,f=this._parsedPaths,h=this._bindings,n=h.length;let r=void 0,t=a.length,w=this.nCachedObjects_;for(let z=0,ab=arguments.length;z!==ab;++z){const eb=arguments[z];var x=eb.uuid;let cb=b[x];if(void 0===cb){cb=t++;b[x]=cb;a.push(eb);for(let db=0,bb=n;db!==bb;++db)h[db].push(new Ed(eb,e[db],f[db]))}else if(cb<w){r=a[cb];const db=--w;var y=a[db];b[y.uuid]=cb;a[cb]=y;b[x]=db;a[db]=eb;for(let bb=0,gb=n;bb!==gb;++bb)x=h[bb],y=x[cb],x[cb]=x[db],void 0===y&&(y=new Ed(eb,e[bb],
f[bb])),x[db]=y}else a[cb]!==r&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=w}remove(){const a=this._objects,b=this._indicesByUUID,e=this._bindings,f=e.length;let h=this.nCachedObjects_;for(let t=0,w=arguments.length;t!==w;++t){var n=arguments[t],r=n.uuid;const x=b[r];if(void 0!==x&&x>=h){const y=h++,z=a[y];b[z.uuid]=x;a[x]=z;b[r]=y;a[y]=n;for(let ab=0,eb=f;ab!==
eb;++ab)n=e[ab],r=n[x],n[x]=n[y],n[y]=r}}this.nCachedObjects_=h}uncache(){const a=this._objects,b=this._indicesByUUID,e=this._bindings,f=e.length;let h=this.nCachedObjects_,n=a.length;for(let y=0,z=arguments.length;y!==z;++y){var r=arguments[y].uuid;const ab=b[r];if(void 0!==ab)if(delete b[r],ab<h){r=--h;var t=a[r],w=--n,x=a[w];b[t.uuid]=ab;a[ab]=t;b[x.uuid]=r;a[r]=x;a.pop();for(let eb=0,cb=f;eb!==cb;++eb)t=e[eb],x=t[w],t[ab]=t[r],t[r]=x,t.pop()}else{r=--n;w=a[r];0<r&&(b[w.uuid]=ab);a[ab]=w;a.pop();
for(let eb=0,cb=f;eb!==cb;++eb)w=e[eb],w[ab]=w[r],w.pop()}}this.nCachedObjects_=h}subscribe_(a,b){const e=this._bindingsIndicesByPath;let f=e[a];const h=this._bindings;if(void 0!==f)return h[f];const n=this._paths,r=this._parsedPaths,t=this._objects,w=this.nCachedObjects_,x=Array(t.length);f=h.length;e[a]=f;n.push(a);r.push(b);h.push(x);for(let y=w,z=t.length;y!==z;++y)x[y]=new Ed(t[y],a,b);return x}unsubscribe_(a){const b=this._bindingsIndicesByPath,e=b[a];if(void 0!==e){const f=this._paths,h=this._parsedPaths,
n=this._bindings,r=n.length-1,t=n[r];b[a[r]]=e;n[e]=t;n.pop();h[e]=h[r];h.pop();f[e]=f[r];f.pop()}}}class Qv{constructor(a,b,e=null,f=b.blendMode){this._mixer=a;this._clip=b;this._localRoot=e;this.blendMode=f;a=b.tracks;b=a.length;e=Array(b);f={endingStart:2400,endingEnd:2400};for(let h=0;h!==b;++h){const n=a[h].createInterpolant(null);e[h]=n;n.settings=f}this._interpolantSettings=f;this._interpolants=e;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=
this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}play(){this._mixer._activateAction(this);return this}stop(){this._mixer._deactivateAction(this);return this.reset()}reset(){this.paused=!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return 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(a){this._startTime=a;return this}setLoop(a,b){this.loop=a;this.repetitions=b;return this}setEffectiveWeight(a){this.weight=a;this._effectiveWeight=this.enabled?a:0;return this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(a){return this._scheduleFading(a,0,1)}fadeOut(a){return this._scheduleFading(a,1,0)}crossFadeFrom(a,
b,e){a.fadeOut(b);this.fadeIn(b);if(e){e=this._clip.duration;const f=a._clip.duration,h=e/f;a.warp(1,f/e,b);this.warp(h,1,b)}return this}crossFadeTo(a,b,e){return a.crossFadeFrom(this,b,e)}stopFading(){const a=this._weightInterpolant;null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this}setEffectiveTimeScale(a){this.timeScale=a;this._effectiveTimeScale=this.paused?0:a;return this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(a){this.timeScale=
this._clip.duration/a;return this.stopWarping()}syncWith(a){this.time=a.time;this.timeScale=a.timeScale;return this.stopWarping()}halt(a){return this.warp(this._effectiveTimeScale,0,a)}warp(a,b,e){var f=this._mixer;const h=f.time,n=this.timeScale;var r=this._timeScaleInterpolant;null===r&&(this._timeScaleInterpolant=r=f._lendControlInterpolant());f=r.parameterPositions;r=r.sampleValues;f[0]=h;f[1]=h+e;r[0]=a/n;r[1]=b/n;return this}stopWarping(){const a=this._timeScaleInterpolant;null!==a&&(this._timeScaleInterpolant=
null,this._mixer._takeBackControlInterpolant(a));return this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(a,b,e,f){if(this.enabled){var h=this._startTime;null!==h&&(b=(a-h)*e,0>b||0===e?b=0:(this._startTime=null,b*=e));b*=this._updateTimeScale(a);e=this._updateTime(b);a=this._updateWeight(a);if(0<a)switch(b=this._interpolants,h=this._propertyBindings,this.blendMode){case 2501:for(let n=0,r=b.length;n!==r;++n)b[n].evaluate(e),
h[n].accumulateAdditive(a);break;default:for(let n=0,r=b.length;n!==r;++n)b[n].evaluate(e),h[n].accumulate(f,a)}}else this._updateWeight(a)}_updateWeight(a){let b=0;if(this.enabled){b=this.weight;const e=this._weightInterpolant;if(null!==e){const f=e.evaluate(a)[0];b*=f;a>e.parameterPositions[1]&&(this.stopFading(),0===f&&(this.enabled=!1))}}return this._effectiveWeight=b}_updateTimeScale(a){let b=0;if(!this.paused){b=this.timeScale;const e=this._timeScaleInterpolant;if(null!==e){const f=e.evaluate(a)[0];
b*=f;a>e.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b}_updateTime(a){const b=this._clip.duration;var e=this.loop;let f=this.time+a,h=this._loopCount;const n=2202===e;if(0===a)return-1===h?f:n&&1===(h&1)?b-f:f;if(2200===e)a:{if(-1===h&&(this._loopCount=0,this._setEndings(!0,!0,!1)),f>=b)f=b;else if(0>f)f=0;else{this.time=f;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=f;this._mixer.dispatchEvent({type:"finished",
action:this,direction:0>a?-1:1})}else{-1===h&&(0<=a?(h=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n));if(f>=b||0>f){e=Math.floor(f/b);f-=b*e;h+=Math.abs(e);const r=this.repetitions-h;0>=r?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=f=0<a?b:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<a?1:-1})):(1===r?(a=0>a,this._setEndings(a,!a,n)):this._setEndings(!1,!1,n),this._loopCount=h,this.time=f,this._mixer.dispatchEvent({type:"loop",
action:this,loopDelta:e}))}else this.time=f;if(n&&1===(h&1))return b-f}return f}_setEndings(a,b,e){const f=this._interpolantSettings;e?(f.endingStart=2401,f.endingEnd=2401):(f.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,f.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(a,b,e){var f=this._mixer;const h=f.time;var n=this._weightInterpolant;null===n&&(this._weightInterpolant=n=f._lendControlInterpolant());f=n.parameterPositions;n=n.sampleValues;f[0]=h;n[0]=b;f[1]=h+a;n[1]=e;return this}}
const IB=new Float32Array(1);class Sz extends ng{constructor(a){super();this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}_bindAction(a,b){const e=a._localRoot||this._root,f=a._clip.tracks,h=f.length,n=a._propertyBindings;a=a._interpolants;const r=e.uuid;var t=this._bindingsByRootAndName;let w=t[r];void 0===w&&(w={},t[r]=w);for(t=0;t!==h;++t){const x=f[t],y=x.name;let z=w[y];if(void 0!==z)++z.referenceCount;else{z=n[t];if(void 0!==z){null===z._cacheIndex&&(++z.referenceCount,
this._addInactiveBinding(z,r,y));continue}z=new qw(Ed.create(e,y,b&&b._propertyBindings[t].binding.parsedPath),x.ValueTypeName,x.getValueSize());++z.referenceCount;this._addInactiveBinding(z,r,y)}n[t]=z;a[t].resultBuffer=z.buffer}}_activateAction(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,e=a._clip.uuid;const f=this._actionsByClip[e];this._bindAction(a,f&&f.knownActions[0]);this._addInactiveAction(a,e,b)}b=a._propertyBindings;for(let f=0,h=b.length;f!==
h;++f)e=b[f],0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState());this._lendAction(a)}}_deactivateAction(a){if(this._isActiveAction(a)){const b=a._propertyBindings;for(let e=0,f=b.length;e!==f;++e){const h=b[e];0===--h.useCount&&(h.restoreOriginalState(),this._takeBackBinding(h))}this._takeBackAction(a)}}_initMemoryManager(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];
this._nActiveControlInterpolants=0;const a=this;this.stats={actions:{get total(){return a._actions.length},get In(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get In(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get In(){return a._nActiveControlInterpolants}}}}_isActiveAction(a){a=a._cacheIndex;return null!==a&&a<this._nActiveActions}_addInactiveAction(a,b,e){const f=this._actions,h=this._actionsByClip;let n=h[b];
void 0===n?(n={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,h[b]=n):(b=n.knownActions,a._byClipCacheIndex=b.length,b.push(a));a._cacheIndex=f.length;f.push(a);n.actionByRoot[e]=a}_removeInactiveAction(a){var b=this._actions,e=b[b.length-1],f=a._cacheIndex;e._cacheIndex=f;b[f]=e;b.pop();a._cacheIndex=null;b=a._clip.uuid;e=this._actionsByClip;f=e[b];const h=f.knownActions,n=h[h.length-1],r=a._byClipCacheIndex;n._byClipCacheIndex=r;h[r]=n;h.pop();a._byClipCacheIndex=null;delete f.actionByRoot[(a._localRoot||
this._root).uuid];0===h.length&&delete e[b];this._removeInactiveBindingsForAction(a)}_removeInactiveBindingsForAction(a){a=a._propertyBindings;for(let b=0,e=a.length;b!==e;++b){const f=a[b];0===--f.referenceCount&&this._removeInactiveBinding(f)}}_lendAction(a){const b=this._actions,e=a._cacheIndex,f=this._nActiveActions++,h=b[f];a._cacheIndex=f;b[f]=a;h._cacheIndex=e;b[e]=h}_takeBackAction(a){const b=this._actions,e=a._cacheIndex,f=--this._nActiveActions,h=b[f];a._cacheIndex=f;b[f]=a;h._cacheIndex=
e;b[e]=h}_addInactiveBinding(a,b,e){const f=this._bindingsByRootAndName,h=this._bindings;let n=f[b];void 0===n&&(n={},f[b]=n);n[e]=a;a._cacheIndex=h.length;h.push(a)}_removeInactiveBinding(a){const b=this._bindings;var e=a.binding;const f=e.rootNode.uuid;e=e.path;const h=this._bindingsByRootAndName,n=h[f],r=b[b.length-1];a=a._cacheIndex;r._cacheIndex=a;b[a]=r;b.pop();delete n[e];0===Object.keys(n).length&&delete h[f]}_lendBinding(a){const b=this._bindings,e=a._cacheIndex,f=this._nActiveBindings++,
h=b[f];a._cacheIndex=f;b[f]=a;h._cacheIndex=e;b[e]=h}_takeBackBinding(a){const b=this._bindings,e=a._cacheIndex,f=--this._nActiveBindings,h=b[f];a._cacheIndex=f;b[f]=a;h._cacheIndex=e;b[e]=h}_lendControlInterpolant(){const a=this._controlInterpolants,b=this._nActiveControlInterpolants++;let e=a[b];void 0===e&&(e=new Hp(new Float32Array(2),new Float32Array(2),1,IB),e.__cacheIndex=b,a[b]=e);return e}_takeBackControlInterpolant(a){const b=this._controlInterpolants,e=a.__cacheIndex,f=--this._nActiveControlInterpolants,
h=b[f];a.__cacheIndex=f;b[f]=a;h.__cacheIndex=e;b[e]=h}clipAction(a,b,e){var f=b||this._root;const h=f.uuid;f="string"===typeof a?Ij.findByName(f,a):a;a=null!==f?f.uuid:a;const n=this._actionsByClip[a];var r=null;void 0===e&&(e=null!==f?f.blendMode:2500);if(void 0!==n){r=n.actionByRoot[h];if(void 0!==r&&r.blendMode===e)return r;r=n.knownActions[0];null===f&&(f=r._clip)}if(null===f)return null;b=new Qv(this,f,b,e);this._bindAction(b,r);this._addInactiveAction(b,a,h);return b}existingAction(a,b){var e=
b||this._root;b=e.uuid;e="string"===typeof a?Ij.findByName(e,a):a;a=this._actionsByClip[e?e.uuid:a];return void 0!==a?a.actionByRoot[b]||null:null}stopAllAction(){const a=this._actions;var b=this._nActiveActions;for(--b;0<=b;--b)a[b].stop();return this}update(a){a*=this.timeScale;var b=this._actions,e=this._nActiveActions;const f=this.time+=a,h=Math.sign(a),n=this._accuIndex^=1;for(let r=0;r!==e;++r)b[r]._update(f,a,h,n);a=this._bindings;b=this._nActiveBindings;for(e=0;e!==b;++e)a[e].apply(n);return this}setTime(a){this.time=
0;for(let b=0;b<this._actions.length;b++)this._actions[b].time=0;return this.update(a)}getRoot(){return this._root}uncacheClip(a){const b=this._actions;a=a.uuid;const e=this._actionsByClip;var f=e[a];if(void 0!==f){f=f.knownActions;for(let h=0,n=f.length;h!==n;++h){const r=f[h];this._deactivateAction(r);const t=r._cacheIndex,w=b[b.length-1];r._cacheIndex=null;r._byClipCacheIndex=null;w._cacheIndex=t;b[t]=w;b.pop();this._removeInactiveBindingsForAction(r)}delete e[a]}}uncacheRoot(a){a=a.uuid;const b=
this._actionsByClip;for(var e in b){const f=b[e].actionByRoot[a];void 0!==f&&(this._deactivateAction(f),this._removeInactiveAction(f))}e=this._bindingsByRootAndName[a];if(void 0!==e)for(const f in e)a=e[f],a.restoreOriginalState(),this._removeInactiveBinding(a)}uncacheAction(a,b){a=this.existingAction(a,b);null!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}}class zw{constructor(a){this.value=a}clone(){return new zw(void 0===this.value.clone?this.value:this.value.clone())}}let JB=
0;class KA extends ng{constructor(){super();this.isUniformsGroup=!0;Object.defineProperty(this,"id",{value:JB++});this.name="";this.usage=35044;this.uniforms=[]}add(a){this.uniforms.push(a);return this}remove(a){a=this.uniforms.indexOf(a);-1!==a&&this.uniforms.splice(a,1);return this}setName(a){this.name=a;return this}setUsage(a){this.usage=a;return this}dispose(){this.dispatchEvent({type:"dispose"});return this}copy(a){this.name=a.name;this.usage=a.usage;a=a.uniforms;this.uniforms.length=0;for(let b=
0,e=a.length;b<e;b++){const f=Array.isArray(a[b])?a[b]:[a[b]];for(let h=0;h<f.length;h++)this.uniforms.push(f[h].clone())}return this}clone(){return(new this.constructor).copy(this)}}class rA extends qk{constructor(a,b,e=1){super(a,b);this.isInstancedInterleavedBuffer=!0;this.meshPerAttribute=e}copy(a){super.copy(a);this.meshPerAttribute=a.meshPerAttribute;return this}clone(a){a=super.clone(a);a.meshPerAttribute=this.meshPerAttribute;return a}toJSON(a){a=super.toJSON(a);a.isInstancedInterleavedBuffer=
!0;a.meshPerAttribute=this.meshPerAttribute;return a}}class oA{constructor(a,b,e,f,h){this.isGLBufferAttribute=!0;this.name="";this.buffer=a;this.type=b;this.itemSize=e;this.elementSize=f;this.count=h;this.version=0}set needsUpdate(a){!0===a&&this.version++}setBuffer(a){this.buffer=a;return this}setType(a,b){this.type=a;this.elementSize=b;return this}setItemSize(a){this.itemSize=a;return this}setCount(a){this.count=a;return this}}const Bx=new gd;class tw{constructor(a,b,e=0,f=Infinity){this.ray=new dj(a,
b);this.near=e;this.far=f;this.camera=null;this.layers=new Sk;this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(a,b){this.ray.set(a,b)}setFromCamera(a,b){b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize(),this.camera=b):b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld),
this.camera=b):console.error("THREE.Raycaster: Unsupported camera type: "+b.type)}setFromXRController(a){Bx.identity().extractRotation(a.matrixWorld);this.ray.origin.setFromMatrixPosition(a.matrixWorld);this.ray.direction.set(0,0,-1).applyMatrix4(Bx);return this}intersectObject(a,b=!0,e=[]){op(a,this,e,b);e.sort(Hv);return e}intersectObjects(a,b=!0,e=[]){for(let f=0,h=a.length;f<h;f++)op(a[f],this,e,b);e.sort(Hv);return e}}class EA{constructor(a=1,b=0,e=0){this.radius=a;this.phi=b;this.theta=e;return this}set(a,
b,e){this.radius=a;this.phi=b;this.theta=e;return this}copy(a){this.radius=a.radius;this.phi=a.phi;this.theta=a.theta;return this}makeSafe(){this.phi=Math.max(1E-6,Math.min(Math.PI-1E-6,this.phi));return this}setFromVector3(a){return this.setFromCartesianCoords(a.x,a.y,a.z)}setFromCartesianCoords(a,b,e){this.radius=Math.sqrt(a*a+b*b+e*e);0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(a,e),this.phi=Math.acos(jd(b/this.radius,-1,1)));return this}clone(){return(new this.constructor).copy(this)}}
class iA{constructor(a=1,b=0,e=0){this.radius=a;this.theta=b;this.y=e;return this}set(a,b,e){this.radius=a;this.theta=b;this.y=e;return this}copy(a){this.radius=a.radius;this.theta=a.theta;this.y=a.y;return this}setFromVector3(a){return this.setFromCartesianCoords(a.x,a.y,a.z)}setFromCartesianCoords(a,b,e){this.radius=Math.sqrt(a*a+e*e);this.theta=Math.atan2(a,e);this.y=b;return this}clone(){return(new this.constructor).copy(this)}}const Cx=new Lb;class $z{constructor(a=new Lb(Infinity,Infinity),
b=new Lb(-Infinity,-Infinity)){this.isBox2=!0;this.min=a;this.max=b}set(a,b){this.min.copy(a);this.max.copy(b);return this}setFromPoints(a){this.makeEmpty();for(let b=0,e=a.length;b<e;b++)this.expandByPoint(a[b]);return this}setFromCenterAndSize(a,b){b=Cx.copy(b).multiplyScalar(.5);this.min.copy(a).sub(b);this.max.copy(a).add(b);return this}clone(){return(new this.constructor).copy(this)}copy(a){this.min.copy(a.min);this.max.copy(a.max);return this}makeEmpty(){this.min.x=this.min.y=Infinity;this.max.x=
this.max.y=-Infinity;return this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(a){return this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(a){return this.isEmpty()?a.set(0,0):a.subVectors(this.max,this.min)}expandByPoint(a){this.min.min(a);this.max.max(a);return this}expandByVector(a){this.min.sub(a);this.max.add(a);return this}expandByScalar(a){this.min.addScalar(-a);this.max.addScalar(a);return this}containsPoint(a){return a.x<this.min.x||
a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0}containsBox(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y}getParameter(a,b){return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0}clampPoint(a,b){return b.copy(a).clamp(this.min,this.max)}distanceToPoint(a){return this.clampPoint(a,Cx).distanceTo(a)}intersect(a){this.min.max(a.min);
this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this}union(a){this.min.min(a.min);this.max.max(a.max);return this}translate(a){this.min.add(a);this.max.add(a);return this}equals(a){return a.min.equals(this.min)&&a.max.equals(this.max)}}const Dx=new mb,Lm=new mb;class vA{constructor(a=new mb,b=new mb){this.start=a;this.end=b}set(a,b){this.start.copy(a);this.end.copy(b);return this}copy(a){this.start.copy(a.start);this.end.copy(a.end);return this}getCenter(a){return a.addVectors(this.start,
this.end).multiplyScalar(.5)}delta(a){return a.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(a,b){return this.delta(b).multiplyScalar(a).add(this.start)}closestPointToPointParameter(a,b){Dx.subVectors(a,this.start);Lm.subVectors(this.end,this.start);a=Lm.dot(Lm);a=Lm.dot(Dx)/a;b&&(a=jd(a,0,1));return a}closestPointToPoint(a,b,e){a=this.closestPointToPointParameter(a,b);return this.delta(e).multiplyScalar(a).add(this.start)}applyMatrix4(a){this.start.applyMatrix4(a);
this.end.applyMatrix4(a);return this}equals(a){return a.start.equals(this.start)&&a.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Ex=new mb;class FA extends Cd{constructor(a,b){super();this.light=a;this.matrixAutoUpdate=!1;this.color=b;this.type="SpotLightHelper";a=new md;b=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,f=1,h=32;e<h;e++,f++){const n=e/h*Math.PI*2,r=f/h*Math.PI*2;b.push(Math.cos(n),Math.sin(n),1,Math.cos(r),Math.sin(r),1)}a.setAttribute("position",
new $b(b,3));b=new mf({fog:!1,toneMapped:!1});this.cone=new Vf(a,b);this.add(this.cone);this.update()}dispose(){this.cone.geometry.dispose();this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1);this.light.target.updateWorldMatrix(!0,!1);this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld);this.matrixWorld.copy(this.light.matrixWorld);const a=this.light.distance?
this.light.distance:1E3,b=a*Math.tan(this.light.angle);this.cone.scale.set(b,b,a);Ex.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(Ex);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Lg=new mb,Mm=new gd,Kq=new gd;class DA extends Vf{constructor(a){const b=Iv(a),e=new md;var f=[];const h=[],n=new Tb(0,0,1),r=new Tb(0,1,0);for(let t=0;t<b.length;t++){const w=b[t];w.parent&&w.parent.isBone&&(f.push(0,0,0),f.push(0,
0,0),h.push(n.r,n.g,n.b),h.push(r.r,r.g,r.b))}e.setAttribute("position",new $b(f,3));e.setAttribute("color",new $b(h,3));f=new mf({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(e,f);this.isSkeletonHelper=!0;this.type="SkeletonHelper";this.root=a;this.bones=b;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1}updateMatrixWorld(a){const b=this.bones,e=this.geometry,f=e.getAttribute("position");Kq.copy(this.root.matrixWorld).invert();for(let h=0,n=0;h<b.length;h++){const r=
b[h];r.parent&&r.parent.isBone&&(Mm.multiplyMatrices(Kq,r.matrixWorld),Lg.setFromMatrixPosition(Mm),f.setXYZ(n,Lg.x,Lg.y,Lg.z),Mm.multiplyMatrices(Kq,r.parent.matrixWorld),Lg.setFromMatrixPosition(Mm),f.setXYZ(n+1,Lg.x,Lg.y,Lg.z),n+=2)}e.getAttribute("position").needsUpdate=!0;super.updateMatrixWorld(a)}dispose(){this.geometry.dispose();this.material.dispose()}}class zA extends Bd{constructor(a,b,e){b=new kg(b,4,2);const f=new Qd({wireframe:!0,fog:!1,toneMapped:!1});super(b,f);this.light=a;this.color=
e;this.type="PointLightHelper";this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1;this.update()}dispose(){this.geometry.dispose();this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1);void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const KB=new mb,Fx=new Tb,Gx=new Tb;class qA extends Cd{constructor(a,b,e){super();this.light=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=e;this.type="HemisphereLightHelper";
a=new em(b);a.rotateY(.5*Math.PI);this.material=new Qd({wireframe:!0,fog:!1,toneMapped:!1});void 0===this.color&&(this.material.vertexColors=!0);b=a.getAttribute("position");b=new Float32Array(3*b.count);a.setAttribute("color",new Hd(b,3));this.add(new Bd(a,this.material));this.update()}dispose(){this.children[0].geometry.dispose();this.children[0].material.dispose()}update(){const a=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const b=a.geometry.getAttribute("color");
Fx.copy(this.light.color);Gx.copy(this.light.groundColor);for(let e=0,f=b.count;e<f;e++){const h=e<f/2?Fx:Gx;b.setXYZ(e,h.r,h.g,h.b)}b.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1);a.lookAt(KB.setFromMatrixPosition(this.light.matrixWorld).negate())}}class pA extends Vf{constructor(a=10,b=10,e=4473924,f=8947848){e=new Tb(e);f=new Tb(f);const h=b/2,n=a/b,r=a/2;a=[];const t=[];for(let w=0,x=0,y=-r;w<=b;w++,y+=n){a.push(-r,0,y,r,0,y);a.push(y,0,-r,y,0,r);const z=w===h?e:f;z.toArray(t,x);x+=3;z.toArray(t,
x);x+=3;z.toArray(t,x);x+=3;z.toArray(t,x);x+=3}b=new md;b.setAttribute("position",new $b(a,3));b.setAttribute("color",new $b(t,3));e=new mf({vertexColors:!0,toneMapped:!1});super(b,e);this.type="GridHelper"}dispose(){this.geometry.dispose();this.material.dispose()}}class AA extends Vf{constructor(a=10,b=16,e=8,f=64,h=4473924,n=8947848){h=new Tb(h);n=new Tb(n);var r=[];const t=[];if(1<b)for(var w=0;w<b;w++){var x=w/b*2*Math.PI,y=Math.sin(x)*a;x=Math.cos(x)*a;r.push(0,0,0);r.push(y,0,x);y=w&1?h:n;
t.push(y.r,y.g,y.b);t.push(y.r,y.g,y.b)}for(b=0;b<e;b++)for(w=b&1?h:n,y=a-a/e*b,x=0;x<f;x++){var z=x/f*2*Math.PI;let ab=Math.sin(z)*y;z=Math.cos(z)*y;r.push(ab,0,z);t.push(w.r,w.g,w.b);z=(x+1)/f*2*Math.PI;ab=Math.sin(z)*y;z=Math.cos(z)*y;r.push(ab,0,z);t.push(w.r,w.g,w.b)}a=new md;a.setAttribute("position",new $b(r,3));a.setAttribute("color",new $b(t,3));r=new mf({vertexColors:!0,toneMapped:!1});super(a,r);this.type="PolarGridHelper"}dispose(){this.geometry.dispose();this.material.dispose()}}const Hx=
new mb,Nm=new mb,Ix=new mb;class lA extends Cd{constructor(a,b,e){super();this.light=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=e;this.type="DirectionalLightHelper";void 0===b&&(b=1);a=new md;a.setAttribute("position",new $b([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));b=new mf({fog:!1,toneMapped:!1});this.lightPlane=new cg(a,b);this.add(this.lightPlane);a=new md;a.setAttribute("position",new $b([0,0,0,0,0,1],3));this.targetLine=new cg(a,b);this.add(this.targetLine);this.update()}dispose(){this.lightPlane.geometry.dispose();
this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1);this.light.target.updateWorldMatrix(!0,!1);Hx.setFromMatrixPosition(this.light.matrixWorld);Nm.setFromMatrixPosition(this.light.target.matrixWorld);Ix.subVectors(Nm,Hx);this.lightPlane.lookAt(Nm);void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),
this.targetLine.material.color.copy(this.light.color));this.targetLine.lookAt(Nm);this.targetLine.scale.z=Ix.length()}}const Xk=new mb,Xd=new Zk;class cA extends Vf{constructor(a){function b(y,z){e(y);e(z)}function e(y){n.push(0,0,0);r.push(0,0,0);void 0===t[y]&&(t[y]=[]);t[y].push(n.length/3-1)}var f=new md,h=new mf({color:16777215,vertexColors:!0,toneMapped:!1});const n=[],r=[],t={};b("n1","n2");b("n2","n4");b("n4","n3");b("n3","n1");b("f1","f2");b("f2","f4");b("f4","f3");b("f3","f1");b("n1","f1");
b("n2","f2");b("n3","f3");b("n4","f4");b("p","n1");b("p","n2");b("p","n3");b("p","n4");b("u1","u2");b("u2","u3");b("u3","u1");b("c","t");b("p","c");b("cn1","cn2");b("cn3","cn4");b("cf1","cf2");b("cf3","cf4");f.setAttribute("position",new $b(n,3));f.setAttribute("color",new $b(r,3));super(f,h);this.type="CameraHelper";this.camera=a;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=t;this.update();a=new Tb(16755200);
f=new Tb(16711680);h=new Tb(43775);const w=new Tb(16777215),x=new Tb(3355443);this.setColors(a,f,h,w,x)}setColors(a,b,e,f,h){const n=this.geometry.getAttribute("color");n.setXYZ(0,a.r,a.g,a.b);n.setXYZ(1,a.r,a.g,a.b);n.setXYZ(2,a.r,a.g,a.b);n.setXYZ(3,a.r,a.g,a.b);n.setXYZ(4,a.r,a.g,a.b);n.setXYZ(5,a.r,a.g,a.b);n.setXYZ(6,a.r,a.g,a.b);n.setXYZ(7,a.r,a.g,a.b);n.setXYZ(8,a.r,a.g,a.b);n.setXYZ(9,a.r,a.g,a.b);n.setXYZ(10,a.r,a.g,a.b);n.setXYZ(11,a.r,a.g,a.b);n.setXYZ(12,a.r,a.g,a.b);n.setXYZ(13,a.r,a.g,
a.b);n.setXYZ(14,a.r,a.g,a.b);n.setXYZ(15,a.r,a.g,a.b);n.setXYZ(16,a.r,a.g,a.b);n.setXYZ(17,a.r,a.g,a.b);n.setXYZ(18,a.r,a.g,a.b);n.setXYZ(19,a.r,a.g,a.b);n.setXYZ(20,a.r,a.g,a.b);n.setXYZ(21,a.r,a.g,a.b);n.setXYZ(22,a.r,a.g,a.b);n.setXYZ(23,a.r,a.g,a.b);n.setXYZ(24,b.r,b.g,b.b);n.setXYZ(25,b.r,b.g,b.b);n.setXYZ(26,b.r,b.g,b.b);n.setXYZ(27,b.r,b.g,b.b);n.setXYZ(28,b.r,b.g,b.b);n.setXYZ(29,b.r,b.g,b.b);n.setXYZ(30,b.r,b.g,b.b);n.setXYZ(31,b.r,b.g,b.b);n.setXYZ(32,e.r,e.g,e.b);n.setXYZ(33,e.r,e.g,e.b);
n.setXYZ(34,e.r,e.g,e.b);n.setXYZ(35,e.r,e.g,e.b);n.setXYZ(36,e.r,e.g,e.b);n.setXYZ(37,e.r,e.g,e.b);n.setXYZ(38,f.r,f.g,f.b);n.setXYZ(39,f.r,f.g,f.b);n.setXYZ(40,h.r,h.g,h.b);n.setXYZ(41,h.r,h.g,h.b);n.setXYZ(42,h.r,h.g,h.b);n.setXYZ(43,h.r,h.g,h.b);n.setXYZ(44,h.r,h.g,h.b);n.setXYZ(45,h.r,h.g,h.b);n.setXYZ(46,h.r,h.g,h.b);n.setXYZ(47,h.r,h.g,h.b);n.setXYZ(48,h.r,h.g,h.b);n.setXYZ(49,h.r,h.g,h.b);n.needsUpdate=!0}update(){const a=this.geometry,b=this.pointMap;Xd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);
Yd("c",b,a,Xd,0,0,-1);Yd("t",b,a,Xd,0,0,1);Yd("n1",b,a,Xd,-1,-1,-1);Yd("n2",b,a,Xd,1,-1,-1);Yd("n3",b,a,Xd,-1,1,-1);Yd("n4",b,a,Xd,1,1,-1);Yd("f1",b,a,Xd,-1,-1,1);Yd("f2",b,a,Xd,1,-1,1);Yd("f3",b,a,Xd,-1,1,1);Yd("f4",b,a,Xd,1,1,1);Yd("u1",b,a,Xd,.7,1.1,-1);Yd("u2",b,a,Xd,-.7,1.1,-1);Yd("u3",b,a,Xd,0,2,-1);Yd("cf1",b,a,Xd,-1,0,1);Yd("cf2",b,a,Xd,1,0,1);Yd("cf3",b,a,Xd,0,-1,1);Yd("cf4",b,a,Xd,0,1,1);Yd("cn1",b,a,Xd,-1,0,-1);Yd("cn2",b,a,Xd,1,0,-1);Yd("cn3",b,a,Xd,0,-1,-1);Yd("cn4",b,a,Xd,0,1,-1);a.getAttribute("position").needsUpdate=
!0}dispose(){this.geometry.dispose();this.material.dispose()}}const Om=new qf;class bA extends Vf{constructor(a,b=16776960){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),f=new Float32Array(24),h=new md;h.setIndex(new Hd(e,1));h.setAttribute("position",new Hd(f,3));super(h,new mf({color:b,toneMapped:!1}));this.object=a;this.type="BoxHelper";this.matrixAutoUpdate=!1;this.update()}update(a){void 0!==a&&console.warn("THREE.BoxHelper: .update() has no longer arguments.");void 0!==
this.object&&Om.setFromObject(this.object);if(!Om.isEmpty()){a=Om.min;var b=Om.max,e=this.geometry.attributes.position,f=e.array;f[0]=b.x;f[1]=b.y;f[2]=b.z;f[3]=a.x;f[4]=b.y;f[5]=b.z;f[6]=a.x;f[7]=a.y;f[8]=b.z;f[9]=b.x;f[10]=a.y;f[11]=b.z;f[12]=b.x;f[13]=b.y;f[14]=a.z;f[15]=a.x;f[16]=b.y;f[17]=a.z;f[18]=a.x;f[19]=a.y;f[20]=a.z;f[21]=b.x;f[22]=a.y;f[23]=a.z;e.needsUpdate=!0;this.geometry.computeBoundingSphere()}}setFromObject(a){this.object=a;this.update();return this}copy(a,b){super.copy(a,b);this.object=
a.object;return this}dispose(){this.geometry.dispose();this.material.dispose()}}class aA extends Vf{constructor(a,b=16776960){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),f=new md;f.setIndex(new Hd(e,1));f.setAttribute("position",new $b([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3));super(f,new mf({color:b,toneMapped:!1}));this.box=a;this.type="Box3Helper";this.geometry.computeBoundingSphere()}updateMatrixWorld(a){const b=this.box;b.isEmpty()||(b.getCenter(this.position),
b.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(a))}dispose(){this.geometry.dispose();this.material.dispose()}}class yA extends cg{constructor(a,b=1,e=16776960){const f=new md;f.setAttribute("position",new $b([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3));f.computeBoundingSphere();super(f,new mf({color:e,toneMapped:!1}));this.type="PlaneHelper";this.plane=a;this.size=b;a=new md;a.setAttribute("position",new $b([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],
3));a.computeBoundingSphere();this.add(new Bd(a,new Qd({color:e,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(a){this.position.set(0,0,0);this.scale.set(.5*this.size,.5*this.size,1);this.lookAt(this.plane.normal);this.translateZ(-this.plane.constant);super.updateMatrixWorld(a)}dispose(){this.geometry.dispose();this.material.dispose();this.children[0].geometry.dispose();this.children[0].material.dispose()}}const Jx=new mb;let Pm,Lq;class Vz extends Cd{constructor(a=new mb(0,
0,1),b=new mb(0,0,0),e=1,f=16776960,h=.2*e,n=.2*h){super();this.type="ArrowHelper";void 0===Pm&&(Pm=new md,Pm.setAttribute("position",new $b([0,0,0,0,1,0],3)),Lq=new pk(0,.5,1,5,1),Lq.translate(0,-.5,0));this.position.copy(b);this.line=new cg(Pm,new mf({color:f,toneMapped:!1}));this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new Bd(Lq,new Qd({color:f,toneMapped:!1}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(e,h,n)}setDirection(a){.99999<a.y?
this.quaternion.set(0,0,0,1):-.99999>a.y?this.quaternion.set(1,0,0,0):(Jx.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(Jx,Math.acos(a.y)))}setLength(a,b=.2*a,e=.2*b){this.line.scale.set(1,Math.max(1E-4,a-b),1);this.line.updateMatrix();this.cone.scale.set(e,b,e);this.cone.position.y=a;this.cone.updateMatrix()}setColor(a){this.line.material.color.set(a);this.cone.material.color.set(a)}copy(a){super.copy(a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this}dispose(){this.line.geometry.dispose();
this.line.material.dispose();this.cone.geometry.dispose();this.cone.material.dispose()}}class Zz extends Vf{constructor(a=1){var b=[0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a];a=new md;a.setAttribute("position",new $b(b,3));a.setAttribute("color",new $b([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));b=new mf({vertexColors:!0,toneMapped:!1});super(a,b);this.type="AxesHelper"}setColors(a,b,e){const f=new Tb,h=this.geometry.attributes.color.array;f.set(a);f.toArray(h,0);f.toArray(h,3);f.set(b);f.toArray(h,6);
f.toArray(h,9);f.set(e);f.toArray(h,12);f.toArray(h,15);this.geometry.attributes.color.needsUpdate=!0;return this}dispose(){this.geometry.dispose();this.material.dispose()}}class CA{constructor(){this.type="ShapePath";this.color=new Tb;this.subPaths=[];this.currentPath=null}moveTo(a,b){this.currentPath=new sk;this.subPaths.push(this.currentPath);this.currentPath.moveTo(a,b);return this}lineTo(a,b){this.currentPath.lineTo(a,b);return this}quadraticCurveTo(a,b,e,f){this.currentPath.quadraticCurveTo(a,
b,e,f);return this}bezierCurveTo(a,b,e,f,h,n){this.currentPath.bezierCurveTo(a,b,e,f,h,n);return this}splineThru(a){this.currentPath.splineThru(a);return this}toShapes(a){function b(cb){const db=[];for(let bb=0,gb=cb.length;bb<gb;bb++){const kb=cb[bb],qb=new ej;qb.curves=kb.curves;db.push(qb)}return db}function e(cb,db){const bb=db.length;let gb=!1;for(let qb=bb-1,ob=0;ob<bb;qb=ob++){var kb=db[qb];let pb=db[ob],ub=pb.x-kb.x,rb=pb.y-kb.y;if(Math.abs(rb)>Number.EPSILON){if(0>rb&&(kb=db[ob],ub=-ub,pb=
db[qb],rb=-rb),!(cb.y<kb.y||cb.y>pb.y))if(cb.y===kb.y){if(cb.x===kb.x)return!0}else{kb=rb*(cb.x-kb.x)-ub*(cb.y-kb.y);if(0===kb)return!0;0>kb||(gb=!gb)}}else if(cb.y===kb.y&&(pb.x<=cb.x&&cb.x<=kb.x||kb.x<=cb.x&&cb.x<=pb.x))return!0}return gb}var f=og.isClockWise,h=this.subPaths;if(0===h.length)return[];const n=[];if(1===h.length){var r=h[0];var t=new ej;t.curves=r.curves;n.push(t);return n}var w=!f(h[0].getPoints());w=a?!w:w;t=[];const x=[];let y=[];var z=0;let ab;x[z]=void 0;y[z]=[];for(let cb=0,
db=h.length;cb<db;cb++){r=h[cb];ab=r.getPoints();var eb=f(ab);(eb=a?!eb:eb)?(!w&&x[z]&&z++,x[z]={s:new ej,p:ab},x[z].s.curves=r.curves,w&&z++,y[z]=[]):y[z].push({h:r,p:ab[0]})}if(!x[0])return b(h);if(1<x.length){r=!1;a=0;for(let cb=0,db=x.length;cb<db;cb++)t[cb]=[];for(let cb=0,db=x.length;cb<db;cb++)for(f=y[cb],h=0;h<f.length;h++){eb=f[h];w=!0;for(z=0;z<x.length;z++)e(eb.p,x[z].p)&&(cb!==z&&a++,w?(w=!1,t[z].push(eb)):r=!0);w&&t[cb].push(eb)}0<a&&!1===r&&(y=t)}for(let cb=0,db=x.length;cb<db;cb++){t=
x[cb].s;n.push(t);r=y[cb];for(let bb=0,gb=r.length;bb<gb;bb++)t.holes.push(r[bb].h)}return n}}class NA extends Qf{constructor(a=1,b=1,e=1,f={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.');super(a,b,Object.assign({},f,{count:e}));this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",
{detail:{revision:"163"}}));"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="163");class Qm{constructor(){this.ba=this.value=0;this.Lj=-1;this.unit="px"}ql(a,b,e){let f=0;a.hasOwnProperty("value")&&(f=a.value,a.hasOwnProperty("unit")||(a.unit="px"),"px"==a.unit||"%"==a.unit)&&(this.unit!=a.unit&&(this.value="%"==a.unit?this.value/e*100:this.value*e/100),this.unit=a.unit);b&&b.hasOwnProperty("duration")&&0<b.duration||
(this.value=f);this.Lj=f}Kh(a,b=-1){-1==b&&(b=this.value);this.ba="%"==this.unit?.01*b*a:b}lk(a,b){-1!=this.Lj&&(this.Lj==this.value?this.Kh(b):(this.Kh(b,this.value+(this.Lj-this.value)*a),1<=a&&(this.value=this.Lj)))}}class Gk{constructor(){this.fov=this.u=this.pan=0}}class LB{constructor(){this.mq=-1E7;this.Nr=!1}}const Kx={hB:a=>a,XA:a=>a*a,aB:a=>a*(2-a),UA:a=>.5>a?2*a*a:-1+(4-2*a)*a,TA:a=>a*a*a,$A:a=>--a*a*a+1,yq:a=>.5>a?4*a*a*a:(a-1)*(2*a-2)*(2*a-2)+1,YA:a=>a*a*a*a,bB:a=>1- --a*a*a*a,VA:a=>
.5>a?8*a*a*a*a:1-8*--a*a*a*a,ZA:a=>a*a*a*a*a,cB:a=>1+--a*a*a*a*a,WA:a=>.5>a?16*a*a*a*a*a:1+16*--a*a*a*a*a};class nf{wn(){return""}cw(){return this.ed}Oy(a){0<a&&(this.ed=a)}Zf(){return lg&&gd}Yh(a){if(""!=a)try{let b;b="object"===typeof a?a:JSON.parse(a);if("object"===typeof b)for(const e in b)if("translations"==e&&this.Ta.hasOwnProperty("translations")){let f=b[e];for(const h in f)if(this.Ta.translations.hasOwnProperty(h))for(a=0;a<f[h].length-1;a++)""!=f[h][a]&&(this.Ta.translations[h][a]=f[h][a]);
else this.Ta.translations[h]=f[h]}else this.Ta[e]=b[e];this.Ta.hasOwnProperty("projectLanguage")&&(this.ej=this.Ta.projectLanguage);this.G("languagechanged",{language:this.ii})}catch(b){console.error(b)}}Ma(a,b){let e=a;if(""!=e&&"object"===typeof this.Ta&&this.Ta.hasOwnProperty("languages")&&this.Ta.hasOwnProperty("translations")){var f=this.Ta.languages.indexOf(this.ii);-1!=f&&this.Ta.translations.hasOwnProperty(a)&&(a=this.Ta.translations[a],Array.isArray(a)&&a.length>f&&""!=a[f]&&(e=a[f]))}if(b&&
0<b.length)for(f=b.length-1;0<=f;f--)e=e.replace(new RegExp("%"+String(f+1),"g"),b[f]);return e}No(a){this.Qn=!0;a=a.replace("_","-");if("object"===typeof this.Ta&&this.Ta.hasOwnProperty("languages")&&this.Ta.hasOwnProperty("translations")&&this.ej!=a){let b=-1,e=-1,f="",h=-1,n=-1,r=a.substring(0,2).toUpperCase();for(let t=0;t<this.Ta.languages.length;t++)if(this.Ta.languages[t].toUpperCase()==a.toUpperCase()){b=t;break}else if(!this.ej.toUpperCase().startsWith(r)&&this.Ta.languages[t].toUpperCase().startsWith(r)){if(""==
f||-1!=f.indexOf("-"))e=t,f=this.Ta.languages[t]}else{let w=window.navigator.languages;for(let x=0;x<w.length;x++)!this.ej.toUpperCase().startsWith(r)&&this.Ta.languages[t].toUpperCase().startsWith(w[x].substring(0,2).toUpperCase())&&(-1==n||x<n)&&(h=t,n=x)}a=-1!=b?b:-1!=e?e:h;a=-1!=a?this.Ta.languages[a]:this.ej}this.ii!=a&&(this.ii=a,this.T.setAttribute("lang",a),this.G("languagechanged",{language:a}))}ow(){return this.ii}Gw(){return this.to}addListener(a,b){(this.ni[a]=this.ni[a]||[]).push(b)}G(a,
b){if(a=this.ni[a]){let e=a.length;for(let f=0;f<e;f++)try{a[f].apply(null,[b])}catch(h){this.Rb(h)}}}removeEventListener(a,b){let e=this.ni[a];if(e){var f;var h=0;for(f=e.length;h<f;h++)if(e[h]===b){1===f?delete this.ni[a]:e.splice(h,1);break}}}Gy(){this.Oa=!0}av(a,b,e,f){if(!this.mc.hasOwnProperty(a)){let h=new LB;this.mc[a]=h;h.type=b;"undefined"!==typeof e&&this.tf(a,e);"object"===typeof f&&this.ut(a,f);return!0}return!1}static jn(a){let b=document.cookie.indexOf(a+"="),e="";-1!=b&&(b=b+a.length+
1,a=document.cookie.indexOf(";",b),-1==a&&(a=document.cookie.length),e=decodeURIComponent(document.cookie.substring(b,a)));return e}static mz(a,b){0==a.type?a.value="string"===typeof b?b:b.toString():1==a.type?a.value="string"===typeof b?parseFloat(b):"number"===typeof b?b:b?1:0:2==a.type&&(a.value="string"===typeof b?"false"!==b&&""!==b&&"0"!==b:"number"===typeof b?0!=b:!!b)}ut(a,b){if(this.mc.hasOwnProperty(a)&&"object"===typeof b){let f=this.mc[a];b.hasOwnProperty("cookiePath")&&(f.nq=String(b.cookiePath));
b.hasOwnProperty("cookieExpireDays")&&(f.mq=parseFloat(b.cookieExpireDays));if(b.hasOwnProperty("keep")&&(f.Xr=!!b.keep,f.Xr&&0<document.cookie.length))if(""!=this.ug){if(-1!=document.cookie.indexOf(this.ug+"="))try{var e=JSON.parse(nf.jn(this.ug));e.hasOwnProperty(a)&&this.tf(a,e[a])}catch(h){}}else e="ggvar_"+a,-1!=document.cookie.indexOf(e+"=")&&(e=nf.jn(e),this.tf(a,e));b.hasOwnProperty("ignoreInState")&&(f.Nr=b.ignoreInState);b.hasOwnProperty("customProperty")&&"object"===typeof b.customProperty&&
(b=b.customProperty,this.Ga.hasOwnProperty(a)?(this.Ga[a].variabletype!=b.variableType||this.Ga[a].propertytype!=b.propertyType)&&this.Rb("Custom property added as variable has s different type than custom property from project.",this.Ga[a].propertytype,b.propertyType):this.Ga[a]={ce:b.variableType,gj:b.propertyType,Wm:b.defaultValue});return!0}return!1}gz(a,b){this.ug=a;b&&"object"===typeof b&&(b.hasOwnProperty("cookiePath")&&(this.Ot=String(b.cookiePath)),b.hasOwnProperty("cookieExpireDays")&&(this.Nt=
parseFloat(b.cookieExpireDays)))}static Tp(a,b,e){-1<=b&&(a+="; max-age="+86400*b);""!=e&&(a+="; path="+e);return a}static Wq(a,b){switch(b){case 0:return a;case 1:return a.toString();case 2:return a?"true":"false"}}static kn(a,b){switch(b){case 0:return a;case 1:return Number(a);case 2:return"true"==a}}yr(a,b){""==a&&(a="node1");return this.Ag.hasOwnProperty(a)&&this.Ag[a].hasOwnProperty(b)?this.Bk(nf.kn(this.Ag[a][b],this.Ga[b].ce),this.Ga[b].ce):null}rt(a,b,e){e="string"===typeof e?e:nf.Wq(e,this.Ga[b].ce);
this.Ag[a][b]!=e&&(this.Ag[a][b]=e,this.G("varchanged_"+b,{}))}Tf(a,b,e){""==a&&(a="node1");return this.sb.hasOwnProperty(a)&&this.sb[a].hasOwnProperty(b)&&this.sb[a][b].hasOwnProperty(e)?this.Bk(nf.kn(this.sb[a][b][e],this.Ga[e].ce),this.Ga[e].ce):this.Ga.hasOwnProperty(e)?this.Bk(nf.kn(this.Ga[e].Wm,this.Ga[e].ce),this.Ga[e].ce):null}mj(a,b,e,f){""==a&&(a="node1");f="string"===typeof f?f:nf.Wq(f,this.Ga[e].ce);this.sb.hasOwnProperty(a)||(this.sb[a]={});this.sb[a].hasOwnProperty(b)||(this.sb[a][b]=
{});this.sb[a][b].hasOwnProperty(e)&&this.sb[a][b][e]==f||(this.sb[a][b][e]=f,this.G("varchanged_"+e,{}))}fw(a){return this.Ga.hasOwnProperty(a)?this.Ga[a].Wm:null}Bd(){return"object"}tf(a,b,e=!0){if(void 0===b)return!1;let f=!1;this.Ga.hasOwnProperty(a)&&(0==this.Ga[a].gj?(this.rt(this.Bd(),a,b),f=!0):1==this.Ga[a].gj&&this.N&&(this.mj(this.Bd(),this.N.id,a,b),f=!0));if(this.mc.hasOwnProperty(a)){let h=this.mc[a];if(h.value!=b){nf.mz(h,b);if(h.Xr&&e){if(""!=this.ug){let n;try{n=JSON.parse(nf.jn(this.ug))}catch(r){n=
{}}n[a]=encodeURIComponent(b.toString());e=this.ug+"="+JSON.stringify(n);e=nf.Tp(e,this.Nt,this.Ot)}else e="ggvar_"+a+"="+encodeURIComponent(b.toString()),e=nf.Tp(e,h.mq,h.nq?h.nq:"");document.cookie=e}f||this.G("varchanged_"+a,{value:b})}return!0}return!1}Bk(a,b){return 0==b?this.Ma(a):a}vn(a,b=""){if(this.Ga.hasOwnProperty(a)){if(0==this.Ga[a].gj)return this.yr(this.Bd(),a);if(1==this.Ga[a].gj){if(""!=b||this.N&&this.N!=this.Xa)return this.Tf(this.Bd(),""!=b?b:this.N.id,a);switch(this.Ga[a].ce){case 0:return"";
case 1:return 0;case 2:return!1}}}if(this.mc.hasOwnProperty(a))return this.Bk(this.mc[a].value,this.mc[a].type)}yi(a,b){return this.mc.hasOwnProperty(a)?this.mc[a].value:b}static ji(a){let b="";let e,f,h,n=0;a=a.replace(/[^A-Za-z0-9+\/=]/g,"");do{var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(n++));var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(n++));f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(n++));
h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(n++));r=r<<2|t>>4;t=(t&15)<<4|f>>2;e=(f&3)<<6|h;b+=String.fromCharCode(r);64!=f&&(b+=String.fromCharCode(t));64!=h&&(b+=String.fromCharCode(e))}while(n<a.length);return b}static Lz(a){const b=[1,1,1,1,2,2,3,0],e=a.length;let f="";for(let h=0;h<e;){let n=a.charCodeAt(h++);if(n&128){let r=b[n>>3&7];if(!(n&64&&r)||h+r>e)return null;for(n&=63>>r;0<r;--r){let t=a.charCodeAt(h++);if(128!=(t&192))return null;n=n<<6|t&
63}}f+=String.fromCharCode(n)}return f}static uq(a){return nf.Lz(nf.ji(a))}constructor(){this.Gp="aHR0cHM6Ly9nZ25vbWUuY29t";this.Hp="Q3JlYXRlZCBieSBHbm9tZXM=";this.Ax="TGljZW5zZTogSmltIE1pY2hhZWw=";this.Nh=!0;this.H={width:10,height:10};this.crossOrigin="anonymous";this.ed=1;this.Ta={};this.ej=this.ii="";this.to=[];this.Qn=!1;this.Te=this.me=!0;this.Rk=0;this.control=this.ya=this.T=this.ja=null;this.wd=[];this.Oa=this.vc=!1;this.Pe=1;this.ca=null;this.se=!1;this.$i=0;this.fg={pan:-1,u:-1,fov:-1};this.la=null;this.zg=
{};this.Af={};this.Ag={};this.sb={};this.Ga={};this.P={mode:1,count:0,Rn:-1,Ja:0,ob:0,Md:.05,qc:255,pc:1,oc:255,nc:.3,af:!0,Kl:{enabled:!0,width:180,height:20,Ll:0,Jl:1,background:!0,oc:16777215,nc:1,qc:0,pc:1,xm:3,ak:1,Sj:!0},lc:[],bd:[],Hd:[],Cl:[]};this.te=null;this.L=[];this.Xa={};this.Zg=this.Ec=!1;this.wj=-1;this.ga=1;this.container=null;this.ni={};this.mc={};this.Ot=this.ug="";this.Nt=-1;this.margin={left:new Qm,top:new Qm,right:new Qm,bottom:new Qm,transition:{}};this.$k=[];this.da={x:0,y:0};
this.Fn=!1;this.Ke="";this.Sv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYBgeACDAAADIAAE3iTbkAAAAAElFTkSuQmCC";this.Yb="";this.sl=this.Jk=this.Hi=this.Sr=this.Ei=this.Tr=this.Pk=this.Mk=this.Uc=this.Ok=this.Nn=this.Kk=this.tl=this.Pb=this.Fi=this.bh=this.Ln=this.Ur=this.Mn=this.Wr=!1;this.cf=[];this.devicePixelRatio=1;this.$n=!1;this.Yk="<<LOG>>";this.qp=!1;this.vw=function(a){return a?this.Gi()&&(a.clientX||a.clientY)?
{x:a.clientX,y:a.clientY}:a.pageX||a.pageY?{x:a.pageX,y:a.pageY}:a.clientX||a.clientY?{x:a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,y:a.clientY+document.body.scrollTop+document.documentElement.scrollTop}:a.touches&&a.touches[0]?{x:a.touches[0].pageX,y:a.touches[0].pageY}:{x:0,y:0}:{x:0,y:0}};this.Uf=function(a){a=this.vw(a);let b=this.Wf();return{x:a.x-b.x,y:a.y-b.y}};this.Az=function(a,b,e){let f=this;var h="<<L>>"+String(f.Yb);h=h.toUpperCase();"U"!=h.charAt(2)&&(f.K.Dk=
!1);if(f.Pd)f.T.removeChild(f.Pd),f.Pd=null;else{f.Pd=document.createElement("div");var n=f.Pd;h="left: "+a+"px;top:\t "+(b+"px;z-index: 32000;");h+="position:relative;";h+="display: table;";h+="color: black;";h+="background-color: white;";h+="border: 1px solid lightgray;";h+="box-shadow: 1px 1px 3px #333;";h+="font-family: Verdana, Arial, Helvetica, sans-serif;";h+="font-size: 9pt;";h+="opacity : 0.95;";n.setAttribute("style",h);n.setAttribute("class","gg_contextmenu");h=document.createElement("style");
a=document.createTextNode(".gg_context_row:hover { background-color: #3399FF }");h.type="text/css";h.styleSheet?h.styleSheet.cssText=a.nodeValue:h.appendChild(a);n.appendChild(h);for(a=0;a<f.$k.length;a++){b=f.$k[a];if(""==b.text)continue;let r=document.createElement("div");h="text-align: left;";h+="margin: 0;";h+="padding: 5px 20px;";h+="vertical-align: left;";r.setAttribute("style",h);r.setAttribute("class","gg_context_row");""!=b.url?(h=document.createElement("a"),h.href=b.url,h.target="_blank",
h.innerHTML=this.Ma(b.text),h.setAttribute("style","color: black; text-decoration: none;"),r.appendChild(h)):(h=document.createElement("span"),h.innerHTML=this.Ma(b.text),h.setAttribute("style","color: black; text-decoration: none;"),r.appendChild(h));n.appendChild(r)}0<f.$k.length&&(0<e.length||!f.K.Dk)&&n.appendChild(document.createElement("hr"));for(h=0;h<e.length;h++)a=e[h],a.hasOwnProperty("hr")?n.appendChild(document.createElement("hr")):(b=document.createElement("div"),b.setAttribute("class",
"gg_context_row"),a.hasOwnProperty("style")&&b.setAttribute("style",a.style),a.hasOwnProperty("onclick")&&(b.onclick=a.onclick),b.innerHTML=a.innerHTML,n.appendChild(b));f.K.Dk||(e=document.createElement("div"),h="text-align: left;margin: 0;padding: 5px 20px;",h+="vertical-align: left;",e.setAttribute("style",h),e.setAttribute("class","gg_context_row"),h=document.createElement("a"),h.href=nf.ji(f.Gp),h.target="_blank",h.innerHTML=nf.ji(f.Hp),7<this.Yk.length&&(h.innerHTML+="<br/>"+nf.uq(f.Yk).replace(/./gm,
function(r){return"&#"+r.charCodeAt(0)+";"})),h.setAttribute("style","color: black; text-decoration: none;"),e.appendChild(h),n.appendChild(e));f.T.insertBefore(f.Pd,f.T.firstChild);n.onclick=function(){f.Pd&&(f.T.removeChild(f.Pd),f.Pd=null)};n.oncontextmenu=n.onclick}};this.To=0;this.hj="";this.Dc=!1;this.wq();this.checkLoaded=this.wd;this.isLoaded=!1}wq(){this.devicePixelRatio=window.devicePixelRatio||1;this.Wr=!!navigator.userAgent.match(/(Windows|Win)/g);this.Mn=!!navigator.userAgent.match(/(Mac|Macintosh|Mac_powerpc)/g)&&
!navigator.userAgent.match(/(like Mac)/g);this.Ur=!!navigator.userAgent.match(/(Linux|Ubuntu)/g);this.Ln=!!navigator.userAgent.match(/(MSIE)/g);this.bh=!!navigator.userAgent.match(/(Edge|EdgA|Edg)/g);this.Fi=!!navigator.userAgent.match(/(Firefox)/g);if(this.Pb=!!navigator.userAgent.match(/(Safari)/g)){var a=navigator.userAgent.indexOf("Safari");this.Tb=navigator.userAgent.substring(a+7);a=navigator.userAgent.indexOf("Version");-1!=a&&(this.Tb=navigator.userAgent.substring(a+8));this.Tb=this.Tb.substring(0,
this.Tb.indexOf(" "));this.Tb=this.Tb.substring(0,this.Tb.indexOf("."));this.tl=!0}if(this.Kk=!!navigator.userAgent.match(/(Chrome|CriOS)/g))this.Pb=!1;this.Nn=!!navigator.userAgent.match(/(SamsungBrowser)/g);if(this.Ok=!!navigator.userAgent.match(/(OculusBrowser)/g))this.Pb=this.Kk=this.Nn=!1;this.Uc=!!navigator.userAgent.match(/(iPad|iPhone|iPod)/g);this.Pk=(this.Mk=!!navigator.userAgent.match(/(iPad)/g)||this.Mn&&2<navigator.maxTouchPoints)&&void 0!==navigator.xr&&void 0!==navigator.xr.requestSession;
this.Tr=!!navigator.userAgent.match(/(iPhone|iPod)/g);this.Ei=!!navigator.userAgent.match(/(android)/i);this.Sr=!!navigator.userAgent.match(/(IEMobile)/i);this.Hi=this.Uc||this.Ei||this.Sr||this.Mk;/iP(hone|od|ad)/.test(navigator.platform)&&(a=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),this.cf=[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3]||"0",10)]);this.Jk=!window.requestAnimationFrame;this.Yb="";a=["Webkit","Moz","O","ms","Ms"];for(let b=0;b<a.length;b++)"undefined"!==typeof document.documentElement.style[a[b]+
"Transform"]&&(this.Yb="-"+a[b].toLowerCase()+"-")}qz(){try{window.AudioContext=window.AudioContext||window.webkitAudioContext,this.ha=new AudioContext}catch(a){this.ha=null}this.Pb&&(!this.tl||9>Number(this.Tb))&&(this.ha=null);this.Pb&&!this.Uc&&12<=Number(this.Tb)&&13>Number(this.Tb)&&(this.ha=null);this.Pb&&this.Uc&&13==Number(this.cf[0])&&(1==Number(this.cf[1])||2<=Number(this.cf[1]))&&(this.ha=null)}Rb(a,b,e){let f=document.getElementById("gg_debug");f&&(f.innerHTML=a.toString()+"<br />");window.console&&
(e?window.console.log(a,b,e):b?window.console.log(a,b):window.console.log(a))}setCrossOrigin(a){this.crossOrigin=a}Qy(a){this.bf=a}Dw(){return this.$i}Py(a){this.Ke=a}Uq(){return this.Ke}qn(){return this.Hi}Yq(){return this.Fn}Uy(a){this.Hi=!!a}vi(){return this.isLoaded}ar(){return!this.isLoaded}tj(a,b){try{this.vc&&(a=window.innerWidth,b=window.innerHeight);let h=a-this.margin.left.ba-this.margin.right.ba,n=b-this.margin.top.ba-this.margin.bottom.ba;if(!(10>h||10>n)){this.ja.style.width=h+"px";this.ja.style.height=
n+"px";this.ja.style.left=this.margin.left.ba+"px";this.ja.style.top=this.margin.top.ba+"px";this.ya&&(this.ya.style.width=a+"px",this.ya.style.height=b+"px",this.ca&&this.ca!=this.ya&&(this.ca.style.width=a+"px",this.ca.style.height=b+"px"));this.se&&(this.Oa=!0);var e=this.ja.offsetWidth,f=this.ja.offsetHeight;if(this.H.width!=e||this.H.height!=f)this.H.width=e,this.H.height=f;this.ca&&this.ca.ggUpdateSize&&this.ca.ggUpdateSize(a,b);this.G("sizechanged",{w:a,h:b});this.G("playerstatechanged",{})}}catch(h){}}Fe(){this.qp=
!0}qd(){this.eu();this.tj(this.container.offsetWidth,this.container.offsetHeight)}eu(){this.margin.left.Kh(this.container.offsetWidth);this.margin.top.Kh(this.container.offsetHeight);this.margin.right.Kh(this.container.offsetWidth);this.margin.bottom.Kh(this.container.offsetHeight)}Tw(a=!1){let b={width:0,height:0};b.width=this.H.width+(a?this.margin.left.ba+this.margin.right.ba:0);b.height=this.H.height+(a?this.margin.top.ba+this.margin.bottom.ba:0);b.margins={left:this.margin.left,top:this.margin.top,
right:this.margin.right,bottom:this.margin.bottom};return b}Wf(){let a={x:0,y:0},b=this.ja.getBoundingClientRect();a.x=b.left;a.y=b.top;this.Pb&&14>Number(this.Tb)&&(a.x=b.left+window.scrollX,a.y=b.top+window.scrollY);return a}fz(a){this.la=a}Vy(a,b,e,f){let h=!0;"object"===typeof a?(a.hasOwnProperty("left")&&this.margin.left.ql(a.left,a.transition,this.container.offsetWidth),a.hasOwnProperty("top")&&this.margin.top.ql(a.top,a.transition,this.container.offsetHeight),a.hasOwnProperty("right")&&this.margin.right.ql(a.right,
a.transition,this.container.offsetWidth),a.hasOwnProperty("bottom")&&this.margin.bottom.ql(a.bottom,a.transition,this.container.offsetHeight),a.hasOwnProperty("transition")&&a.transition.hasOwnProperty("duration")&&0<a.transition.duration&&(h=!1,this.margin.transition.duration=a.transition.duration,a.transition.hasOwnProperty("timingfunction")?this.margin.transition.timingfunction=a.transition.timingfunction:this.margin.transition.timingfunction="ease")):(this.margin.left.value=a,this.margin.top.value=
b,this.margin.right.value=e,this.margin.bottom.value=f);this.la=this.skinObj;h?this.qd():(b=0,a.transition.hasOwnProperty("delay")&&(b=a.transition.delay),setTimeout(()=>{this.Yz(this)},b))}Yz(a){a.margin.transition.starttime=(new Date).getTime();a.margin.transition.interval&&clearInterval(a.margin.transition.interval);a.margin.transition.interval=setInterval(()=>{a.Zz(a)},20)}Zz(a){var b=((new Date).getTime()-a.margin.transition.starttime)/a.margin.transition.duration;b=Math.max(b,0);b=Math.min(b,
1);switch(a.margin.transition.timingfunction){case "ease-in":b=1-Math.cos(b*Math.PI/2);break;case "ease-out":b=Math.sin(b*Math.PI/2);break;case "ease":b=-(Math.cos(Math.PI*b)-1)/2;break;case "ease-in-out":b=.5>b?4*b*b*b:1-Math.pow(-2*b+2,3)/2;break;case "step-end":b=1==b?1:0}b=Math.round(100*b)/100;a.margin.left.lk(b,a.container.offsetWidth);a.margin.top.lk(b,a.container.offsetHeight);a.margin.right.lk(b,a.container.offsetWidth);a.margin.bottom.lk(b,a.container.offsetHeight);a.tj(a.container.offsetWidth,
a.container.offsetHeight);1<=b&&(clearInterval(a.margin.transition.interval),a.margin.transition.interval=0)}fq(a){0==a&&(this.K.uc=!1);1==a&&(this.K.uc=!0);2==a&&(this.K.uc=!this.K.uc);this.G("viewmodechanged",{});this.G("playerstatechanged",{})}Ar(){return 1==this.K.uc?1:0}Ri(){this.Oa=!0}eq(a,b){this.P.mode=1==b&&0<this.P.mode?0:Math.round(a);-1==this.P.mode&&(this.P.lc=[]);this.Ri();this.G("polymodechanged",{})}fu(a){let b=this.Wf();this.Gi()?(this.da.x=a.clientX-this.margin.left.ba,this.da.y=
a.clientY-this.margin.top.ba):(this.da.x=a.clientX-b.x,this.da.y=a.clientY-b.y)}gu(a){a=a.touches;let b=this.Wf();this.da.x=a[0].clientX-b.x;this.da.y=a[0].clientY-b.y}oi(a){let b=[];a="*"==a?"^.*$":"#"==a.substring(0,1)?a.substring(1):"^"+a+"$";a=new RegExp(a,"");for(var e=0;e<this.L.length;e++)"poly"==this.L[e].type&&a.test(this.L[e].id)&&b.push(this.L[e]);return b}xt(a){a=this.oi(a);for(let b=0;b<a.length;b++){let e=this.P.lc.indexOf(a[b].id);-1==e?(this.P.lc.push(a[b].id),this.P.bd.push(0),this.P.Hd.push(1)):
this.P.Hd[e]=1}this.Ri()}Kr(a){a=this.oi(a);for(let b=0;b<a.length;b++){let e=this.P.lc.indexOf(a[b].id);-1!=e&&(this.P.Hd[e]=0,this.P.Cl.push(a[b].id),this.update())}this.Ri()}Tz(a){a=this.oi(a);for(let b=0;b<a.length;b++){let e=this.P.lc.indexOf(a[b].id);-1==e||-1!=e&&0==this.P.Hd[e]?this.xt(a[b].id):this.Kr(a[b].id)}this.Ri()}wv(a,b,e,f,h){let n;n=""==a?this.L:this.oi(a);for(let r=0;r<n.length;r++){let t=n[r];"poly"==t.type&&(t.oc=b,t.nc=e,t.qc=f,t.pc=h)}""==a&&(this.P.oc=b,this.P.nc=e,this.P.qc=
f,this.P.pc=h);this.Ri()}Zy(a,b){let e;e=""==a?this.L:this.oi(a);for(let f=0;f<e.length;f++){let h=e[f];"poly"==h.type&&(h.af=b)}""==a&&(this.P.af=b);this.update()}qr(){return this.P.mode}gq(){this.G("viewstatechanged",{})}Br(){return 0}Ws(a,b,e){var f=(new RegExp("%0*"+b,"i")).exec(a.toString());if(f){f=f.toString();let h=e.toString();f.charAt(f.length-1)!=b&&(h=(1+e).toString());if(!isNaN(parseFloat(e)))for(;h.length<f.length-1;)h="0"+h;a=a.replace(f,h)}return a}Rl(){this.G("hotspotsupdated",{})}Vq(){let a=
[];for(let b=0;b<this.L.length;b++){let e=this.L[b];"point"==e.type&&e.obj&&e.obj.__div&&a.push(e.obj.__div)}return a}Ib(a,b){a=Number(a);isNaN(b)&&(b=0);0>b&&(b=0);1<b&&(b=1);return"rgba("+(a>>16&255)+","+(a>>8&255)+","+(a&255)+","+b+")"}static Lr(a,b,e){let f;var h;let n=!1;f=0;for(h=a.length-1;f<a.length;h=f++){let r=a[f];h=a[h];r.jc>e!=h.jc>e&&b<(h.Gc-r.Gc)*(e-r.jc)/(h.jc-r.jc)+r.Gc&&(n=!n)}return n}aspect(){return this.H.width/this.H.height}ke(){}update(a=0){this.Oa=!0;a&&(this.Pe=Math.max(1*
a,this.Pe))}rn(){return!1}$y(a){this.hj=a}getQueryParameter(){return this.hj}Ka(a){if(a){if("{"==a.charAt(0)||"/"==a.charAt(0)||0<a.indexOf(":"))return a;""!=this.hj&&(a=-1==a.indexOf("?")?a+("?"+this.hj):a+("&"+this.hj));return this.Ke+a}return this.Ke}pe(){return 0}mr(){return 0}Zd(){}bi(){}Vf(){return 0}zr(){return 0}$d(){}ci(){}Cd(){return 0}Lb(){return!1}wl(){}ai(){return!1}bq(){}vl(){}setLocked(a){this.mt(a);this.nt(a);this.lt(a)}mt(a){this.K.wc=!!a}lt(a){this.K.Oi=!!a}rw(){return this.K.Oi}nt(a){this.K.gf=
!!a}Cr(){return this.K.Ge}vt(a){this.K.Ge=a}xl(a){this.Dc=!!a}Cw(){return this.Ei?5:this.Pk?7:this.Mk?6:this.Uc?4:this.Wr?1:this.Mn?2:this.Ur?3:0}dw(){return this.Ln?5:this.bh?4:this.Fi?2:this.Pb?3:this.Kk?1:this.Ok?6:0}ew(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?1:0}moveTo(){this.sa(!1)}Vi(){this.sa(!1)}vs(){}ws(){}Kp(){}cu(a,b,e){for(let f=0;f<this.L.length;f++){let h=this.L[f];h.id==a&&(h.pan=b,h.tilt=e,h.Rf())}this.Oa=!0}Us(a){let b=-1,e;for(let f=
0;f<this.L.length;f++)e=this.L[f],e.id==a&&(b=f);-1<b&&(e=this.L.splice(b,1).pop(),e.j&&e.j.__div&&this.ya.removeChild(e.j.__div))}Fw(){let a=[];for(let b=0;b<this.L.length;b++){let e=this.L[b];"point"==e.type&&a.push(String(e.id))}return a}Zq(){}Ih(a,b,e){const f=this.P.Kl,h=this.te;f.enabled&&(this.N!=this.Xa&&0<=a&&0<=b&&""!=this.N.title?(h.innerHTML=this.Ma(this.N.title),h.style.color=this.Ib(f.Ll,f.Jl),h.style.backgroundColor=f.background?this.Ib(f.oc,f.nc):"transparent",h.style.border="solid "+
this.Ib(f.qc,f.pc)+" "+f.ak+"px",h.style.borderRadius=f.xm+"px",h.style.textAlign="center",0<f.width?(h.style.left=a-f.width/2+this.margin.left.ba+"px",h.style.width=f.width+"px"):(h.style.width="auto",h.style.left=a-h.offsetWidth/2+this.margin.left.ba+"px"),h.style.height=0<f.height?f.height+"px":"auto",h.style.top=b+(e?-60:25)+this.margin.top.ba+"px",h.style.visibility="inherit",h.style.whiteSpace=f.Sj?"pre-wrap":"nowrap",h.style.overflow="hidden"):(h.style.visibility="hidden",h.innerHTML=""))}Wt(a){this.la&&
this.la.hotspotProxyClick&&this.la.hotspotProxyClick(a.id,a.url);this.G("hsproxyclick",{id:this.N.id,url:this.N.url});""!=a.url&&this.il(a.url,a.target);this.Ih(-1,-1,!1)}Xt(a){this.la&&this.la.hotspotProxyDoubleClick&&this.la.hotspotProxyDoubleClick(a.id,a.url);this.G("hsproxydblclick",{id:this.N.id,url:this.N.url})}sa(){this.cg=(new Date).getTime()}pw(){return this.cg}Gi(){return document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement&&null!=document.msFullscreenElement||
document.fullScreen}On(){}am(){let a,b=document.createElement("fakeelement"),e={OTransition:"oTransitionEnd",MSTransition:"msTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd",transition:"transitionEnd"};for(a in e)if(void 0!==b.style[a])return e[a]}gr(){return null}fr(){return null}isPlaying(){return!1}Yd(){}no(){}Ns(){}ih(){}Ip(){}Bj(){}Ct(){return 0}Et(){}Dt(){}setVolume(){}hq(){}Al(){}Tx(a){this.Al(a,1)}dA(a){this.Al(a,0)}Sz(a){this.Al(a,-1)}Ew(){return this.Ec}jw(){return this.Zg}ix(){this.Vp=
document.createElement("audio");this.Vp.src=this.Ka("media/testsound.mp3")}Gt(){let a=this;this.ha&&"suspended"===this.ha.state&&this.ha.resume();let b=a.Vp.play();void 0!==b&&b.then(()=>{a.vh(!0)}).catch(()=>{a.vh(!1)})}Ht(){this.Zg&&1!=this.wj?this.Gt():this.me=this.Te=!1}Iw(){return this.wj}vh(a){if(1!=this.wj){let b=a?1:0;this.wj!=b&&(this.wj=b,this.G("soundspermittedchanged",{permitted:a}))}}It(){}zl(){}Wo(){}Eo(){}pn(){return!0}wh(){}lj(a){let b=this.vc!==a;this.vc!==a&&(this.vc=a,this.update(100));
if(this.vc){if(this.Nh)try{this.T.webkitRequestFullScreen?this.T.webkitRequestFullScreen():this.T.mozRequestFullScreen?this.T.mozRequestFullScreen():this.T.msRequestFullscreen?this.T.msRequestFullscreen():this.T.requestFullScreen?this.T.requestFullScreen():this.T.requestFullscreen&&this.T.requestFullscreen()}catch(e){}this.T.style.position="absolute";a=this.Wf();this.T.style.left=window.pageXOffset-a.x+this.margin.left.ba+"px";this.T.style.top=window.pageYOffset-a.y+this.margin.top.ba+"px";this.wh(10);
document.body.style.overflow="hidden";b&&(this.ca&&this.ca.ggEnterFullscreen&&this.ca.ggEnterFullscreen(),this.G("fullscreenenter",{}),this.G("playerstatechanged",{}))}else{if(this.Nh)try{document.webkitIsFullScreen?document.webkitCancelFullScreen():document.mozFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.fullScreen&&(document.cancelFullScreen?document.cancelFullScreen():document.exitFullscreen&&document.exitFullscreen())}catch(e){}this.T.style.position=
"relative";this.T.style.left="0px";this.T.style.top="0px";this.wh(0);document.body.style.overflow="";b&&(this.ca&&this.ca.ggExitFullscreen&&this.ca.ggExitFullscreen(),this.G("fullscreenexit",{}),this.G("playerstatechanged",{}))}this.Fe()}Nl(){this.lj(!this.vc)}Tv(){this.lj(!0)}exitFullscreen(){this.lj(!1)}mw(){return this.vc}Yi(){this.vc&&(this.Gi()||this.exitFullscreen(),this.Gi()&&(this.T.style.left="0px",this.T.style.top="0px"))}df(){return!1}$g(){return!1}tt(){return!1}Ak(){return!1}Jt(){}Mt(){}Rt(){}Ls(){this.sa(!1)}Zs(){}gt(){}it(){}Om(){}vr(){let a=
1,b=-1!=navigator.userAgent.indexOf("Mac");window.devicePixelRatio&&b&&(a=window.devicePixelRatio);return{w:screen.width*a,h:screen.height*a}}er(){let a=this.vr();return a.w>a.h?a.w:a.h}Bq(a){try{let b=a.getAttributeNode("variablename"),e=b.nodeValue.toString();b=a.getAttributeNode("variabletype");let f=Number(b.nodeValue);b=a.getAttributeNode("propertytype");let h=Number(b.nodeValue);b=a.getAttributeNode("defaultvalue");let n;b&&(n=b.nodeValue.toString());this.Ga[e]={ce:f,gj:h,Wm:n}}catch(b){console.error(b)}}Eq(a){let b=
{},e=a.firstChild;for(;e;){if("custompropertyvalue"==e.nodeName){a=e.getAttributeNode("value");let f=a.nodeValue.toString();a=e.getAttributeNode("variablename");b[a.nodeValue.toString()]=f}e=e.nextSibling}return b}an(a,b){let e,f="";(e=b.getAttributeNode("id"))&&(f=e.nodeValue.toString());if(!this.sb.hasOwnProperty(a)||!this.sb[a].hasOwnProperty(f)){var h={};for(b=b.firstChild;b;){if("custompropertyvalue"==b.nodeName){e=b.getAttributeNode("variablename");let n=e.nodeValue;e=b.getAttributeNode("value");
h[n]=e.nodeValue}b=b.nextSibling}this.sb[a]||(this.sb[a]={});this.sb[a][f]=h}}xo(a,b){a=(new DOMParser).parseFromString(a,"text/xml");this.yo(a,b)}Rs(a,b,e){try{let f;f=new XMLHttpRequest;f.open("GET",a,!1);f.send(null);if(f.responseXML){let h=a.lastIndexOf("/");0<=h&&(this.Ke=a.slice(0,h+1));2<=arguments.length&&null!=b&&(this.Ke=b);this.xo(f.responseText,e)}else alert("Error loading panorama XML")}catch(f){alert("Error:"+f)}}Dy(a,b,e,f){let h;h=new XMLHttpRequest;let n=this;const r=arguments;h.onload=
function(){if(4<=h.readyState)if(h.responseXML){let t=a.lastIndexOf("/");0<=t&&(n.Ke=a.slice(0,t+1));3<=r.length&&null!=e&&(n.Ke=e);n.xo(h.responseText,f);b&&b()}else alert("Error loading panorama XML");else console.error("Wrong state loading XML:"+h.statusText)};h.onerror=function(){console.error("Error loading XML:"+h.statusText)};h.open("GET",a,!0);h.send(null)}yo(){}il(a,b){0<a.length&&".xml"!=a.slice(-4)&&".swf"!=a.slice(-4)&&"{"!=a.charAt(0)&&window.open(this.Ka(a),b)}xq(){this.$n=!0}nr(){return{}}qt(){return!0}}
class MB{constructor(a){this.yh=new Gk;this.Og=new Gk;this.lp=this.Pl=null;this.mp=this.offset=0;this.ab=yd.create();this.om=1;this.o=a;this.enabled=!1;this.Mf=1;this.Eg=0;this.type="crossdissolve";this.dd=this.fa=this.od=0;this.em=20;this.cm=90;this.dm=20;this.Sh=1;this.Rh=!1;this.ep=this.cp=this.Yo=0;this.Cj=70;this.uu=0;this.Nb=this.tu=1;this.Qh=this.Ph=.5;this.he=this.Je=!1;this.Sm=1}Di(){let a=this.o.O,b=a.createShader(a.VERTEX_SHADER);a.shaderSource(b,"attribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec2 vTextureCoord;\nuniform bool uZoomIn;\nuniform float uZoomFactor;\nuniform vec2 uZoomCenter;\nvoid main(void) {\n\t gl_Position = vec4(aVertexPosition, 1.0);\n\t if(!uZoomIn) {\n\t \n\t   vTextureCoord = aTextureCoord;\n\t }\n\t else {\n\t   vTextureCoord = (aTextureCoord - vec2(0.5, 0.5)) * (1.0/uZoomFactor) + uZoomCenter;\n\t }\n}\n");
a.compileShader(b);a.getShaderParameter(b,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(b)),b=null);var e=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\nuniform float uAlpha;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n gl_FragColor = vec4(textureColor.x, textureColor.y, textureColor.z, uAlpha);\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.xa=a.createProgram();a.attachShader(this.xa,b);a.attachShader(this.xa,e);a.linkProgram(this.xa);a.getProgramParameter(this.xa,a.LINK_STATUS)||alert("Could not initialise shaders");this.xa.ma=a.getAttribLocation(this.xa,"aVertexPosition");a.enableVertexAttribArray(this.xa.ma);this.xa.Ia=a.getAttribLocation(this.xa,"aTextureCoord");a.enableVertexAttribArray(this.xa.Ia);e=a.createShader(a.FRAGMENT_SHADER);
a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\nuniform float uColorPercent;\nuniform float uAlpha;\nuniform vec3 uDipColor;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n gl_FragColor = vec4(textureColor.x * (1.0 - uColorPercent) + uDipColor.x * uColorPercent, textureColor.y * (1.0 - uColorPercent) + uDipColor.y * uColorPercent, textureColor.z * (1.0 - uColorPercent) + uDipColor.z * uColorPercent, uAlpha);\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.mb=a.createProgram();a.attachShader(this.mb,b);a.attachShader(this.mb,e);a.linkProgram(this.mb);a.getProgramParameter(this.mb,a.LINK_STATUS)||alert("Could not initialise shaders");this.mb.ma=a.getAttribLocation(this.mb,"aVertexPosition");a.enableVertexAttribArray(this.mb.ma);this.mb.Ia=a.getAttribLocation(this.mb,"aTextureCoord");a.enableVertexAttribArray(this.mb.Ia);e=a.createShader(a.FRAGMENT_SHADER);
a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\nuniform bool uRound;\nuniform float uRadius;\nuniform vec2 uRectDim;\nuniform vec2 uIrisCenter;\nuniform float uSoftEdge;\nuniform sampler2D uSampler;\nvoid main(void) {\n float alpha = 0.0;\n vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n if (uRound) {\n\t  vec2 diff = uIrisCenter - gl_FragCoord.xy;\n\t   float distFromCenter = sqrt( (diff.x * diff.x) + (diff.y * diff.y) );\n\t   if (distFromCenter > uRadius) {\n      alpha = 1.0;\n    } else {\n      alpha = 1.0 - ((uRadius - distFromCenter) / uSoftEdge);\n    };\n }\n else {\n    float alphaFromLeft = 1.0 - ((gl_FragCoord.x -(uIrisCenter.x - uRectDim.x)) / uSoftEdge);\n    float alphaFromRight = 1.0 - (((uIrisCenter.x + uRectDim.x) - gl_FragCoord.x) / uSoftEdge);\n    float alphaFromTop = 1.0 - ((gl_FragCoord.y -(uIrisCenter.y - uRectDim.y)) / uSoftEdge);\n    float alphaFromBottom = 1.0 - (((uIrisCenter.y + uRectDim.y) - gl_FragCoord.y) / uSoftEdge);\n    alpha = max(max(alphaFromLeft, alphaFromRight), max(alphaFromTop, alphaFromBottom));\n }\n gl_FragColor = vec4(textureColor.x, textureColor.y, textureColor.z, alpha);\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.Va=a.createProgram();a.attachShader(this.Va,b);a.attachShader(this.Va,e);a.linkProgram(this.Va);a.getProgramParameter(this.Va,a.LINK_STATUS)||alert("Could not initialise shaders");this.Va.ma=a.getAttribLocation(this.Va,"aVertexPosition");a.enableVertexAttribArray(this.Va.ma);this.Va.Ia=a.getAttribLocation(this.Va,"aTextureCoord");a.enableVertexAttribArray(this.Va.Ia);e=a.createShader(a.FRAGMENT_SHADER);
a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\nuniform float uPercent;\nuniform int uDirection;\nuniform vec2 uCanvasDimensions;\nuniform float uSoftEdge;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n float alpha = 0.0;\n if (uDirection == 1) {\n\t if (gl_FragCoord.x > uPercent) {\n    alpha = 1.0; \n  } else {\n    alpha = 1.0 - ((uPercent - gl_FragCoord.x) / uSoftEdge);\n  }\n }\n if (uDirection == 2) {\n\t if (gl_FragCoord.x < uCanvasDimensions.x - uPercent) {\n    alpha = 1.0; \n  } else {\n    alpha = 1.0 - ((gl_FragCoord.x - (uCanvasDimensions.x - uPercent)) / uSoftEdge);\n  }\n }\n if (uDirection == 3) {\n\t if (gl_FragCoord.y < uCanvasDimensions.y - uPercent) {\n    alpha = 1.0; \n  } else {\n    alpha = 1.0 - ((gl_FragCoord.y - (uCanvasDimensions.y - uPercent)) / uSoftEdge);\n  }\n }\n if (uDirection == 4) {\n\t if (gl_FragCoord.y > uPercent) {\n    alpha = 1.0; \n  } else {\n    alpha = 1.0 - ((uPercent - gl_FragCoord.y) / uSoftEdge);\n  }\n }\n gl_FragColor = vec4(textureColor.x, textureColor.y, textureColor.z, alpha);\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.fb=a.createProgram();a.attachShader(this.fb,b);a.attachShader(this.fb,e);a.linkProgram(this.fb);a.getProgramParameter(this.fb,a.LINK_STATUS)||alert("Could not initialise shaders");this.fb.ma=a.getAttribLocation(this.fb,"aVertexPosition");a.enableVertexAttribArray(this.fb.ma);this.fb.Ia=a.getAttribLocation(this.fb,"aTextureCoord");a.enableVertexAttribArray(this.fb.Ia);this.Fv()}Fv(){const a=this.o;
let b=a.O;const e=b.createShader(b.VERTEX_SHADER);a.Sc(e,"precision highp float;\n#define M_PI 3.14159265358979323846\nattribute vec4 aVertexPosition;\nvarying vec2 dst;\nuniform mat4 matRotate; // = mat4( 1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0 );\nuniform mat4 matProject;\nvarying vec3 srcTexDir;\nvarying vec3 dstTexDir;\nuniform float transitionBlend;\nuniform float alphaBlend;\nuniform vec2 rotOffset;\nvoid main(void) {\nfloat srcPan=(aVertexPosition.x) * 2.0 * M_PI;float srcTilt=-(aVertexPosition.y - 0.5) * M_PI; vec3 srcV = vec3(-sin(srcPan) * cos (srcTilt), sin(srcTilt),-cos(srcPan) * cos(srcTilt));float dstPan=(aVertexPosition.z) * 2.0 * M_PI;float dstTilt=-(aVertexPosition.a - 0.5) * M_PI; vec3 dstV = vec3(-sin(dstPan) * cos (dstTilt), sin(dstTilt),-cos(dstPan) * cos(dstTilt));srcTexDir=srcV;srcTexDir.z=-srcV.z;vec3 tmp=srcV;srcV.x= cos(rotOffset.x)*tmp.x - sin(rotOffset.x)*tmp.z;srcV.y= tmp.y;srcV.z= sin(rotOffset.x)*tmp.x + cos(rotOffset.x)*tmp.z;dstTexDir=dstV;dstTexDir.z=-dstV.z;tmp=dstV;dstV.x= cos(rotOffset.y)*tmp.x - sin(rotOffset.y)*tmp.z;dstV.y= tmp.y;dstV.z= sin(rotOffset.y)*tmp.x + cos(rotOffset.y)*tmp.z; gl_Position =   matProject * matRotate *  vec4(mix(srcV, dstV, transitionBlend), 1.0) ;\ngl_Position.y=-gl_Position.y;}\n");
const f=b.createShader(b.FRAGMENT_SHADER);a.Sc(f,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec3 srcTexDir;\nvarying vec3 dstTexDir;\nuniform float transitionBlend;\nuniform samplerCube cubeTexture;uniform samplerCube cubeTexture2;uniform float alphaBlend;\nuniform vec2 irisRamp;\nuniform vec2 uCanvasDimensions;\nvoid main()\n{\nvec4 c1 = textureCube(cubeTexture, srcTexDir);vec4 c2 = textureCube(cubeTexture2, dstTexDir);vec2 fromCenter=(2.0 * vec2(gl_FragCoord.x / uCanvasDimensions.x,gl_FragCoord.y / uCanvasDimensions.y)) - vec2(1.0,1.0);gl_FragColor=mix(c1,c2,clamp(mix((irisRamp.x + 1.0)*transitionBlend - irisRamp.x,(irisRamp.y + 1.0)*transitionBlend - irisRamp.y,length(fromCenter)),0.0, 1.0));gl_FragColor.a=alphaBlend;}\n");
this.Ts=b.createProgram();a.gg(this.Ts,e,f)}bg(){let a=this.o.O;if(!a)return!1;if(this.Ub=a.createFramebuffer()){a.bindFramebuffer(a.FRAMEBUFFER,this.Ub);this.Ub.width=1024;this.Ub.height=1024;this.vg=a.createTexture();a.bindTexture(a.TEXTURE_2D,this.vg);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,this.Ub.width,this.Ub.height,0,a.RGBA,a.UNSIGNED_BYTE,null);let b=a.createRenderbuffer();a.bindRenderbuffer(a.RENDERBUFFER,
b);a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,this.Ub.width,this.Ub.height);a.renderbufferStorage(a.RENDERBUFFER,a.STENCIL_INDEX8,this.Ub.width,this.Ub.height);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.vg,0);a.framebufferRenderbuffer(a.FRAMEBUFFER,a.STENCIL_ATTACHMENT,a.RENDERBUFFER,b);a.bindTexture(a.TEXTURE_2D,null);a.bindRenderbuffer(a.RENDERBUFFER,null);a.bindFramebuffer(a.FRAMEBUFFER,null);this.zb=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.zb);
a.bufferData(a.ARRAY_BUFFER,new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]),a.STATIC_DRAW);this.zb.itemSize=3;this.zb.numberOfItems=4;this.nh=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.nh);a.bufferData(a.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),a.STATIC_DRAW);return!0}return!1}jo(a){let b=this.o.O;var e=this.o.Za;const f=this.o.D;if(this.be){b.useProgram(this.xa);b.bindBuffer(b.ARRAY_BUFFER,this.zb);b.vertexAttribPointer(this.xa.ma,this.zb.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,
this.nh);b.vertexAttribPointer(this.xa.Ia,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(this.xa.ma);b.enableVertexAttribArray(this.xa.Ia);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.vg);e=1+(this.Nb-1)*a;b.uniform1f(b.getUniformLocation(this.xa,"uAlpha"),1);b.uniform1i(b.getUniformLocation(this.xa,"uZoomIn"),1);var h=b.getUniformLocation(this.xa,"uZoomCenter"),n=.5+(this.Ph-.5)*Math.sqrt(a);a=.5+(this.Qh-.5)*Math.sqrt(a);0>n-.5/e&&(n=.5/e);0>a-.5/e&&(a=.5/e);1<n+.5/e&&(n=1-.5/e);1<a+
.5/e&&(a=1-.5/e);b.uniform2f(h,n,a);b.uniform1f(b.getUniformLocation(this.xa,"uZoomFactor"),e);b.uniform1i(b.getUniformLocation(this.xa,"uSampler"),0);b.drawArrays(b.TRIANGLE_STRIP,0,this.zb.numberOfItems);b.useProgram(f.hh.R)}else{this.o.Mj();b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.SRC_ALPHA,b.ONE);b.enable(b.BLEND);b.disable(b.DEPTH_TEST);h=.5+(this.Ph-.5);n=.5+(this.Qh-.5);0>h-.5/this.Nb&&(h=.5/this.Nb);0>n-.5/this.Nb&&(n=.5/this.Nb);1<h+.5/this.Nb&&(h=1-.5/this.Nb);1<n+.5/this.Nb&&
(n=1-.5/this.Nb);b.enableVertexAttribArray(this.xa.ma);b.enableVertexAttribArray(this.xa.Ia);if("crossdissolve"==this.type)b.useProgram(this.xa),b.bindBuffer(b.ARRAY_BUFFER,this.zb),b.vertexAttribPointer(this.xa.ma,this.zb.itemSize,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,this.nh),b.vertexAttribPointer(this.xa.Ia,2,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,this.vg),b.uniform1f(b.getUniformLocation(this.xa,"uAlpha"),1-a),b.uniform1i(b.getUniformLocation(this.xa,"uZoomIn"),
1==this.fa||2==this.fa||6==this.fa||7==this.fa?1:0),b.uniform2f(b.getUniformLocation(this.xa,"uZoomCenter"),h,n),b.uniform1f(b.getUniformLocation(this.xa,"uZoomFactor"),this.Nb),b.uniform1i(b.getUniformLocation(this.xa,"uSampler"),0);else if("diptocolor"==this.type)b.useProgram(this.mb),b.bindBuffer(b.ARRAY_BUFFER,this.zb),b.vertexAttribPointer(this.mb.ma,this.zb.itemSize,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,this.nh),b.vertexAttribPointer(this.mb.Ia,2,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),
b.bindTexture(b.TEXTURE_2D,this.vg),b.uniform1f(b.getUniformLocation(this.mb,"uColorPercent"),Math.min(2*a,1)),b.uniform1f(b.getUniformLocation(this.mb,"uAlpha"),1-Math.max(2*(a-.5),0)),b.uniform3f(b.getUniformLocation(this.mb,"uDipColor"),(this.Eg>>16&255)/255,(this.Eg>>8&255)/255,(this.Eg&255)/255),b.uniform1i(b.getUniformLocation(this.mb,"uZoomIn"),1==this.fa||2==this.fa||6==this.fa||7==this.fa?1:0),b.uniform2f(b.getUniformLocation(this.mb,"uZoomCenter"),h,n),b.uniform1f(b.getUniformLocation(this.mb,
"uZoomFactor"),this.Nb),b.uniform1i(b.getUniformLocation(this.mb,"uSampler"),0);else if("irisround"==this.type||"irisroundcenter"==this.type||"irisrectangular"==this.type||"irisrectangularcenter"==this.type){b.useProgram(this.Va);b.bindBuffer(b.ARRAY_BUFFER,this.zb);b.vertexAttribPointer(this.Va.ma,this.zb.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.nh);b.vertexAttribPointer(this.Va.Ia,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.vg);let w,x;1==this.fa||
2==this.fa||6==this.fa||7==this.fa||"irisroundcenter"==this.type||"irisrectangularcenter"==this.type?x=w=.5:(w=this.Ph,x=this.Qh);var r=w*e.width,t=x*e.height;r=Math.max(r,e.width-r);t=Math.max(t,e.height-t);"irisround"==this.type||"irisroundcenter"==this.type?b.uniform1f(b.getUniformLocation(this.Va,"uRadius"),(Math.sqrt(r*r+t*t)+this.od)*a):(r>t?(t=e.height/e.width*r+this.od,r+=this.od):(r=e.width/e.height*t+this.od,t+=this.od),b.uniform2f(b.getUniformLocation(this.Va,"uRectDim"),r*a,t*a));b.uniform1f(b.getUniformLocation(this.Va,
"uSoftEdge"),this.od);b.uniform1i(b.getUniformLocation(this.Va,"uRound"),"irisround"==this.type||"irisroundcenter"==this.type?1:0);b.uniform2f(b.getUniformLocation(this.Va,"uIrisCenter"),w*e.width,x*e.height);b.uniform1i(b.getUniformLocation(this.Va,"uZoomIn"),1==this.fa||2==this.fa||6==this.fa||7==this.fa?1:0);b.uniform2f(b.getUniformLocation(this.Va,"uZoomCenter"),h,n);b.uniform1f(b.getUniformLocation(this.Va,"uZoomFactor"),this.Nb);b.uniform1i(b.getUniformLocation(this.Va,"uSampler"),0)}else if("wipeleftright"==
this.type||"wiperightleft"==this.type||"wipetopbottom"==this.type||"wipebottomtop"==this.type||"wiperandom"==this.type)b.useProgram(this.fb),b.bindBuffer(b.ARRAY_BUFFER,this.zb),b.vertexAttribPointer(this.fb.ma,this.zb.itemSize,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,this.nh),b.vertexAttribPointer(this.fb.Ia,2,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,this.vg),b.uniform1f(b.getUniformLocation(this.fb,"uPercent"),3>this.Sm?a*(e.width+this.od):a*(e.height+this.od)),
b.uniform1f(b.getUniformLocation(this.fb,"uSoftEdge"),this.od),b.uniform1i(b.getUniformLocation(this.fb,"uDirection"),this.Sm),b.uniform2f(b.getUniformLocation(this.fb,"uCanvasDimensions"),e.width,e.height),b.uniform1i(b.getUniformLocation(this.fb,"uZoomIn"),1==this.fa||2==this.fa||6==this.fa||7==this.fa?1:0),b.uniform2f(b.getUniformLocation(this.fb,"uZoomCenter"),h,n),b.uniform1f(b.getUniformLocation(this.fb,"uZoomFactor"),this.Nb),b.uniform1i(b.getUniformLocation(this.fb,"uSampler"),0);b.drawArrays(b.TRIANGLE_STRIP,
0,this.zb.numberOfItems);b.useProgram(f.hh.R);b.disable(b.BLEND);b.enable(b.DEPTH_TEST)}}wt(){const a=this.o.O;a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR)}oy(a){var b=this.o;const e=b.O,f=b.ea[0];b.ea[0].Pm();b.ea[1].Pm();if(null!=b.ea[0].kb&&null!=b.ea[1].kb){var h=Kx.yq(a);
f.D.pan.m=this.yh.pan*(1-h)+this.Og.pan*h;f.D.u.m=this.yh.u*(1-h)+this.Og.u*h;f.D.fov.m=this.yh.fov*(1-h)+this.Og.fov*h;f.D.ke();h=parseInt(b.yi("__mesh_mb_iter",5));b=parseFloat(b.yi("__mesh_mb_width",.05));1<b&&(b=1);e&&e.clear(e.COLOR_BUFFER_BIT);a=(a-.5)*(1+2*b)+.5-b;for(let n=0;n<h;n++){this.om=0==n?1:.5;let r=a+n/h*b;1<r&&(r=1);0>r&&(r=0);0<=r&&1>=r&&(f.kp=Kx.yq(r),e&&e.clear(e.STENCIL_BUFFER_BIT),this.qy())}}}setup(){const a=this.o;this.Id||this.be||this.pd||a.xl(!0);var b;"wipeleftright"==
this.type?b=1:"wiperightleft"==this.type?b=2:"wipetopbottom"==this.type?b=3:"wipebottomtop"==this.type?b=4:"wiperandom"==this.type&&(b=Math.ceil(4*Math.random()));this.Sm=b;"mesh"!=this.type&&this.Gv();b=new Date;a.N!=a.Xa&&6!=this.fa?7==this.fa?(this.Ph=a.N.Gc/a.H.width,this.Qh=.5):(this.Ph=a.N.Gc/a.H.width,this.Qh=1-a.N.jc/a.H.height):this.Qh=this.Ph=.5;if(1==this.fa||2==this.fa||6==this.fa||7==this.fa)this.uu=b.getTime()+100,this.be=!0,this.Nb=Math.sin(a.Cd()/2*Math.PI/180)/Math.sin(this.em/2*
Math.PI/180),this.Nb=Math.max(this.Nb,1),this.tu=1/this.Sh*this.Nb*.3}Ay(){const a=this.o,b=a.D;this.Mf=parseFloat(a.yi("__trans_blend_time",this.Mf));a.Yt(null);if(0!=this.dd){this.cp=b.pe();this.ep=b.Vf();this.Cj=b.Cd();this.Ce=b.$();if(1==this.dd||3==this.dd)b.Lb(this.dm);else if(2==this.dd)b.Lb(this.cm);else if(4==this.dd){let f=0;for(var e=0;e<a.Aa.length;e++)a.Aa[e].hb&&0==a.Aa[e].hb.indexOf("__FlyIn")&&(f=a.Aa[e]);0!=f?(b.bb(a.vk(3,f).value),b.Zd(a.vk(0,f).value),b.$d(a.vk(1,f).value),b.Lb(a.vk(2,
f).value)):(b.bb(b.jd.vb),b.Zd(b.jd.pan),b.$d(b.jd.u),b.Lb(b.jd.fov))}this.Rh||1==this.fa||2==this.fa||6==this.fa||7==this.fa||a.Xo()}}Gv(){const a=this.o.O,b=this.o;a.bindFramebuffer(a.FRAMEBUFFER,this.Ub);a.viewport(0,0,this.Ub.width,this.Ub.height);this.Jj=!0;b.Mj();this.Jj=!1;a.bindFramebuffer(a.FRAMEBUFFER,null);a.viewport(0,0,b.Za.width,b.Za.height)}rz(a){const b=this.o.O;this.Pl||(this.Pl=b.createBuffer(),this.lp=b.createBuffer());b.bindBuffer(b.ARRAY_BUFFER,this.Pl);let e=[],f=[];const h=
a.pan,n=a.pan-this.offset,r=new Nd,t=new Nd;r.Ve(0,0);t.Ve(0,0);r.kc(a.u);t.kc(a.u);r.ad(h);t.ad(n);e.push(r.Ff()/360);e.push((r.Gf()+90)/180);e.push(t.Ff()/360);e.push((t.Gf()+90)/180);r.Ve(180,0);t.Ve(180,0);r.kc(a.u);t.kc(a.u);r.ad(h);t.ad(n);e.push(r.Ff()/360);e.push((r.Gf()+90)/180);e.push(t.Ff()/360);e.push((t.Gf()+90)/180);for(let w=0;64>w;w++)r.Ve(120,0),r.ye(360*w/64),t.Ve(60,0),t.ye(360*w/64),r.kc(a.u),t.kc(a.u),r.ad(h),t.ad(n),e.push(r.Ff()/360),e.push((r.Gf()+90)/180),e.push(t.Ff()/360),
e.push((t.Gf()+90)/180),f.push(2+w),f.push(2+(w+1)%64),f.push(0),f.push(1),f.push(2+(w+1)%64),f.push(2+w);this.mp=f.length;b.bufferData(b.ARRAY_BUFFER,new Float32Array(e),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.lp);a=new Uint16Array(f);b.bufferData(b.ELEMENT_ARRAY_BUFFER,a,b.STATIC_DRAW)}qy(){const a=this.o,b=a.O;var e=a.D,f=a.ea[0];let h=this.Ts;h&&(b.useProgram(h),b.disable(b.DEPTH_TEST),b.enable(b.STENCIL_TEST),b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.SRC_ALPHA,b.ONE),
b.enable(b.BLEND),b.stencilOp(b.KEEP,b.KEEP,b.INVERT),b.stencilFunc(b.EQUAL,0,1),b.enable(b.CULL_FACE),b.cullFace(b.FRONT),f.Jh(0,h),yd.identity(this.ab),yd.perspective(e.Gb(),a.Za.width/a.Za.height,.001,10,this.ab),b.uniformMatrix4fv(b.getUniformLocation(h,"matProject"),!1,this.ab),b.uniform2f(b.getUniformLocation(h,"uCanvasDimensions"),a.Za.width,a.Za.height),e=b.getUniformLocation(h,"alphaBlend"),b.uniform1f(e,this.om),e=b.getUniformLocation(h,"rotOffset"),b.uniform2f(e,this.offset*Math.PI/180,
0*Math.PI/180),e=b.getUniformLocation(h,"irisRamp"),b.uniform2f(e,parseFloat(a.yi("__mesh_iris_center",0)),parseFloat(a.yi("__mesh_iris_outer",0))),f.Sl(h),f.Jh(0,h),e=b.getUniformLocation(h,"cubeTexture"),b.uniform1i(e,0),e=b.getUniformLocation(h,"cubeTexture2"),b.uniform1i(e,1),f=b.getAttribLocation(h,"aVertexPosition"),b.disableVertexAttribArray(1),b.disableVertexAttribArray(2),b.enableVertexAttribArray(f),b.bindBuffer(b.ARRAY_BUFFER,this.Pl),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.lp),b.vertexAttribPointer(f,
4,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),a.ea[1].kb&&(b.bindTexture(b.TEXTURE_CUBE_MAP,a.ea[1].kb),this.wt()),b.activeTexture(b.TEXTURE1),a.ea[0].kb&&(b.bindTexture(b.TEXTURE_CUBE_MAP,a.ea[0].kb),this.wt()),b.drawElements(b.TRIANGLES,this.mp,b.UNSIGNED_SHORT,0),b.disable(b.STENCIL_TEST))}}class Rm{constructor(a){this.We=this.Pa=!1;this.j=null;this.dc=!0;this.ko=this.Gd=!1;this.Ua=this.Ea=this.za=0;this.fov=70;this.gd=0;this.bj=100;this.ll=0;this.autoplay=this.Yg=this.$f=!1;this.ld="";this.o=
null;this.Dr=!1;this.id=this.Fr="";this.u=this.pan=0;this.o=a;this.kd=this.tc=100;this.Tc=1}Ab(a){let b;(b=a.getAttributeNode("id"))&&b.nodeValue&&(this.id=b.nodeValue.toString());if(b=a.getAttributeNode("pan"))this.pan=Number(b.nodeValue);if(b=a.getAttributeNode("tilt"))this.u=Number(b.nodeValue)}pp(a){var b="";let e=this.o;var f=e.D;let h=!0;if(e.Fi){var n=new Nd(0,0,-100);n.za(-this.u*Math.PI/180);n.Ea(this.pan*Math.PI/180);n.Ea(-f.pan.m*Math.PI/180);n.za(f.u.m*Math.PI/180);n.Ua(f.Y.m*Math.PI/
180);.01<=n.z&&(h=!1)}e.pf&&(b+="perspective("+a+"px) ");b=b+("translate3d(0px,0px,"+a+"px) rotateZ(")+(f.Y.m.toFixed(10)+"deg) ");b+="rotateX("+f.u.m.toFixed(10)+"deg) ";b+="rotateY("+(-f.pan.m).toFixed(10)+"deg) ";b+="rotateY("+this.pan.toFixed(10)+"deg) ";b+="rotateX("+(-this.u).toFixed(10)+"deg) ";a=1E4;f=this.j.videoWidth;n=this.j.videoHeight;if(0==f||0==n)f=640,n=480;0<this.tc&&(f=this.tc);0<this.kd&&(n=this.kd);0<f&&0<n&&(this.j.width=f,this.j.height=n,this.j.style.width=f+"px",this.j.style.height=
n+"px");0<this.fov&&(a=f/(2*Math.tan(this.fov/2*Math.PI/180)));b+="translate3d(0px,0px,"+(-a).toFixed(10)+"px) ";b+="rotateZ("+this.Ua.toFixed(10)+"deg) ";b+="rotateY("+(-this.Ea).toFixed(10)+"deg) ";b+="rotateX("+this.za.toFixed(10)+"deg) ";this.Tc&&1!=this.Tc&&(b+="scaleY("+this.Tc+") ");b+="translate3d("+-f/2+"px,"+-n/2+"px,0px) ";this.j.style[e.Qe+"Origin"]="0% 0%";if(this.Pa){b="";let r;1==this.gd&&(r=Math.min(e.H.width/f,e.H.height/n));4!=this.gd&&(r=r*this.bj/100,b+="scale("+r+") ");b+="translate3d("+
-f/2+"px,"+-n/2+"px,0px) "}this.Fr!=b&&(this.Fr=b,this.j.style[e.Qe]=b,this.j.style.visibility=h&&this.dc&&(!this.$f||this.We||this.Pa)?"visible":"hidden",this.We&&this.Dr==this.Pa&&(this.j.style[e.Pc]="all 0s linear 0s"),this.Dr=this.Pa)}pg(a){this.j&&(this.j.style.visibility=a?"visible":"hidden")}Fe(){let a=this.o;a.qa?(this.j.style.left=a.H.width/2+"px",this.j.style.top=a.H.height/2+"px"):(this.j.style.left=a.margin.left.ba+a.H.width/2+"px",this.j.style.top=a.margin.top.ba+a.H.height/2+"px")}nf(){this.j.parentNode&&
this.j.parentNode.removeChild(this.j);this.j=null}je(){}xe(){return 4==this.gd||1==this.gd}}class wg extends Rm{constructor(a){super(a);this.ua=!1;this.jb=0;this.Kd=this.cn=this.As=this.muted=this.$o=this.stopped=this.Lt=!1;this.Hg=this.Fb=this.Eb=this.Db=this.pb=this.Nd=this.Cb=this.audioBuffer=this.Wb=this.source=null;this.lg=this.Aj=0;this.jh=!1;this.j=null;this.Nj=[];this.oo=this.po=this.Hh=!1;this.url=[];this.loop=0;this.level=1;this.Mc=0;this.mode=1;this.rk=10;this.Gh=this.Jb=0;this.wa=1;this.vd=
this.ud=this.td=this.sd=0;this.jg=-1}He(){var a=this.o;a&&this.j&&(this.Kd=!1,a=a.ha)&&(this.ua||7==this.mode||(this.source=a.createMediaElementSource(this.j)),2==this.mode||3==this.mode||5==this.mode?(this.Nd=a.createChannelSplitter(2),this.pb=a.createGain(),this.Db=a.createGain(),this.Eb=a.createGain(),this.Fb=a.createGain(),this.Hg=a.createChannelMerger(2),this.ua||this.source.connect(this.Nd),this.Nd.connect(this.pb,0),this.Nd.connect(this.Db,0),this.Nd.connect(this.Eb,1),this.Nd.connect(this.Fb,
1),this.pb.connect(this.Hg,0,0),this.Db.connect(this.Hg,0,1),this.Eb.connect(this.Hg,0,0),this.Fb.connect(this.Hg,0,1),this.Hg.connect(a.destination),1==this.jg&&this.ap()):7!=this.mode&&(this.Cb=a.createGain(),this.ua||this.source.connect(this.Cb),this.Cb.connect(a.destination)))}Oo(a){var b;let e=null===(b=this.o)||void 0===b?void 0:b.ha;(-1==a?this.muted:1!=a)?this.muted&&(this.Kd&&this.He(),this.muted=this.j.muted=!1,this instanceof Sm||!this.$o||this.o.Yd(this.id)):(a=!1,this.muted=this.j.muted=
!0,this.o.isPlaying(this.id)?(this.pb?(this.pb.gain.setValueAtTime(0,e.currentTime+1),this.Fb.gain.setValueAtTime(0,e.currentTime+1),this.Db.gain.setValueAtTime(0,e.currentTime+1),this.Eb.gain.setValueAtTime(0,e.currentTime+1)):this.Cb&&this.Cb.gain.setValueAtTime(0,e.currentTime+1),this instanceof Sm||(this.o.ih(this.id),a=!0)):0<=this.loop&&this.autoplay&&!this.stopped&&(a=!0),a&&(this.$o=!0))}Tl(){if(!this.Kd||4==this.mode||6==this.mode){var a=this.o,b=this.o.D,e=this.o.ha;if((this.j||this.ua)&&
!this.muted){var f,h=this.pan-b.pan.m;for(f=this.u-b.u.m;-180>h;)h+=360;for(;180<h;)h-=360;let w=this.Mc;var n=this.rk;0==n&&(n=.01);0>n&&(n=b.fov.m);this.v||(this.v=new Nd,this.v.Ve(this.pan,this.u));0!=this.mode&&1!=this.mode||!e||this.Cb&&this.Cb.gain.setValueAtTime(this.level*a.ga*this.wa,e.currentTime);2==this.mode&&e&&(b=.5*Math.cos(h*Math.PI/180)+.5,this.sd=Math.sqrt(b)*this.wa*this.level*a.ga,this.vd=Math.sqrt(b)*this.wa*this.level*a.ga,this.td=Math.sqrt(1-b)*this.wa*this.level*a.ga,this.ud=
Math.sqrt(1-b)*this.wa*this.level*a.ga,this.oj());if(3==this.mode){h=0>h?h<-this.Jb?h+this.Jb:0:h>this.Jb?h-this.Jb:0;b=this.level;f=Math.abs(f);f=f<this.Gh?0:f-this.Gh;var r=1-f/n;if(Math.abs(h)>n||0>r)r=b*w*a.ga,e?(this.sd=r*this.wa,this.vd=r*this.wa,this.ud=this.td=0,this.oj()):this.j.volume=b*w*a.ga;else{var t=1-Math.abs(h/n);if(e){let x=b*(w+(1-w)*r*t)*a.ga;t=b*w*a.ga;0<=h?(this.sd=x*this.wa,this.vd=t*this.wa):(this.sd=t*this.wa,this.vd=x*this.wa);2*Math.abs(h)<n?(t=1-Math.abs(2*h)/n,x=b*(w+
(1-w)*r*t)*a.ga,t=.5*b*(1-w)*r*(1-t)*a.ga,0<=h?(this.vd=x*this.wa,this.ud=t*this.wa,this.td=0):(this.sd=x*this.wa,this.td=t*this.wa,this.ud=0)):(t=1-(Math.abs(2*h)-n)/n,x=.5*b*(1-w)*r*t*a.ga,0<=h?(this.ud=x*this.wa,this.td=0):(this.td=x*this.wa,this.ud=0));this.oj()}else this.j.volume=b*(w+(1-w)*r*t)*a.ga}}4==this.mode&&(Math.abs(h)<this.Jb&&Math.abs(f)<this.Gh?this.Hh||(this.Hh=!0,this.jb=this.loop-1,a.me||(this.j.play(),this.Kd&&this.He())):this.Hh=!1);5==this.mode&&(f=180*Math.acos(a.Rm.pl(this.v))/
Math.PI,f<this.Jb?e?(this.sd=this.level*a.ga*this.wa,this.vd=this.level*a.ga*this.wa,this.ud=this.td=0,this.oj()):this.j.volume=this.level*a.ga:e?(f<this.Jb+n?(h=0>h?h>-this.Jb?0:h+this.Jb:h<this.Jb?0:h-this.Jb,e=1-Math.max(f-this.Jb,0)/n,n=Math.max(1-Math.abs(h)*Math.cos(this.u*Math.PI/180)/n,0),0<h?(this.sd=this.level*(e*(1-this.Mc)+this.Mc)*a.ga*this.wa,this.vd=this.level*(e*n*(1-this.Mc)+this.Mc)*a.ga*this.wa,this.td=0,this.ud=this.level*e*(1-n)*a.ga*this.wa):(this.sd=this.level*(e*n*(1-this.Mc)+
this.Mc)*a.ga*this.wa,this.vd=this.level*(e*(1-this.Mc)+this.Mc)*a.ga*this.wa,this.td=this.level*e*(1-n)*a.ga*this.wa,this.ud=0)):(h=this.level*this.Mc*a.ga,this.sd=h*this.wa,this.vd=h*this.wa,this.ud=this.td=0),this.oj()):(f-=this.Jb,this.j.volume=f<n&&0<n?this.level*(w+(1-w)*(1-Math.abs(f/n)))*a.ga:w*a.ga));6==this.mode&&(f=180*Math.acos(a.Rm.pl(this.v))/Math.PI,Math.abs(f)<this.Jb?this.Hh||(this.Hh=!0,this.jb=this.loop-1,this.ua?this.jh||this.ie():this.j.play()):this.Hh=!1)}}}ie(){let a=this.o.ha,
b=this.lg;this.audioBuffer?(null==this.Wb&&(this.pq(),this.Wb.buffer=this.audioBuffer),this.Aj=a.currentTime-b,this.lg=0,this.jh=!0,this.stopped=!1,this.Wb.start(0,b)):this.oo=!0}ym(){let a=this.o.ha.currentTime-this.Aj;this.Fg();this.lg=a}Fg(){this.Wb&&this.jh&&(this.stopped=!0,this.Wb.disconnect(),this.Wb.stop(0),this.Wb=null);this.Aj=this.lg=0;this.jh=!1}mv(){let a=this.o.ha;return this.lg?this.lg:this.Aj?a.currentTime-this.Aj:0}nv(a){this.Fg();this.lg=a;this.ie()}addElement(){let a=-1,b=this,
e=this.o,f=this.o.ha;try{var h=!1;for(let n=0;n<e.X.length;n++)e.X[n].id==b.id&&(a=n,null==e.X[n].j&&!e.X[n].ua||e.X[n].url.join()!=b.url.join()||e.X[n].loop!=b.loop||e.X[n].mode!=b.mode||(h=!0,e.X[n].pan=b.pan,e.X[n].u=b.u,e.X[n].level=b.level,e.X[n].Mc=b.Mc,e.X[n].rk=b.rk,e.X[n].Jb=b.Jb,e.X[n].Gh=b.Gh));if(!h){if(0<=a){let n=e.X[a];if(null!=n.j||n.ua)if(f&&e.cb.enabled)e.cb.Kj.push(n),1!=e.F.fa&&2!=e.F.fa&&6!=e.F.fa&&e.cb.Fq(n);else{try{n.ua?n.ym():n.j.pause()}catch(r){}try{n.nf()}catch(r){}}}f&&
(this.Kd=!0);b.j=document.createElement("audio");b.j.crossOrigin=e.crossOrigin;b.j.setAttribute("class","ggmedia");e.bf&&b.j.setAttribute("id",e.bf+b.id);for(h=0;h<b.url.length;h++){let n;n=document.createElement("source");if(""!=b.url[h]&&"#"!=b.url[h]){n.crossOrigin=e.crossOrigin;let r=e.Ka(e.Ma(b.url[h]));n.setAttribute("src",r);b.j.appendChild(n);b.Nj.push(r)}}b.j.volume=b.level*e.ga;if(0<b.j.childNodes.length&&(e.T.appendChild(b.j),b.j.addEventListener("ended",function(){b.Bt()},!1),f&&(b.cn=
!1,0==b.loop&&b.source&&b.source.mediaElement&&(b.source.mediaElement.loop=!0),e.nA))){let n=new XMLHttpRequest;n.open("GET",e.Ka(b.url[0]),!0);n.responseType="arraybuffer";n.onload=function(){let r=n.response;f.decodeAudioData(r,function(t){b.jg=t.numberOfChannels;b.ua=!0;b.He();b.Cy(r);1==b.jg&&b.ap()})};n.send()}1<=b.loop&&(b.jb=b.loop-1);0<=a?e.X[a]=b:e.X.push(b);b.Tl();this.o.Ec||(1!=b.mode&&2!=b.mode&&3!=b.mode&&5!=b.mode||!(0<=b.loop)||f&&e.cb.enabled||(b.ua||(b.j.autoplay=!0,b.np()),b.autoplay=
!0),0==b.mode&&0<=b.loop&&(b.autoplay=!0,b.np()))}}catch(n){}}je(){let a=this.o.isPlaying(this.id),b=0,e=!1;for(let f=0;f<this.j.children.length&&!(this.url.length<=b);f++){let h=this.j.children[f];if("SOURCE"==h.nodeName){let n=this.o.Ka(this.o.Ma(this.url[b]));this.Nj[b]!=n&&(a&&!e&&this.o.ih(this.id),h.setAttribute("src",n),this.Nj[b]=n,e=!0);b++}}e&&(this.j.load(),a&&this.o.Yd(this.id))}nf(){try{this.ua||(this.o.T.removeChild(this.j),this.j=null)}catch(a){}}Ab(a){super.Ab(a);let b;(b=a.getAttributeNode("url"))&&
this.url.push(b.nodeValue.toString());if(b=a.getAttributeNode("level"))this.level=Number(b.nodeValue);if(b=a.getAttributeNode("loop"))this.loop=Number(b.nodeValue);if(b=a.getAttributeNode("mode"))this.mode=Number(b.nodeValue);if(b=a.getAttributeNode("nodechangekeep"))this.As=1==Number(b.nodeValue);if(b=a.getAttributeNode("field"))this.rk=Number(b.nodeValue);if(b=a.getAttributeNode("ambientlevel"))this.Mc=Number(b.nodeValue);if(b=a.getAttributeNode("pansize"))this.Jb=Number(b.nodeValue);if(b=a.getAttributeNode("tiltsize"))this.Gh=
Number(b.nodeValue);for(a=a.firstChild;a;)"source"==a.nodeName&&((b=a.getAttributeNode("url"))&&this.url.push(b.nodeValue.toString()),b=a.getAttributeNode("mono"))&&(this.jg=1==Number(b.nodeValue)?1:2),a=a.nextSibling}np(){let a=this;var b=a.j.play();void 0!==b&&b.then(()=>{a.He()}).catch(()=>{a.j.pause();a.Lt&&(a.j.muted=!0,a.j.play())})}ap(){1!=this.jg||this.Kd||!this.Nd||2!=this.mode&&3!=this.mode&&5!=this.mode||(this.Nd.connect(this.Eb,0),this.Nd.connect(this.Fb,0))}oj(){const a=this.o.ha;this.Pa||
this.po||(this.pb?(this.pb.gain.setValueAtTime(this.sd,a.currentTime),this.Fb.gain.setValueAtTime(this.vd,a.currentTime),this.Db.gain.setValueAtTime(this.td,a.currentTime),this.Eb.gain.setValueAtTime(this.ud,a.currentTime)):this.Cb&&this.Cb.gain.setValueAtTime((this.sd+this.vd)/2,a.currentTime+1))}Bt(){this.ua&&this.stopped?this.stopped=!1:0==this.loop?this.ua?(this.Wb=null,this.ie()):this.j.play():0<this.jb?(this.jb--,this.ua||(this.j.currentTime=0),this.cn&&(this.Cb&&0==this.Cb.gain.value||0==this.pb.gain.value&&
0==this.Fb.gain.value&&0==this.Db.gain.value&&0==this.Eb.gain.value)||(this.ua?(this.Wb=null,this.ie()):this.j.play())):this.ua&&(this.Wb=null,this.jh=!1)}pq(){let a=this;a.Wb=this.o.ha.createBufferSource();a.Wb.addEventListener("ended",function(){a.Bt()},!1);2==a.mode||3==a.mode||5==a.mode?a.Wb.connect(a.Nd):a.Wb.connect(a.Cb)}Cy(a){let b=this,e=this.o.ha;b.pq();e.decodeAudioData(a,function(f){b.jg=f.numberOfChannels;1==b.jg&&b.ap();b.audioBuffer=f;b.Wb.buffer=f;b.oo&&(b.ie(),b.oo=!1)})}}class Sm extends wg{constructor(a){super(a);
this.poster="";this.Ua=this.Ea=this.za=0;this.fov=50;this.gd=0;this.bj=100;this.ll=0;this.Yg=this.$f=!1}Ye(){this.xe()&&this.Xf(!this.Pa);2==this.gd&&this.o.no(this.id)}Xf(a){let b=this.o;var e=b.ha;if(this.xe()){if(this.Pa=a)this.j.style.pointerEvents="auto",this.j.style.cursor="pointer",this.j.style.zIndex=(b.Cg+8E4).toString(),this.j.style[this.o.Pc]="all 1s ease 0s",this.j.muted=!1,this.o.isPlaying(this.id)||b.Yd(this.id);else{this.j.style.pointerEvents="none";this.j.style.cursor="default";this.j.style.zIndex=
b.Cg.toString();this.j.style[this.o.Pc]="all 1s ease 0s";this.o.isPlaying(this.id)&&(0==this.ll?b.Bj(this.id):2==this.ll&&(this.j.muted=!0));this.po=!0;let f=this;setTimeout(function(){f.po=!1},1E3)}if(e&&(2==this.mode||3==this.mode||5==this.mode)&&(e=e.currentTime,this.pb&&this.Fb&&this.Db.gain&&this.Db&&this.Eb)){let f=this.pb.gain.value,h=this.Fb.gain.value,n=this.Db.gain.value,r=this.Eb.gain.value;this.Pa?(this.pb.gain.linearRampToValueAtTime(f,e),this.pb.gain.linearRampToValueAtTime(this.level*
b.ga,e+1),this.Fb.gain.linearRampToValueAtTime(h,e),this.Fb.gain.linearRampToValueAtTime(this.level*b.ga,e+1),this.Db.gain.linearRampToValueAtTime(n,e),this.Db.gain.linearRampToValueAtTime(0,e+1),this.Eb.gain.linearRampToValueAtTime(r,e),this.Eb.gain.linearRampToValueAtTime(0,e+1)):(this.pb.gain.linearRampToValueAtTime(f,e),this.pb.gain.linearRampToValueAtTime(this.sd,e+1),this.Fb.gain.linearRampToValueAtTime(h,e),this.Fb.gain.linearRampToValueAtTime(this.vd,e+1),this.Db.gain.linearRampToValueAtTime(n,
e),this.Db.gain.linearRampToValueAtTime(this.td,e+1),this.Eb.gain.linearRampToValueAtTime(r,e),this.Eb.gain.linearRampToValueAtTime(this.ud,e+1))}this.We=!0;this.o.hu()}2==this.gd&&(a?this.o.Yd(this.id):this.o.ih(this.id))}Ab(a){super.Ab(a);let b;if(b=a.getAttributeNode("poster"))this.poster=String(b.nodeValue);if(b=a.getAttributeNode("maskimage"))this.ld=String(b.nodeValue);if(b=a.getAttributeNode("rotx"))this.za=Number(b.nodeValue);if(b=a.getAttributeNode("roty"))this.Ea=Number(b.nodeValue);if(b=
a.getAttributeNode("rotz"))this.Ua=Number(b.nodeValue);if(b=a.getAttributeNode("fov"))this.fov=Number(b.nodeValue);if(b=a.getAttributeNode("width"))this.tc=Number(b.nodeValue);if(b=a.getAttributeNode("height"))this.kd=Number(b.nodeValue);this.Tc=(b=a.getAttributeNode("stretch"))?Number(b.nodeValue):1;if(b=a.getAttributeNode("clickmode"))this.gd=Number(b.nodeValue);if(b=a.getAttributeNode("popoutscaling"))this.bj=Number(b.nodeValue);if(b=a.getAttributeNode("popbackmode"))this.ll=Number(b.nodeValue);
if(b=a.getAttributeNode("handcursor"))this.Yg=1==Number(b.nodeValue);if(b=a.getAttributeNode("startmutedmobile"))this.Lt=1==Number(b.nodeValue)}addElement(){let a=this,b=this.o,e=this.o.ha;try{a.j=document.createElement("video"),a.j.setAttribute("class","ggmedia"),a.j.setAttribute("disablePictureInPicture","true"),a.j.setAttribute("controlsList","nodownload"),a.j.crossOrigin=b.crossOrigin,a.j.hidden=!0,a.j.addEventListener("click",function(f){f.stopPropagation()}),b.bf&&a.j.setAttribute("id",b.bf+
a.id),b.Pj?(a.j.setAttribute("playsinline","playsinline"),a.j.setAttribute("style","display: none; max-width:none;")):(a.j.setAttribute("style","max-width:none;pointer-events:none;"),a.j.setAttribute("playsinline","playsinline"),this.xe()&&(a.j.addEventListener(b.am(),function(){a.Ze()},!1),a.j.addEventListener("transitionend",function(){a.Ze()},!1))),b.Mp(a.j,a.url,a),""!=a.poster&&(a.j.poster=b.Ka(b.Ma(a.poster)),0>a.loop&&(a.j.preload="none")),a.ld&&""!=a.ld&&(a.j.style.ld="url('"+b.Ka(a.ld)+"')",
a.j.style.webkitMaskImage="url('"+b.Ka(a.ld)+"')",a.j.style.maskSize="100% 100%",a.j.style.webkitMaskSize="100% 100%"),a.j.volume=a.level*b.ga,1<=a.loop&&(a.jb=a.loop-1),e&&(this.Kd=!0),(1==a.mode||2==a.mode||3==a.mode||5==a.mode)&&0<=a.loop&&(a.j.autoplay=!0,a.isRunning=!0,a.autoplay=!0,this.o.Ec&&(a.j.muted=!0),a.np()),b.V.push(this),b.Pj?b.T.appendChild(a.j):(a.j.style.position="absolute",a.tc&&(a.j.width=a.tc),a.kd&&(a.j.height=a.kd),b.ja.appendChild(a.j)),a.j.addEventListener("ended",function(){a.oA()},
!1)}catch(f){}}je(){this.j.poster=this.o.Ka(this.o.Ma(this.poster));super.je()}registerElement(a,b){this.Gd=!0;this.j=b;this.id=a;this.level=1;this.o.V.push(this)}nf(){let a=this.o;a.Pj&&(a.O.deleteTexture(this.texture),this.texture=0);this.j.parentNode&&this.j.parentNode.removeChild(this.j);this.j=null}Ze(){this.We=!1;this.j.style[this.o.Pc]="none"}oA(){0==this.loop?this.j.play():0<this.jb?(this.jb--,this.j.currentTime=0,this.j.play()):this.isRunning=!1}}class NB extends Rm{constructor(a){super(a);
this.url="";this.Ua=this.Ea=this.za=0;this.fov=50;this.gd=0;this.Yg=!1;this.kd=this.tc=100;this.Tc=1}Ab(a){super.Ab(a);let b;if(b=a.getAttributeNode("url"))this.url=b.nodeValue.toString();if(b=a.getAttributeNode("maskimage"))this.ld=String(b.nodeValue);if(b=a.getAttributeNode("rotx"))this.za=Number(b.nodeValue);if(b=a.getAttributeNode("roty"))this.Ea=Number(b.nodeValue);if(b=a.getAttributeNode("rotz"))this.Ua=Number(b.nodeValue);if(b=a.getAttributeNode("fov"))this.fov=Number(b.nodeValue);if(b=a.getAttributeNode("width"))this.tc=
Number(b.nodeValue);if(b=a.getAttributeNode("height"))this.kd=Number(b.nodeValue);this.Tc=(b=a.getAttributeNode("stretch"))?Number(b.nodeValue):1;if(b=a.getAttributeNode("clickmode"))this.gd=Number(b.nodeValue);if(b=a.getAttributeNode("popoutscaling"))this.bj=Number(b.nodeValue);if(b=a.getAttributeNode("hidepinned"))this.$f=1==Number(b.nodeValue);if(b=a.getAttributeNode("handcursor"))this.Yg=1==Number(b.nodeValue);for(a=a.firstChild;a;)"source"==a.nodeName&&(b=a.getAttributeNode("url"))&&(this.url=
b.nodeValue.toString()),a=a.nextSibling}Ye(){this.xe()&&this.Xf(!this.Pa)}Xf(a){let b=this.o;this.xe()&&(this.Pa=a,this.$f&&(this.j.style.visibility="visible",this.j.style.opacity=this.Pa?"0.0":"1.0"),this.Pa?(this.j.style.pointerEvents="auto",this.j.style.cursor="pointer",this.j.style.zIndex=(b.Cg+8E4).toString(),this.j.style[b.Pc]="all 1s ease 0s",this.j.style.opacity="1.0"):(this.j.style.pointerEvents="none",this.j.style.cursor="default",this.j.style.zIndex=b.Cg.toString(),this.j.style[b.Pc]="all 1s ease 0s",
this.$f&&(this.j.style.opacity="0.0")),this.We=!0,b.op())}addElement(){let a=this,b=this.o;try{a.j=document.createElement("img"),a.j.setAttribute("style","-webkit-user-drag:none; max-width:none; pointer-events:none;"),a.j.setAttribute("class","ggmedia"),a.j.hidden=!0,a.j.addEventListener("click",function(e){e.stopPropagation()}),b.bf&&a.j.setAttribute("id",b.bf+a.id),a.j.ondragstart=function(){return!1},this.xe()&&(a.j.addEventListener(b.am(),function(){a.Ze()},!1),a.j.addEventListener("transitionend",
function(){a.Ze()},!1)),a.j.setAttribute("src",b.Ka(b.Ma(a.url))),a.tc&&(a.j.width=a.tc),a.kd&&(a.j.height=a.kd),b.$a.push(a),a.j.style.position="absolute",a.ld&&""!=a.ld&&(a.j.style.ld="url('"+b.Ka(a.ld)+"')",a.j.style.webkitMaskImage="url('"+b.Ka(a.ld)+"')",a.j.style.maskSize="100% 100%",a.j.style.webkitMaskSize="100% 100%"),b.ja.appendChild(a.j)}catch(e){}}je(){this.j.setAttribute("src",this.o.Ka(this.o.Ma(this.url)))}Ze(){this.We=!1;this.j.style[this.o.Pc]="none";this.$f&&!this.Pa&&(this.j.style.visibility=
"hidden")}}class OB extends Rm{constructor(a){super(a);this.code=""}Ab(a){super.Ab(a);let b;if(b=a.getAttributeNode("rotx"))this.za=Number(b.nodeValue);if(b=a.getAttributeNode("roty"))this.Ea=Number(b.nodeValue);if(b=a.getAttributeNode("rotz"))this.Ua=Number(b.nodeValue);if(b=a.getAttributeNode("fov"))this.fov=Number(b.nodeValue);if(b=a.getAttributeNode("width"))this.tc=Number(b.nodeValue);if(b=a.getAttributeNode("height"))this.kd=Number(b.nodeValue);this.Tc=(b=a.getAttributeNode("stretch"))?Number(b.nodeValue):
1;if(b=a.getAttributeNode("clickmode"))this.gd=Number(b.nodeValue);if(b=a.getAttributeNode("popoutscaling"))this.bj=Number(b.nodeValue);if(b=a.getAttributeNode("handcursor"))this.Yg=1==Number(b.nodeValue);if(b=a.getAttributeNode("code"))this.code=b.nodeValue.toString();if(b=a.getAttributeNode("permeable"))this.ko=1==Number(b.nodeValue)}Ye(){this.xe()&&this.Xf(!this.Pa)}Xf(a){let b=this.o;this.xe()&&(this.Pa=a,this.$f&&(this.j.style.visibility="visible",this.j.style.opacity=this.Pa?"0.0":"1.0"),this.Pa?
(this.j.style.cursor="pointer",this.j.style.zIndex=(b.Cg+8E4).toString(),this.j.style[b.Pc]="all 1s ease 0s",this.j.style.opacity="1.0"):(this.j.style.cursor="default",this.j.style.zIndex=b.Cg.toString(),this.j.style[b.Pc]="all 1s ease 0s"),this.We=!0,b.op())}addElement(){let a=this,b=this.o;try{a.j=document.createElement("div");this.$t();let e="max-width:none;";this.ko&&(e+="pointer-events:none;");a.j.setAttribute("style",e);a.j.setAttribute("class","ggmedia");b.bf&&a.j.setAttribute("id",b.bf+a.id);
this.xe()&&(a.j.addEventListener(b.am(),function(){a.Ze()},!1),a.j.addEventListener("transitionend",function(){a.Ze()},!1));b.Vb.push(a);a.j.style.position="absolute";a.j.style.visibility="hidden";0==a.gd?b.ya.insertBefore(a.j,b.ya.firstChild):b.ja.appendChild(a.j)}catch(e){}}$t(){let a=this.j.innerHTML,b=this.o.Ma(this.code);b!=a&&(this.j.innerHTML=b)}je(){this.$t()}Ze(){this.We=!1;this.j.style[this.o.Pc]="none"}}class PB extends Rm{constructor(a){super(a);this.alpha=this.Xp=50;this.type=0;this.color=
16777215}Ab(a){super.Ab(a);let b;if(b=a.getAttributeNode("blinding"))this.Xp=Number(b.nodeValue);if(b=a.getAttributeNode("alpha"))this.alpha=Number(b.nodeValue);if(b=a.getAttributeNode("type"))this.type=Number(b.nodeValue);if(b=a.getAttributeNode("color"))this.color=1*Number(b.nodeValue)}}class Tm{constructor(a){this.o=a;this.type="empty";this.So=this.id=this.target=this.description=this.title=this.url="";this.w=100;this.h=20;this.Sj=!1;this.j=null;this.vo=this.uo=this.jc=this.Gc=this.ob=this.Ja=
this.distance=this.u=this.pan=0;this.visible=!0;this.qc=a.P.qc;this.oc=a.P.oc;this.pc=a.P.pc;this.nc=a.P.nc;this.af=a.P.af;this.yd="";this.Od=this.Of=0;this.wg=!1;this.kk=0;this.vertices=[]}Rf(){this.id=this.id;this.pan=this.pan;this.tilt=this.u;this.url=this.url;this.target=this.target;this.title=this.title;this.distance=this.distance;this.description=this.description;this.skinid=this.So;this.obj=this.j;this.customimage=this.yd;this.customimagewidth=this.Of;this.customimageheight=this.Od;this.use3D=
this.wg;this.distance3D=this.kk;this.j&&this.j.__div&&(this.div=this.j.__div)}Nz(){let a=this.url;return"{"==a.charAt(0)?a.substring(1,a.length-1):!1}Ab(a){var b;(b=a.getAttributeNode("url"))&&b.nodeValue&&(this.url=b.nodeValue.toString());(b=a.getAttributeNode("target"))&&b.nodeValue&&(this.target=b.nodeValue.toString());(b=a.getAttributeNode("title"))&&b.nodeValue&&(this.title=b.nodeValue.toString());(b=a.getAttributeNode("description"))&&b.nodeValue&&(this.description=b.nodeValue.toString());(b=
a.getAttributeNode("id"))&&b.nodeValue&&(this.id=b.nodeValue.toString());(b=a.getAttributeNode("skinid"))&&b.nodeValue&&(this.So=b.nodeValue.toString());if(b=a.getAttributeNode("width"))this.w=Number(b.nodeValue);if(b=a.getAttributeNode("height"))this.h=Number(b.nodeValue);if(b=a.getAttributeNode("wordwrap"))this.Sj=1==Number(b.nodeValue);b=a.getAttributeNode("pan");this.pan=1*(b?Number(b.nodeValue):0);b=a.getAttributeNode("tilt");this.u=1*(b?Number(b.nodeValue):0);b=a.getAttributeNode("fov");this.fov=
1*(b?Number(b.nodeValue):0);b=a.getAttributeNode("distance");this.distance=1*(b?Number(b.nodeValue):0);if(b=a.getAttributeNode("bordercolor"))this.qc=1*Number(b.nodeValue);if(b=a.getAttributeNode("backgroundcolor"))this.oc=1*Number(b.nodeValue);if(b=a.getAttributeNode("borderalpha"))this.pc=1*Number(b.nodeValue);if(b=a.getAttributeNode("backgroundalpha"))this.nc=1*Number(b.nodeValue);if(b=a.getAttributeNode("handcursor"))this.af=1==Number(b.nodeValue);if(b=a.getAttributeNode("customimage"))this.yd=
this.o.Uq()+b.nodeValue;if(b=a.getAttributeNode("customimagewidth"))this.Of=Number(b.nodeValue);if(b=a.getAttributeNode("customimageheight"))this.Od=Number(b.nodeValue);if(b=a.getAttributeNode("use3D"))this.wg=1==Number(b.nodeValue);if(b=a.getAttributeNode("distance3D"))this.kk=Number(b.nodeValue);for(a=a.firstChild;a;){if("polystring"==a.nodeName){var e=a.textContent.toString().split("|");for(b=0;b<e.length;b++){let f=e[b].split("/");if(2==f.length){let h={pan:0,u:0};h.pan=Number(f[0]);h.u=Number(f[1]);
this.vertices.push(h)}}}"vertex"==a.nodeName&&(e={pan:0,u:0},b=a.getAttributeNode("pan"),e.pan=1*(b?Number(b.nodeValue):0),b=a.getAttributeNode("tilt"),e.u=1*(b?Number(b.nodeValue):0),this.vertices.push(e));a=a.nextSibling}this.Rf()}}class QB extends yf{constructor(a){super(a);this.Zn=this.Pn=this.pk=null;this.mg=[];this.register(function(b){return new RB(b)});this.register(function(b){return new SB(b)});this.register(function(b){return new TB(b)});this.register(function(b){return new UB(b)});this.register(function(b){return new VB(b)});
this.register(function(b){return new WB(b)});this.register(function(b){return new XB(b)});this.register(function(b){return new YB(b)});this.register(function(b){return new ZB(b)});this.register(function(b){return new $B(b)});this.register(function(b){return new aC(b)});this.register(function(b){return new bC(b)});this.register(function(b){return new cC(b)});this.register(function(b){return new dC(b)});this.register(function(b){return new eC(b)});this.register(function(b){return new fC(b)})}load(a,
b,e,f){function h(w){f?f(w):console.error(w);n.manager.itemError(a);n.manager.itemEnd(a)}const n=this;let r;if(""!==this.resourcePath)r=this.resourcePath;else if(""!==this.path){var t=Dg.extractUrlBase(a);r=Dg.resolveURL(t,this.path)}else r=Dg.extractUrlBase(a);this.manager.itemStart(a);t=new Tf(this.manager);t.setPath(this.path);t.setResponseType("arraybuffer");t.setRequestHeader(this.requestHeader);t.setWithCredentials(this.withCredentials);t.load(a,function(w){try{n.parse(w,r,function(x){b(x);
n.manager.itemEnd(a)},h)}catch(x){h(x)}},e,h)}register(a){-1===this.mg.indexOf(a)&&this.mg.push(a);return this}unregister(a){-1!==this.mg.indexOf(a)&&this.mg.splice(this.mg.indexOf(a),1);return this}parse(a,b,e,f){const h={},n={};var r=new TextDecoder;if("string"===typeof a)a=JSON.parse(a);else if(a instanceof ArrayBuffer)if("glTF"===r.decode(new Uint8Array(a,0,4))){try{h[Ad.Uj]=new gC(a)}catch(w){f&&f(w);return}a=JSON.parse(h[Ad.Uj].content)}else a=JSON.parse(r.decode(a));if(void 0===a.sm||2>a.sm.version[0])f&&
f(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{b=new hC(a,{path:b||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,Pn:this.Pn,Zn:this.Zn});b.sk.setRequestHeader(this.requestHeader);for(r=0;r<this.mg.length;r++){var t=this.mg[r](b);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name");n[t.name]=t;h[t.name]=!0}if(a.Aq)for(r=0;r<a.Aq.length;++r){t=a.Aq[r];const w=a.Se||[];switch(t){case Ad.Vj:h[t]=
new iC;break;case Ad.Uh:h[t]=new jC(a,this.pk);break;case Ad.Vh:h[t]=new kC;break;case Ad.zp:h[t]=new lC;break;default:0<=w.indexOf(t)&&void 0===n[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}b.Ry(h);b.Yy(n);b.parse(e,f)}}parseAsync(a,b){const e=this;return new Promise(function(f,h){e.parse(a,b,f,h)})}}const Ad={Uj:"KHR_binary_glTF",Uh:"KHR_draco_mesh_compression",Cu:"KHR_lights_punctual",Eu:"KHR_materials_clearcoat",Gu:"KHR_materials_ior",Iu:"KHR_materials_sheen",Ju:"KHR_materials_specular",
Ku:"KHR_materials_transmission",Hu:"KHR_materials_iridescence",Du:"KHR_materials_anisotropy",Vj:"KHR_materials_unlit",Lu:"KHR_materials_volume",Mu:"KHR_texture_basisu",Vh:"KHR_texture_transform",zp:"KHR_mesh_quantization",Fu:"KHR_materials_emissive_strength",xu:"EXT_materials_bump",Bu:"EXT_texture_webp",Au:"EXT_texture_avif",yu:"EXT_meshopt_compression",zu:"EXT_mesh_gpu_instancing"};class dC{constructor(a){this.Z=a;this.name=Ad.Cu;this.cache={oh:{},Ul:{}}}mm(){const a=this.Z,b=this.Z.json.nodes||
[];for(let e=0,f=b.length;e<f;e++){const h=b[e];h.extensions&&h.extensions[this.name]&&void 0!==h.extensions[this.name].light&&a.km(this.cache,h.extensions[this.name].light)}}Ep(a){const b=this.Z,e="light:"+a;var f=b.cache.get(e);if(f)return f;f=b.json;f=((f.extensions&&f.extensions[this.name]||{}).lights||[])[a];var h=new Tb(16777215);void 0!==f.color&&h.setRGB(f.color[0],f.color[1],f.color[2],"srgb-linear");const n=void 0!==f.range?f.range:0;switch(f.type){case "directional":h=new am(h);h.target.position.set(0,
0,-1);h.add(h.target);break;case "point":h=new Kp(h);h.distance=n;break;case "spot":h=new Tp(h);h.distance=n;f.spot=f.spot||{};f.spot.Jn=void 0!==f.spot.Jn?f.spot.Jn:0;f.spot.jl=void 0!==f.spot.jl?f.spot.jl:Math.PI/4;h.angle=f.spot.jl;h.penumbra=1-f.spot.Jn/f.spot.jl;h.target.position.set(0,0,-1);h.add(h.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+f.type);}h.position.set(0,0,0);h.decay=2;Ag(h,f);void 0!==f.intensity&&(h.intensity=f.intensity);h.name=b.fi(f.name||
"light_"+a);f=Promise.resolve(h);b.cache.add(e,f);return f}Ba(a,b){if("light"===a)return this.Ep(b)}qq(a){const b=this,e=this.Z;a=e.json.nodes[a];const f=(a.extensions&&a.extensions[this.name]||{}).light;return void 0===f?null:this.Ep(f).then(function(h){return e.lm(b.cache,f,h)})}}class iC{constructor(){this.name=Ad.Vj}Qc(){return Qd}Uv(a,b,e){const f=[];a.color=new Tb(1,1,1);a.opacity=1;if(b=b.zy){if(Array.isArray(b.um)){const h=b.um;a.color.setRGB(h[0],h[1],h[2],"srgb-linear");a.opacity=h[3]}void 0!==
b.vm&&f.push(e.gb(a,"map",b.vm,"srgb"))}return Promise.all(f)}}class ZB{constructor(a){this.Z=a;this.name=Ad.Fu}zd(a,b){a=this.Z.json.materials[a];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();a=a.extensions[this.name].dB;void 0!==a&&(b.emissiveIntensity=a);return Promise.resolve()}}class RB{constructor(a){this.Z=a;this.name=Ad.Eu}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){var e=this.Z,f=e.json.materials[a];if(!f.extensions||
!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];void 0!==f.zv&&(b.clearcoat=f.zv);void 0!==f.Cv&&a.push(e.gb(b,"clearcoatMap",f.Cv));void 0!==f.Av&&(b.clearcoatRoughness=f.Av);void 0!==f.Bv&&a.push(e.gb(b,"clearcoatRoughnessMap",f.Bv));void 0!==f.Gm&&(a.push(e.gb(b,"clearcoatNormalMap",f.Gm)),void 0!==f.Gm.scale&&(e=f.Gm.scale,b.clearcoatNormalScale=new Lb(e,e)));return Promise.all(a)}}class aC{constructor(a){this.Z=a;this.name=Ad.Hu}Qc(a){a=this.Z.json.materials[a];
return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];void 0!==f.qx&&(b.iridescence=f.qx);void 0!==f.tx&&a.push(e.gb(b,"iridescenceMap",f.tx));void 0!==f.sx&&(b.iridescenceIOR=f.sx);void 0===b.iridescenceThicknessRange&&(b.iridescenceThicknessRange=[100,400]);void 0!==f.iridescenceThicknessMinimum&&(b.iridescenceThicknessRange[0]=f.iridescenceThicknessMinimum);
void 0!==f.iridescenceThicknessMaximum&&(b.iridescenceThicknessRange[1]=f.iridescenceThicknessMaximum);void 0!==f.ux&&a.push(e.gb(b,"iridescenceThicknessMap",f.ux));return Promise.all(a)}}class VB{constructor(a){this.Z=a;this.name=Ad.Iu}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];b.sheenColor=new Tb(0,0,0);b.sheenRoughness=0;b.sheen=1;
f=f.extensions[this.name];if(void 0!==f.vz){const h=f.vz;b.sheenColor.setRGB(h[0],h[1],h[2],"srgb-linear")}void 0!==f.xz&&(b.sheenRoughness=f.xz);void 0!==f.wz&&a.push(e.gb(b,"sheenColorMap",f.wz,"srgb"));void 0!==f.yz&&a.push(e.gb(b,"sheenRoughnessMap",f.yz));return Promise.all(a)}}class WB{constructor(a){this.Z=a;this.name=Ad.Ku}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();
a=[];f=f.extensions[this.name];void 0!==f.aA&&(b.transmission=f.aA);void 0!==f.bA&&a.push(e.gb(b,"transmissionMap",f.bA));return Promise.all(a)}}class XB{constructor(a){this.Z=a;this.name=Ad.Lu}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){var e=this.Z,f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];b.thickness=void 0!==f.Oz?f.Oz:0;void 0!==f.Pz&&a.push(e.gb(b,"thicknessMap",f.Pz));
b.attenuationDistance=f.attenuationDistance||Infinity;e=f.attenuationColor||[1,1,1];b.attenuationColor=(new Tb).setRGB(e[0],e[1],e[2],"srgb-linear");return Promise.all(a)}}class YB{constructor(a){this.Z=a;this.name=Ad.Gu}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){a=this.Z.json.materials[a];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();a=a.extensions[this.name];b.ior=void 0!==a.ior?a.ior:1.5;return Promise.resolve()}}class $B{constructor(a){this.Z=
a;this.name=Ad.Ju}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];b.specularIntensity=void 0!==f.Gz?f.Gz:1;void 0!==f.Hz&&a.push(e.gb(b,"specularIntensityMap",f.Hz));const h=f.kB||[1,1,1];b.specularColor=(new Tb).setRGB(h[0],h[1],h[2],"srgb-linear");void 0!==f.Fz&&a.push(e.gb(b,"specularColorMap",f.Fz,"srgb"));return Promise.all(a)}}
class cC{constructor(a){this.Z=a;this.name=Ad.xu}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];b.bumpScale=void 0!==f.ov?f.ov:1;void 0!==f.pv&&a.push(e.gb(b,"bumpMap",f.pv));return Promise.all(a)}}class bC{constructor(a){this.Z=a;this.name=Ad.Du}Qc(a){a=this.Z.json.materials[a];return a.extensions&&a.extensions[this.name]?
Wf:null}zd(a,b){const e=this.Z;var f=e.json.materials[a];if(!f.extensions||!f.extensions[this.name])return Promise.resolve();a=[];f=f.extensions[this.name];void 0!==f.fv&&(b.anisotropy=f.fv);void 0!==f.anisotropyRotation&&(b.anisotropyRotation=f.anisotropyRotation);void 0!==f.gv&&a.push(e.gb(b,"anisotropyMap",f.gv));return Promise.all(a)}}class SB{constructor(a){this.Z=a;this.name=Ad.Mu}Vd(a){const b=this.Z,e=b.json;var f=e.textures[a];if(!f.extensions||!f.extensions[this.name])return null;f=f.extensions[this.name];
const h=b.options.Pn;if(!h){if(e.Se&&0<=e.Se.indexOf(this.name))throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return b.Wk(a,f.source,h)}}class TB{constructor(a){this.Z=a;this.name=Ad.Bu;this.isSupported=null}Vd(a){const b=this.name,e=this.Z,f=e.json;var h=f.textures[a];if(!h.extensions||!h.extensions[b])return null;const n=h.extensions[b];h=f.images[n.source];let r=e.Gj;h.uri&&(h=e.options.manager.getHandler(h.uri),null!==h&&(r=h));return this.Zm().then(function(t){if(t)return e.Wk(a,
n.source,r);if(f.Se&&0<=f.Se.indexOf(b))throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return e.Vd(a)})}Zm(){this.isSupported||(this.isSupported=new Promise(function(a){const b=new Image;b.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";b.onload=b.onerror=function(){a(1===b.height)}}));return this.isSupported}}class UB{constructor(a){this.Z=a;this.name=Ad.Au;this.isSupported=null}Vd(a){const b=this.name,e=this.Z,f=e.json;var h=f.textures[a];
if(!h.extensions||!h.extensions[b])return null;const n=h.extensions[b];h=f.images[n.source];let r=e.Gj;h.uri&&(h=e.options.manager.getHandler(h.uri),null!==h&&(r=h));return this.Zm().then(function(t){if(t)return e.Wk(a,n.source,r);if(f.Se&&0<=f.Se.indexOf(b))throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return e.Vd(a)})}Zm(){this.isSupported||(this.isSupported=new Promise(function(a){const b=new Image;b.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=";
b.onload=b.onerror=function(){a(1===b.height)}}));return this.isSupported}}class eC{constructor(a){this.name=Ad.yu;this.Z=a}Wn(a){const b=this.Z.json;a=b.Zp[a];if(a.extensions&&a.extensions[this.name]){const e=a.extensions[this.name];a=this.Z.Ba("buffer",e.buffer);const f=this.Z.options.Zn;if(!f||!f.supported){if(b.Se&&0<=b.Se.indexOf(this.name))throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return a.then(function(h){const n=e.count,r=
e.qv,t=new Uint8Array(h,e.byteOffset||0,e.byteLength||0);return f.Nv?f.Nv(n,r,t,e.mode,e.filter).then(function(w){return w.buffer}):f.ready.then(function(){const w=new ArrayBuffer(n*r);f.SA(new Uint8Array(w),n,r,t,e.mode,e.filter);return w})})}return null}}class fC{constructor(a){this.name=Ad.zu;this.Z=a}fk(a){var b=this.Z.json,e=b.nodes[a];if(!e.extensions||!e.extensions[this.name]||void 0===e.mesh)return null;b=b.al[e.mesh];for(var f of b.Qs)if(f.mode!==Nf.TRIANGLES&&f.mode!==Nf.TRIANGLE_STRIP&&
f.mode!==Nf.TRIANGLE_FAN&&void 0!==f.mode)return null;e=e.extensions[this.name].attributes;f=[];const h={};for(const n in e)f.push(this.Z.Ba("accessor",e[n]).then(r=>{h[n]=r;return h[n]}));if(1>f.length)return null;f.push(this.Z.fk(a));return Promise.all(f).then(n=>{const r=n.pop();var t=r.isGroup?r.children:[r];n=n[0].count;const w=[];for(const y of t){var x=new gd;const z=new mb,ab=new rf,eb=new mb(1,1,1);t=new cm(y.geometry,y.material,n);for(let cb=0;cb<n;cb++)h.Su&&z.fromBufferAttribute(h.Su,
cb),h.Ou&&ab.fromBufferAttribute(h.Ou,cb),h.Pu&&eb.fromBufferAttribute(h.Pu,cb),t.setMatrixAt(cb,x.compose(z,ab,eb));for(const cb in h)"_COLOR_0"===cb?(x=h[cb],t.instanceColor=new aj(x.array,x.itemSize,x.normalized)):"TRANSLATION"!==cb&&"ROTATION"!==cb&&"SCALE"!==cb&&y.geometry.setAttribute(cb,h[cb]);Cd.prototype.copy.call(t,y);this.Z.Up(t);w.push(t)}return r.isGroup?(r.clear(),r.add(...w),r):w[0]})}}class gC{constructor(a){this.name=Ad.Uj;this.body=this.content=null;var b=new DataView(a,0,12);const e=
new TextDecoder;this.Hn={Kx:e.decode(new Uint8Array(a.slice(0,4))),version:b.getUint32(4,!0),length:b.getUint32(8,!0)};if("glTF"!==this.Hn.Kx)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(2>this.Hn.version)throw Error("THREE.GLTFLoader: Legacy binary file detected.");b=this.Hn.length-12;const f=new DataView(a,12);let h=0;for(;h<b;){const r=f.getUint32(h,!0);h+=4;var n=f.getUint32(h,!0);h+=4;1313821514===n?(n=new Uint8Array(a,12+h,r),this.content=e.decode(n)):5130562===n&&(n=
12+h,this.body=a.slice(n,n+r));h+=r}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.");}}class jC{constructor(a,b){if(!b)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ad.Uh;this.json=a;this.pk=b;this.pk.preload()}Ov(a,b){const e=this.json,f=this.pk,h=a.extensions[this.name].fd,n=a.extensions[this.name].attributes,r={},t={},w={};for(var x in n)r[rp[x]||x.toLowerCase()]=n[x];for(const y in a.attributes)if(x=rp[y]||y.toLowerCase(),void 0!==
n[y]){const z=e.nm[a.attributes[y]];w[x]=Hj[z.Jg].name;t[x]=!0===z.normalized}return b.Ba("bufferView",h).then(function(y){return new Promise(function(z,ab){f.RA(y,function(eb){for(const cb in eb.attributes){const db=eb.attributes[cb],bb=t[cb];void 0!==bb&&(db.normalized=bb)}z(eb)},r,w,"srgb-linear",ab)})})}}class kC{constructor(){this.name=Ad.Vh}Vv(a,b){if((void 0===b.Dh||b.Dh===a.channel)&&void 0===b.offset&&void 0===b.rotation&&void 0===b.scale)return a;a=a.clone();void 0!==b.Dh&&(a.channel=b.Dh);
void 0!==b.offset&&a.offset.fromArray(b.offset);void 0!==b.rotation&&(a.rotation=b.rotation);void 0!==b.scale&&a.repeat.fromArray(b.scale);a.needsUpdate=!0;return a}}class lC{constructor(){this.name=Ad.zp}}class Lx extends Jj{constructor(a,b,e,f){super(a,b,e,f)}copySampleValue_(a){const b=this.resultBuffer,e=this.sampleValues,f=this.valueSize;a=a*f*3+f;for(let h=0;h!==f;h++)b[h]=e[a+h];return b}interpolate_(a,b,e,f){const h=this.resultBuffer,n=this.sampleValues,r=this.valueSize,t=2*r;var w=3*r;f-=
b;b=(e-b)/f;e=b*b;var x=e*b;a*=w;w=a-w;const y=-2*x+3*e;x-=e;const z=1-y;b=x-e+b;for(e=0;e!==r;e++)h[e]=z*n[w+e+r]+b*n[w+e+t]*f+y*n[a+e+r]+x*n[a+e]*f;return h}}const mC=new rf;class nC extends Lx{interpolate_(a,b,e,f){a=super.interpolate_(a,b,e,f);mC.fromArray(a).normalize().toArray(a);return a}}const Nf={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},Hj={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Mx={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},Nx={33071:1001,33648:1002,10497:1E3},Mq={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rp={Bf:"position",gm:"normal",GA:"tangent",HA:"uv",IA:"uv1",JA:"uv2",KA:"uv3",fm:"color",OA:"skinWeight",CA:"skinIndex"},Mg={scale:"scale",Vt:"position",rotation:"quaternion",weights:"morphTargetInfluences"},
oC={zA:void 0,LINEAR:2301,FA:2300},pC=new gd;class hC{constructor(a={},b={}){this.json=a;this.extensions={};this.plugins={};this.options=b;this.cache=new Iz;this.Ob=new Map;this.By={};this.Xi={};this.qs={oh:{},Ul:{}};this.aq={oh:{},Ul:{}};this.Uo={};this.fp={};this.ao={};b=a=!1;let e=-1;"undefined"!==typeof navigator&&(a=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),e=(b=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1);this.Gj="undefined"===
typeof createImageBitmap||a||b&&98>e?new gj(this.options.manager):new ew(this.options.manager);this.Gj.setCrossOrigin(this.options.crossOrigin);this.Gj.setRequestHeader(this.options.requestHeader);this.sk=new Tf(this.options.manager);this.sk.setResponseType("arraybuffer");"use-credentials"===this.options.crossOrigin&&this.sk.setWithCredentials(!0)}Ry(a){this.extensions=a}Yy(a){this.plugins=a}parse(a,b){const e=this,f=this.json,h=this.extensions;this.cache.Ey();this.Xi={};this.Xh(function(n){return n.mm&&
n.mm()});Promise.all(this.Xh(function(n){return n.kv&&n.kv()})).then(function(){return Promise.all([e.mn("scene"),e.mn("animation"),e.mn("camera")])}).then(function(n){const r={qf:n[0][f.qf||0],ft:n[0],animations:n[1],cameras:n[2],sm:f.sm,Z:e,userData:{}};$g(h,r,f);Ag(r,f);return Promise.all(e.Xh(function(t){return t.cv&&t.cv(r)})).then(function(){for(const t of r.ft)t.updateMatrixWorld();a(r)})}).catch(b)}mm(){const a=this.json.nodes||[];var b=this.json.Cz||[];const e=this.json.al||[];for(let f=
0,h=b.length;f<h;f++){const n=b[f].joints;for(let r=0,t=n.length;r<t;r++)a[n[r]].isBone=!0}for(let f=0,h=a.length;f<h;f++)b=a[f],void 0!==b.mesh&&(this.km(this.qs,b.mesh),void 0!==b.zt&&(e[b.mesh].isSkinnedMesh=!0)),void 0!==b.camera&&this.km(this.aq,b.camera)}km(a,b){void 0!==b&&(void 0===a.oh[b]&&(a.oh[b]=a.Ul[b]=0),a.oh[b]++)}lm(a,b,e){if(1>=a.oh[b])return e;const f=e.clone(),h=(n,r)=>{const t=this.Ob.get(n);null!=t&&this.Ob.set(r,t);for(const [w,x]of n.children.entries())h(x,r.children[w])};h(e,
f);f.name+="_instance_"+a.Ul[b]++;return f}ee(a){const b=Object.values(this.plugins);b.push(this);for(let e=0;e<b.length;e++){const f=a(b[e]);if(f)return f}return null}Xh(a){const b=Object.values(this.plugins);b.unshift(this);const e=[];for(let f=0;f<b.length;f++){const h=a(b[f]);h&&e.push(h)}return e}Ba(a,b){const e=a+":"+b;let f=this.cache.get(e);if(!f){switch(a){case "scene":f=this.Gx(b);break;case "node":f=this.ee(function(h){return h.ls&&h.ls(b)});break;case "mesh":f=this.ee(function(h){return h.ks&&
h.ks(b)});break;case "accessor":f=this.Bx(b);break;case "bufferView":f=this.ee(function(h){return h.Wn&&h.Wn(b)});break;case "buffer":f=this.Cx(b);break;case "material":f=this.ee(function(h){return h.js&&h.js(b)});break;case "texture":f=this.ee(function(h){return h.Vd&&h.Vd(b)});break;case "skin":f=this.Hx(b);break;case "animation":f=this.ee(function(h){return h.hs&&h.hs(b)});break;case "camera":f=this.Dx(b);break;default:if(f=this.ee(function(h){return h!=this&&h.Ba&&h.Ba(a,b)}),!f)throw Error("Unknown type: "+
a);}this.cache.add(e,f)}return f}mn(a){let b=this.cache.get(a);if(!b){const e=this;b=Promise.all((this.json[a+("mesh"===a?"es":"s")]||[]).map(function(f,h){return e.Ba(a,h)}));this.cache.add(a,b)}return b}Cx(a){const b=this.json.buffers[a],e=this.sk;if(b.type&&"arraybuffer"!==b.type)throw Error("THREE.GLTFLoader: "+b.type+" buffer type is not supported.");if(void 0===b.uri&&0===a)return Promise.resolve(this.extensions[Ad.Uj].body);const f=this.options;return new Promise(function(h,n){e.load(Dg.resolveURL(b.uri,
f.path),h,void 0,function(){n(Error('THREE.GLTFLoader: Failed to load buffer "'+b.uri+'".'))})})}Wn(a){const b=this.json.Zp[a];return this.Ba("buffer",b.buffer).then(function(e){const f=b.byteOffset||0;return e.slice(f,f+(b.byteLength||0))})}Bx(a){const b=this,e=this.json,f=this.json.nm[a];if(void 0===f.fd&&void 0===f.Ae){a=Mq[f.type];const h=!0===f.normalized,n=new Hj[f.Jg](f.count*a);return Promise.resolve(new Hd(n,a,h))}a=[];void 0!==f.fd?a.push(this.Ba("bufferView",f.fd)):a.push(null);void 0!==
f.Ae&&(a.push(this.Ba("bufferView",f.Ae.indices.fd)),a.push(this.Ba("bufferView",f.Ae.values.fd)));return Promise.all(a).then(function(h){var n=h[0];const r=Mq[f.type],t=Hj[f.Jg];var w=t.BYTES_PER_ELEMENT,x=f.byteOffset||0,y=void 0!==f.fd?e.Zp[f.fd].qv:void 0;const z=!0===f.normalized;if(y&&y!==w*r){var ab=Math.floor(x/y);const eb="InterleavedBuffer:"+f.fd+":"+f.Jg+":"+ab+":"+f.count;let cb=b.cache.get(eb);cb||(ab=new t(n,ab*y,f.count*y/w),cb=new qk(ab,y/w),b.cache.add(eb,cb));w=new bj(cb,r,x%y/w,
z)}else ab=null===n?new t(f.count*r):new t(n,x,f.count*r),w=new Hd(ab,r,z);if(void 0!==f.Ae){y=f.Ae.values.byteOffset||0;x=new Hj[f.Ae.indices.Jg](h[1],f.Ae.indices.byteOffset||0,f.Ae.count*Mq.DA);h=new t(h[2],y,f.Ae.count*r);null!==n&&(w=new Hd(w.array.slice(),w.itemSize,w.normalized));for(let eb=0,cb=x.length;eb<cb;eb++)if(n=x[eb],w.setX(n,h[eb*r]),2<=r&&w.setY(n,h[eb*r+1]),3<=r&&w.setZ(n,h[eb*r+2]),4<=r&&w.setW(n,h[eb*r+3]),5<=r)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
}return w})}Vd(a){var b=this.json,e=this.options;const f=b.textures[a].source,h=b.images[f];b=this.Gj;h.uri&&(e=e.manager.getHandler(h.uri),null!==e&&(b=e));return this.Wk(a,f,b)}Wk(a,b,e){const f=this,h=this.json,n=h.textures[a],r=h.images[b],t=(r.uri||r.fd)+":"+n.dt;if(this.fp[t])return this.fp[t];b=this.Fx(b,e).then(function(w){w.flipY=!1;w.name=n.name||r.name||"";""===w.name&&"string"===typeof r.uri&&!1===r.uri.startsWith("data:image/")&&(w.name=r.uri);const x=(h.Ny||{})[n.dt]||{};w.magFilter=
Mx[x.magFilter]||1006;w.minFilter=Mx[x.minFilter]||1008;w.wrapS=Nx[x.wrapS]||1E3;w.wrapT=Nx[x.wrapT]||1E3;f.Ob.set(w,{textures:a});return w}).catch(function(){return null});return this.fp[t]=b}Fx(a,b){var e=this.json;const f=this.options;if(void 0!==this.Uo[a])return this.Uo[a].then(w=>w.clone());const h=e.images[a],n=self.URL||self.webkitURL;let r=h.uri||"",t=!1;if(void 0!==h.fd)r=this.Ba("bufferView",h.fd).then(function(w){t=!0;return r=n.createObjectURL(new Blob([w],{type:h.mimeType}))});else if(void 0===
h.uri)throw Error("THREE.GLTFLoader: Image "+a+" is missing URI and bufferView");e=Promise.resolve(r).then(function(w){return new Promise(function(x,y){let z=x;!0===b.isImageBitmapLoader&&(z=function(ab){ab=new Rd(ab);ab.needsUpdate=!0;x(ab)});b.load(Dg.resolveURL(w,f.path),z,void 0,y)})}).then(function(w){!0===t&&n.revokeObjectURL(r);var x=w.userData,y;(y=h.mimeType)||(y=h.uri,y=0<y.search(/\.jpe?g($|\?)/i)||0===y.search(/^data:image\/jpeg/)?"image/jpeg":0<y.search(/\.webp($|\?)/i)||0===y.search(/^data:image\/webp/)?
"image/webp":"image/png");x.mimeType=y;return w}).catch(function(w){console.error("THREE.GLTFLoader: Couldn't load texture",r);throw w;});return this.Uo[a]=e}gb(a,b,e,f){const h=this;return this.Ba("texture",e.index).then(function(n){if(!n)return null;void 0!==e.Dh&&0<e.Dh&&(n=n.clone(),n.channel=e.Dh);if(h.extensions[Ad.Vh]){const r=void 0!==e.extensions?e.extensions[Ad.Vh]:void 0;if(r){const t=h.Ob.get(n);n=h.extensions[Ad.Vh].Vv(n,r);h.Ob.set(n,t)}}void 0!==f&&(n.colorSpace=f);return a[b]=n})}Up(a){var b=
a.geometry;let e=a.material;const f=void 0===b.attributes.tangent,h=void 0!==b.attributes.color;b=void 0===b.attributes.normal;if(a.isPoints){var n="PointsMaterial:"+e.uuid,r=this.cache.get(n);r||(r=new fm,Zd.prototype.copy.call(r,e),r.color.copy(e.color),r.map=e.map,r.sizeAttenuation=!1,this.cache.add(n,r));e=r}else a.isLine&&(n="LineBasicMaterial:"+e.uuid,r=this.cache.get(n),r||(r=new mf,Zd.prototype.copy.call(r,e),r.color.copy(e.color),r.map=e.map,this.cache.add(n,r)),e=r);if(f||h||b)n="ClonedMaterial:"+
e.uuid+":",f&&(n+="derivative-tangents:"),h&&(n+="vertex-colors:"),b&&(n+="flat-shading:"),r=this.cache.get(n),r||(r=e.clone(),h&&(r.vertexColors=!0),b&&(r.flatShading=!0),f&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(n,r),this.Ob.set(r,this.Ob.get(e))),e=r;a.material=e}Qc(){return Gj}js(a){const b=this,e=this.extensions,f=this.json.materials[a];let h;const n={},r=[];if((f.extensions||{})[Ad.Vj]){var t=e[Ad.Vj];h=t.Qc();r.push(t.Uv(n,
f,b))}else{t=f.zy||{};n.color=new Tb(1,1,1);n.opacity=1;if(Array.isArray(t.um)){const w=t.um;n.color.setRGB(w[0],w[1],w[2],"srgb-linear");n.opacity=w[3]}void 0!==t.vm&&r.push(b.gb(n,"map",t.vm,"srgb"));n.metalness=void 0!==t.Mx?t.Mx:1;n.roughness=void 0!==t.My?t.My:1;void 0!==t.rs&&(r.push(b.gb(n,"metalnessMap",t.rs)),r.push(b.gb(n,"roughnessMap",t.rs)));h=this.ee(function(w){return w.Qc&&w.Qc(a)});r.push(Promise.all(this.Xh(function(w){return w.zd&&w.zd(a,n)})))}!0===f.doubleSided&&(n.side=2);t=
f.PA||"OPAQUE";"BLEND"===t?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,"MASK"===t&&(n.alphaTest=void 0!==f.dv?f.dv:.5));void 0!==f.co&&h!==Qd&&(r.push(b.gb(n,"normalMap",f.co)),n.normalScale=new Lb(1,1),void 0!==f.co.scale&&(t=f.co.scale,n.normalScale.set(t,t)));void 0!==f.ho&&h!==Qd&&(r.push(b.gb(n,"aoMap",f.ho)),void 0!==f.ho.Kz&&(n.aoMapIntensity=f.ho.Kz));void 0!==f.Qv&&h!==Qd&&(t=f.Qv,n.emissive=(new Tb).setRGB(t[0],t[1],t[2],"srgb-linear"));void 0!==f.Rv&&h!==Qd&&r.push(b.gb(n,"emissiveMap",
f.Rv,"srgb"));return Promise.all(r).then(function(){const w=new h(n);f.name&&(w.name=f.name);Ag(w,f);b.Ob.set(w,{materials:a});f.extensions&&$g(e,w,f);return w})}fi(a){a=Ed.sanitizeNodeName(a||"");if(a in this.ao)return a+"_"+ ++this.ao[a];this.ao[a]=0;return a}Ex(a){function b(t){return f[Ad.Uh].Ov(t,e).then(function(w){return Mv(w,t,e)})}const e=this,f=this.extensions,h=this.By,n=[];for(let t=0,w=a.length;t<w;t++){const x=a[t],y=Lz(x);var r=h[y];r?n.push(r.promise):(r=x.extensions&&x.extensions[Ad.Uh]?
b(x):Mv(new md,x,e),h[y]={ol:x,promise:r},n.push(r))}return Promise.all(n)}ks(a){const b=this,e=this.extensions,f=this.json.al[a],h=f.Qs,n=[];for(let r=0,t=h.length;r<t;r++){const w=void 0===h[r].material?Jz(this.cache):this.Ba("material",h[r].material);n.push(w)}n.push(b.Ex(h));return Promise.all(n).then(function(r){var t=r.slice(0,r.length-1);const w=r[r.length-1];r=[];for(let z=0,ab=w.length;z<ab;z++){var x=w[z];const eb=h[z];var y=void 0;y=t[z];if(eb.mode===Nf.TRIANGLES||eb.mode===Nf.TRIANGLE_STRIP||
eb.mode===Nf.TRIANGLE_FAN||void 0===eb.mode)y=!0===f.isSkinnedMesh?new Rp(x,y):new Bd(x,y),!0===y.isSkinnedMesh&&y.normalizeSkinWeights(),eb.mode===Nf.TRIANGLE_STRIP?y.geometry=Lv(y.geometry,1):eb.mode===Nf.TRIANGLE_FAN&&(y.geometry=Lv(y.geometry,2));else if(eb.mode===Nf.LINES)y=new Vf(x,y);else if(eb.mode===Nf.LINE_STRIP)y=new cg(x,y);else if(eb.mode===Nf.LINE_LOOP)y=new Gp(x,y);else if(eb.mode===Nf.POINTS)y=new Lp(x,y);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+eb.mode);if(0<
Object.keys(y.geometry.morphAttributes).length){x=y;x.updateMorphTargets();if(void 0!==f.weights)for(let cb=0,db=f.weights.length;cb<db;cb++)x.morphTargetInfluences[cb]=f.weights[cb];if(f.Sg&&Array.isArray(f.Sg.Mz)){const cb=f.Sg.Mz;if(x.morphTargetInfluences.length===cb.length){x.morphTargetDictionary={};for(let db=0,bb=cb.length;db<bb;db++)x.morphTargetDictionary[cb[db]]=db}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}y.name=b.fi(f.name||"mesh_"+a);
Ag(y,f);eb.extensions&&$g(e,y,eb);b.Up(y);r.push(y)}for(let z=0,ab=r.length;z<ab;z++)b.Ob.set(r[z],{al:a,Qs:z});if(1===r.length)return f.extensions&&$g(e,r[0],f),r[0];t=new af;f.extensions&&$g(e,t,f);b.Ob.set(t,{al:a});for(let z=0,ab=r.length;z<ab;z++)t.add(r[z]);return t})}Dx(a){let b;a=this.json.cameras[a];const e=a[a.type];if(e)return"perspective"===a.type?b=new ff(kw.radToDeg(e.mB),e.aspectRatio||1,e.yA||1,e.xA||2E6):"orthographic"===a.type&&(b=new rk(-e.vA,e.vA,e.wA,-e.wA,e.yA,e.xA)),a.name&&
(b.name=this.fi(a.name)),Ag(b,a),Promise.resolve(b);console.warn("THREE.GLTFLoader: Missing camera parameters.")}Hx(a){const b=this.json.Cz[a];a=[];for(let e=0,f=b.joints.length;e<f;e++)a.push(this.Fp(b.joints[e]));void 0!==b.ox?a.push(this.Ba("accessor",b.ox)):a.push(null);return Promise.all(a).then(function(e){const f=e.pop(),h=[],n=[];for(let t=0,w=e.length;t<w;t++){var r=e[t];r?(h.push(r),r=new gd,null!==f&&r.fromArray(f.array,16*t),n.push(r)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',
b.joints[t])}return new gm(h,n)})}hs(a){const b=this,e=this.json.animations[a],f=e.name?e.name:"animation_"+a;a=[];const h=[],n=[],r=[],t=[];for(let x=0,y=e.channels.length;x<y;x++){var w=e.channels[x];const z=e.Ny[w.dt];w=w.target;const ab=void 0!==e.parameters?e.parameters[z.input]:z.input,eb=void 0!==e.parameters?e.parameters[z.output]:z.output;void 0!==w.node&&(a.push(this.Ba("node",w.node)),h.push(this.Ba("accessor",ab)),n.push(this.Ba("accessor",eb)),r.push(z),t.push(w))}return Promise.all([Promise.all(a),
Promise.all(h),Promise.all(n),Promise.all(r),Promise.all(t)]).then(function(x){const y=x[0],z=x[1],ab=x[2],eb=x[3];x=x[4];const cb=[];for(let gb=0,kb=y.length;gb<kb;gb++){var db=y[gb],bb=z[gb];const qb=ab[gb],ob=eb[gb],pb=x[gb];if(void 0!==db&&(db.updateMatrix&&db.updateMatrix(),db=b.Vu(db,bb,qb,ob,pb)))for(bb=0;bb<db.length;bb++)cb.push(db[bb])}return new Ij(f,void 0,cb)})}fk(a){const b=this,e=this.json.nodes[a];return void 0===e.mesh?null:b.Ba("mesh",e.mesh).then(function(f){f=b.lm(b.qs,e.mesh,
f);void 0!==e.weights&&f.traverse(function(h){if(h.isMesh)for(let n=0,r=e.weights.length;n<r;n++)h.morphTargetInfluences[n]=e.weights[n]});return f})}ls(a){var b=this.json.nodes[a];a=this.Fp(a);const e=[],f=b.children||[];for(let h=0,n=f.length;h<n;h++)e.push(this.Ba("node",f[h]));b=void 0===b.zt?Promise.resolve(null):this.Ba("skin",b.zt);return Promise.all([a,Promise.all(e),b]).then(function(h){const n=h[0],r=h[1],t=h[2];null!==t&&n.traverse(function(w){w.isSkinnedMesh&&w.bind(t,pC)});for(let w=
0,x=r.length;w<x;w++)n.add(r[w]);return n})}Fp(a){const b=this.extensions,e=this;if(void 0!==this.Xi[a])return this.Xi[a];const f=this.json.nodes[a],h=f.name?e.fi(f.name):"",n=[],r=e.ee(function(t){return t.fk&&t.fk(a)});r&&n.push(r);void 0!==f.camera&&n.push(e.Ba("camera",f.camera).then(function(t){return e.lm(e.aq,f.camera,t)}));e.Xh(function(t){return t.qq&&t.qq(a)}).forEach(function(t){n.push(t)});this.Xi[a]=Promise.all(n).then(function(t){let w;w=!0===f.isBone?new Yk:1<t.length?new af:1===t.length?
t[0]:new Cd;if(w!==t[0])for(let x=0,y=t.length;x<y;x++)w.add(t[x]);f.name&&(w.userData.name=f.name,w.name=h);Ag(w,f);f.extensions&&$g(b,w,f);void 0!==f.matrix?(t=new gd,t.fromArray(f.matrix),w.applyMatrix4(t)):(void 0!==f.Vt&&w.position.fromArray(f.Vt),void 0!==f.rotation&&w.quaternion.fromArray(f.rotation),void 0!==f.scale&&w.scale.fromArray(f.scale));e.Ob.has(w)||e.Ob.set(w,{});e.Ob.get(w).nodes=a;return w});return this.Xi[a]}Gx(a){var b=this.extensions;a=this.json.ft[a];const e=this,f=new af;a.name&&
(f.name=e.fi(a.name));Ag(f,a);a.extensions&&$g(b,f,a);b=a.nodes||[];a=[];for(let h=0,n=b.length;h<n;h++)a.push(e.Ba("node",b[h]));return Promise.all(a).then(function(h){for(let n=0,r=h.length;n<r;n++)f.add(h[n]);e.Ob=(n=>{const r=new Map;for(const [t,w]of e.Ob)(t instanceof Zd||t instanceof Rd)&&r.set(t,w);n.traverse(t=>{const w=e.Ob.get(t);null!=w&&r.set(t,w)});return r})(f);return f})}Vu(a,b,e,f,h){const n=[];var r=a.name?a.name:a.uuid;const t=[];Mg[h.path]===Mg.weights?a.traverse(function(w){w.morphTargetInfluences&&
t.push(w.name?w.name:w.uuid)}):t.push(r);switch(Mg[h.path]){case Mg.weights:a=Wg;break;case Mg.rotation:a=zg;break;case Mg.position:case Mg.scale:a=Xg;break;default:switch(e.itemSize){case 1:a=Wg;break;default:a=Xg}}r=void 0!==f.interpolation?oC[f.interpolation]:2301;e=this.Xu(e);for(let w=0,x=t.length;w<x;w++){const y=new a(t[w]+"."+Mg[h.path],b.array,e,r);"CUBICSPLINE"===f.interpolation&&this.Wu(y);n.push(y)}return n}Xu(a){let b=a.array;if(a.normalized){a=qp(b.constructor);const e=new Float32Array(b.length);
for(let f=0,h=b.length;f<h;f++)e[f]=b[f]*a;b=e}return b}Wu(a){a.createInterpolant=function(b){return new (this instanceof zg?nC:Lx)(this.times,this.values,this.getValueSize()/3,b)};a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}const Wd={BA:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),de:Object.freeze({Th:"default",hm:"touched",Nu:"pressed"}),Tj:Object.freeze({yp:"button",Tu:"xAxis",Uu:"yAxis",Qu:"state"}),wu:Object.freeze({NA:"trigger",EA:"squeeze",Ru:"touchpad",LA:"thumbstick",
yp:"button"}),vu:.05,xp:.1,Wh:Object.freeze({im:"transform",Cp:"visibility"})},qC={Jc:0,Kc:0,button:0,state:Wd.de.Th};class rC{constructor(a){this.Jm=a.Jm;this.Ah=a.Ah;this.lu=a.lu;this.Rj=a.Rj;this.Rj===Wd.Wh.im&&(this.ts=a.ts,this.os=a.os);this.value=0;this.bu(qC)}bu({Jc:a,Kc:b,button:e,state:f}){const {Wx:h,Xx:n}=Pz(a,b);switch(this.Jm){case Wd.Tj.Tu:this.value=this.Ah.includes(f)?h:.5;break;case Wd.Tj.Uu:this.value=this.Ah.includes(f)?n:.5;break;case Wd.Tj.yp:this.value=this.Ah.includes(f)?e:
0;break;case Wd.Tj.Qu:this.value=this.Rj===Wd.Wh.Cp?this.Ah.includes(f):this.Ah.includes(f)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.Jm}`);}}}class sC{constructor(a,b){if(!(a&&b&&b.Bg&&b.$b)||0===Object.keys(b.$b).length)throw Error("Invalid arguments supplied");this.id=a;this.type=b.type;this.jp=b.jp;this.Bg={};Object.keys(b.Bg).forEach(e=>{const f=new rC(b.Bg[e]);this.Bg[e]=f});this.$b=Object.assign({},b.$b);this.values={state:Wd.de.Th,button:void 0!==this.$b.button?
0:void 0,Jc:void 0!==this.$b.Jc?0:void 0,Kc:void 0!==this.$b.Kc?0:void 0}}get data(){return Object.assign({},{id:this.id},this.values)}Ql(a){this.values.state=Wd.de.Th;if(void 0!==this.$b.button&&a.buttons.length>this.$b.button){const b=a.buttons[this.$b.button];this.values.button=b.value;this.values.button=0>this.values.button?0:this.values.button;this.values.button=1<this.values.button?1:this.values.button;if(b.pressed||1===this.values.button)this.values.state=Wd.de.Nu;else if(b.touched||this.values.button>
Wd.vu)this.values.state=Wd.de.hm}void 0!==this.$b.Jc&&a.axes.length>this.$b.Jc&&(this.values.Jc=a.axes[this.$b.Jc],this.values.Jc=-1>this.values.Jc?-1:this.values.Jc,this.values.Jc=1<this.values.Jc?1:this.values.Jc,this.values.state===Wd.de.Th&&Math.abs(this.values.Jc)>Wd.xp&&(this.values.state=Wd.de.hm));void 0!==this.$b.Kc&&a.axes.length>this.$b.Kc&&(this.values.Kc=a.axes[this.$b.Kc],this.values.Kc=-1>this.values.Kc?-1:this.values.Kc,this.values.Kc=1<this.values.Kc?1:this.values.Kc,this.values.state===
Wd.de.Th&&Math.abs(this.values.Kc)>Wd.xp&&(this.values.state=Wd.de.hm));Object.values(this.Bg).forEach(b=>{b.bu(this.values)})}}class tC{constructor(a,b,e){if(!a)throw Error("No xrInputSource supplied");if(!b)throw Error("No profile supplied");this.bm=a;this.$j=e;this.id=b.ro;this.ds=b.Tn[a.handedness];this.Nf={};Object.keys(this.ds.Nf).forEach(f=>{this.Nf[f]=new sC(f,this.ds.Nf[f])});this.Ql()}get gripSpace(){return this.bm.gripSpace}get targetRaySpace(){return this.bm.targetRaySpace}get data(){const a=
[];Object.values(this.Nf).forEach(b=>{a.push(b.data)});return a}Ql(){Object.values(this.Nf).forEach(a=>{a.Ql(this.bm.gamepad)})}}class uC extends Cd{constructor(){super();this.envMap=this.fc=null}updateMatrixWorld(a){super.updateMatrixWorld(a);this.fc&&(this.fc.Ql(),Object.values(this.fc.Nf).forEach(b=>{Object.values(b.Bg).forEach(e=>{const f=e.ku,h=e.ss,n=e.ns,r=e.value;e=e.Rj;f&&(e===Wd.Wh.Cp?f.visible=r:e===Wd.Wh.im&&(f.quaternion.slerpQuaternions(h.quaternion,n.quaternion,r),f.position.lerpVectors(h.position,
n.position,r)))})}))}}class vC{constructor(a=null,b=null){this.Bi=a;this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles";this.Dp={};this.onLoad=b;this.Bi||(this.Bi=new QB)}setPath(a){this.path=a;return this}Ev(a){const b=new uC;let e=null;a.addEventListener("connected",f=>{const h=f.data;"tracked-pointer"===h.lB&&h.gamepad&&Oz(h,this.path,"generic-trigger").then(({profile:n,tm:r})=>{b.fc=new tC(h,n,r);if(n=this.Dp[b.fc.$j]){if(e=n.qf.clone(),Ov(b,e),this.onLoad)this.onLoad(e)}else{if(!this.Bi)throw Error("GLTFLoader not set.");
this.Bi.setPath("");this.Bi.load(b.fc.$j,t=>{this.Dp[b.fc.$j]=t;e=t.qf.clone();Ov(b,e);if(this.onLoad)this.onLoad(e)},null,()=>{throw Error(`Asset ${b.fc.$j} missing or malformed.`);})}}).catch(n=>{console.warn(n)})});a.addEventListener("disconnected",()=>{b.fc=null;b.remove(e);e=null});return b}}const Ox=new gd,Px=new mb;class wC{constructor(a,b,e,f,h){this.controller=b;this.Zw=a;this.envMap=null;let n;h&&h.ol&&"sphere"!==h.ol?"box"===h.ol&&(n=new Sg(1,1,1)):n=new kg(1,10,10);a=new Gj;this.$e=new cm(n,
a,30);this.$e.frustumCulled=!1;this.$e.instanceMatrix.setUsage(35048);this.$e.castShadow=!0;this.$e.receiveShadow=!0;this.Zw.add(this.$e);this.joints="wrist thumb-metacarpal thumb-phalanx-proximal thumb-phalanx-distal thumb-tip index-finger-metacarpal index-finger-phalanx-proximal index-finger-phalanx-intermediate index-finger-phalanx-distal index-finger-tip middle-finger-metacarpal middle-finger-phalanx-proximal middle-finger-phalanx-intermediate middle-finger-phalanx-distal middle-finger-tip ring-finger-metacarpal ring-finger-phalanx-proximal ring-finger-phalanx-intermediate ring-finger-phalanx-distal ring-finger-tip pinky-finger-metacarpal pinky-finger-phalanx-proximal pinky-finger-phalanx-intermediate pinky-finger-phalanx-distal pinky-finger-tip".split(" ")}fA(){const a=
this.controller.joints;let b=0;for(let e=0;e<this.joints.length;e++){const f=a[this.joints[e]];f.visible&&(Px.setScalar(f.jointRadius||.008),Ox.compose(f.position,f.quaternion,Px),this.$e.setMatrixAt(e,Ox),b++)}this.$e.count=b;this.$e.instanceMatrix.needsUpdate=!0}}class xC extends Cd{constructor(a){super();this.controller=a;this.mesh=this.envMap=this.fc=null}updateMatrixWorld(a){super.updateMatrixWorld(a);this.fc&&this.fc.fA()}}class yC{constructor(){this.path=null}setPath(a){this.path=a;return this}Hv(a){const b=
new xC(a);a.addEventListener("connected",e=>{e=e.data;e.hand&&!b.fc&&(b.bm=e,b.fc=new wC(b,a,this.path,e.handedness,{ol:"sphere"}));a.visible=!0});a.addEventListener("disconnected",()=>{a.visible=!1});return b}}let uj=2E3;class zC{Jv(){this.init();this.animate()}constructor(a){this.Bb=null;this.controller=[];this.line=this.Gg=this.Bm=null;this.Sa=[];this.hl=[];this.da={x:0,y:0};this.md={x:0,y:0};this.Ui=0;this.session=null;this.tk=!1;this.uj=!0;this.Zl=this.wp=this.kg=0;this.Gn=this.xg=!1;this.Ro=
0;this.rg=-4;this.ip=0;this.qk=this.Tg=this.Zk=!1;this.o=null;this.Ho=!0;this.Ue=1;this.Fk=[];this.frustumCulled=!1;this.Ek=0;this.Yl=null;this.zq=!0;this.Dl=0;this.Vm=1;this.Bp=this.Lc="srgb";this.Hr=this.Mm=null;this.Nk=-1;this.zm=this.pu=!1;this.ef=[-1,-1,-1,-1];this.ff=[-1,-1,-1,-1];this.eg=[!1,!1,!1,!1];this.ac=[];this.Sk=[];this.dg=[];this.Am=new Map;this.o=a;var b=this;setTimeout(function(){if(window.WebXRPolyfill&&window.Promise){let e={cardboardConfig:{BUFFER_SCALE:1}};try{new window.WebXRPolyfill(e)}catch(f){a.Rb(f)}}b.kx()},
0);a.Zf()?this.Wp():console.log("Three.js not available!")}Wp(){this.Ej=new gd;this.Ds=new Ff;this.Ms=new dj}init(){const a=this;var b=this.o;"xr"in navigator||console.log("no WebXR support");if(b.Zf())if(this.Bb)console.log("already set up!");else{this.Ej||this.Wp();var e=this.container=b.container,f=this.qf=new Pp,h=new af,n=this.camera=new ff(100,window.innerWidth/window.innerHeight,.001,uj);f.add(n);f.add(h);n.position.z=-.01;n.position.y=0;n.position.x=0;n=new Aw({depth:!0,logarithmicDepthBuffer:!1,
alpha:!0,antialias:!0,stencil:!1,powerPreference:"high-performance"});Fd.enabled=!0;b.Pk&&17==parseInt(b.Tb)&&this.ht("srgb","srgb-linear");n.outputColorSpace=this.Bp;n.setPixelRatio(window.devicePixelRatio);this.Bb=n;n.setClearColor(new Tb(0),1);n.setSize(window.innerWidth,window.innerHeight);n.shadowMap.enabled=!1;e.appendChild(n.domElement);"xr"in navigator&&(n.xr.enabled=!0,n.xr.setReferenceSpaceType("local"));n=this.dk=new af;n.name="controllerGroup";n.renderOrder=3E3;f.add(new Dp(12369084,10855845,
3));e=new am(16777215,3);e.position.set(0,6,0);f.add(e);e=(new md).setFromPoints([new mb(0,0,0),new mb(0,0,-1)]);var r=new mf({color:14737632});e=new cg(e,r);e.name="line";e.scale.z=5;this.line=e;this.Jp(0);this.Jp(1);n.visible=!1;e=this.uf=new af;e.name="skinGroup";e.translateZ(this.rg);e.visible=!1;e.renderOrder=1E3;h.add(e);e=this.Ic=new af;e.name="toggleSkinGroup";e.translateZ(this.rg+.1);e.position.y=0==this.Dl?3.17:-3.17;e.renderOrder=1100;e.visible=!1;h.add(e);h.add(n);h=(new gj).load(b.Ka("webxr/vrSkinShow.svg"));
e=new Df(.3,.3);h=new Qd({map:h,side:2,transparent:!0});e=new Bd(e,h);e.name="showSkinButton";e.userData.onclick=function(){a.ze()};e.userData.setOpacity=function(t){a.qg.material.opacity=t};e.visible=!0;this.qg=e;this.Ic.add(e);h=(new gj).load(b.Ka("webxr/vrSkinHide.svg"));e=new Df(.3,.3);h=new Qd({map:h,side:2,transparent:!0});e=new Bd(e,h);e.name="hideSkinButton";e.userData.onclick=function(){a.ze()};e.userData.setOpacity=function(t){a.ah.material.opacity=t};e.visible=!1;this.ah=e;this.Ic.add(e);
this.mh=new tw;this.da=new Lb;this.kf=new af;this.kf.name="panoGroup";b.Uc||(this.kf.renderOrder=1);this.ag=new af;this.ag.name="imageGroup";this.Td=new af;this.Td.name="hotspotGroup";this.Ng=new af;this.Ng.name="elementGroup";this.Gg=new af;this.Gg.name="centerGroup";b.Uc||(this.Gg.renderOrder=2E3);this.kf.add(this.Ng);this.kf.add(this.Td);this.kf.add(this.ag);f.add(this.kf);e=new md;b=[];f=[];for(h=0;20>h;h++)r=2*h*Math.PI/20,n=Math.cos(r),r=Math.sin(r),f.push(.03*n,.03*r,0),f.push(.05*n,.05*r,
0);for(h=0;20>h;h++){n=2*h+1;r=(h+1)%20*2+1;const t=(h+1)%20*2;b.push(2*h,n,t);b.push(n,r,t)}e.setIndex(b);e.setAttribute("position",new $b(f,3));b=new Qd({color:"black",side:2,transparent:!0,opacity:.25});b=new Bd(e,b);b.position.z=-5;this.Bm=b;this.Gg.add(b);window.addEventListener("resize",function(){a.iy()},!1);document.addEventListener("mouseup",function(){a.by()},!1);document.addEventListener("mousedown",function(t){a.$x(t)},!1);document.addEventListener("mousemove",function(t){a.ay(t)},!1)}else console.log("Three.js not available!")}Jp(a){const b=
this,e=b.qf;var f=b.Bb;this.Mm||(this.Mm=new vC,this.Hr=new yC);let h=f.xr.getController(a);h.addEventListener("selectstart",function(){-1==b.Nk&&b.Gs()});h.addEventListener("selectend",function(r){b.Fs(r)});h.visible=!1;h.userData.ek=a;this.dk.add(h);h.add(this.line.clone());var n=f.xr.getControllerGrip(a);n.add(this.Mm.Ev(n));e.add(n);f=f.xr.getHand(a);n=this.Hr.Hv(f);f.add(n);f.addEventListener("pinchstart",()=>{b.Nk=a;b.lo=Date.now();const r=Date.now()-b.mo;b.mo=Date.now();b.Gs();b.Ej.identity().extractRotation(h.matrixWorld);
const t=b.Ms;t.origin.setFromMatrixPosition(h.matrixWorld);t.direction.set(0,0,-1).applyMatrix4(this.Ej);500>b.zx&&800>r&&(this.ze(),b.mo=0)});f.addEventListener("pinchend",r=>{b.Nk=-1;b.zx=Date.now()-b.mo;b.Fs(r)});e.add(f);this.controller[a]=h}yt(){var a=this.o;a.G("vrchanged",{});a.G("playerstatechanged",{})}Bz(){this.Gn=!0;let a=this.o;a.G("vrchanged",{});a.G("playerstatechanged",{})}kx(){if(!this.pu){this.pu=!0;var a=this;this.o.Zf()&&"xr"in navigator&&navigator.xr.isSessionSupported("immersive-vr").then(function(b){b?
a.Bz():a.yt()}).catch(a.yt)}}Ak(){return this.uf}df(){return this.tk}$g(){return this.Gn}gy(a){let b=this;this.Wj();a.addEventListener("end",function(){b.ey()});a.addEventListener("inputsourceschange",()=>{});console.log("XR Session started.");this.Bb.xr.setSession(a);this.tk=!0;this.session=a;b.o.G("entervr",{session:a})}ey(){console.log("XR Session ended.");this.tk=!1;this.session=null;this.Im()}Pg(a){let b=this.o;if(this.Gn&&!a){if(null===this.session){let e=this;navigator.xr.requestSession("immersive-vr",
{optionalFeatures:["hand-tracking"]}).then(f=>{e.gy(f)}).catch(function(f){console.log(f);console.warn("'immersive-vr' isn't supported, or an error occurred activating VR!");e.Im()})}this.Td&&this.Td.translateY(-this.Ek);this.Ek=0;1==this.Ue&&(a=navigator.userAgent,0<=a.indexOf("OculusBrowser")&&(0<=a.indexOf("Pacific")&&(this.Ue=1.7),0<=a.indexOf("Quest")&&(this.Ue=1.5),0<=a.indexOf("Quest 3")&&(this.Ue=1.5)));this.Bb.xr.setFramebufferScaleFactor(this.Ue);b.Rb("Enter VR - scaled "+this.Ue)}else this.Wj(),
this.o.G("entervr",{session:null})}jy(){const a=this.o;a.Zf()&&this.Bb&&(a.zf=!0,a.Pb&&(uj=2E3),a.Fi&&(uj=2E3),a.T.style.display="none",a.Na.style.display="none",this.Bb.domElement.style.display="inline",a.G("vrchanged",{}),a.G("playerstatechanged",{}))}Im(){const a=this.o;a.Zf()&&this.Bb&&(a.zf=!1,a.T.style.display="inline",a.Na.style.display="inline",this.Bb.domElement.style.display="none",this.o.st(!1),a.uh(0),a.qd(),a.update(),a.G("vrchanged",{}),a.G("playerstatechanged",{}),this.o.G("exitvr",
{session:null}),this.jq())}Qg(){null!=this.session&&this.session.end()}St(){this.df()?this.Qg():this.Pg()}Zv(){let a=0,b=this.o.D.M,e;e=1536;this.Bb&&(e*=this.Ue);e*=Math.pow(2,0);if(0<b.levels.length)for(;b.levels.length>=a+2&&!b.levels[a+1].lh&&b.levels[a+1].width>e;)a++;return a}tr(a){let b=this.o;var e=b.D.M,f=b.yf[a];a="";if(f){f=f.firstChild;for(var h;f;)"input"==f.nodeName&&(h=f)&&(h=0<e.levels.length?h.getAttributeNode("leveltileurl"):h.getAttributeNode("tilevrurl"))&&(a=h.nodeValue),f=f.nextSibling}else a=
0<e.levels.length?e.Vn:b.Qm;e=a;a=b.Ws;for(f=0;3>f;f++)e=a(e,"c","vr"),e=a(e,"s","vr"),e=a(e,"r",0),e=a(e,"l",0),e=a(e,"x",0),e=a(e,"y",0),e=a(e,"v",0),e=a(e,"h",0);return b.Ka(e)}ceilPowerOfTwo(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}Vd(a,b,e){let f=new sh;f.setCrossOrigin(this.o.crossOrigin);let h=this;f.load(b,function(n){let r=h.ceilPowerOfTwo(n.width),t=h.ceilPowerOfTwo(n.height);a.colorSpace=h.Lc;if(r==n.width&&t==n.height||!e)a.image=n;else{var w=document.createElement("canvas");
w.width=r;w.height=t;w.getContext("2d").drawImage(n,0,0,r,t);a.image=w}a.needsUpdate=!0;a.Er=!0;a.Xe&&a.Xe.Er&&(a.zi.visible=!0,a.Xe.zi.visible=!0)});this.Fk.push(a)}Wj(){const a=this.o;if(a.Zf()){var b=a.D;if(!this.zm){var e=this.ag,f=this;this.og();this.camera.layers.enable(1);e.setRotationFromEuler(this.Ds);e.rotateX(b.ub.pitch*Math.PI/180);e.rotateZ(-b.ub.Y*Math.PI/180);var h=new kg(uj/3*1.5,16,16),n=new Rd,r=new sh;r.setCrossOrigin(this.o.crossOrigin);r.load(this.tr(a.Bd()),function(t){n.colorSpace=
f.Lc;n.image=t;n.needsUpdate=!0});r=new Qd({map:n,side:2});h=new Bd(h,r);h.scale.x=-1;h.rotateZ(b.ub.Y*Math.PI/180);h.rotateX(-b.ub.pitch*Math.PI/180);h.rotateY(-90*Math.PI/180);e.add(h);f.nl=h;f.zm=!0;setTimeout(function(){f.zm=!1;f.Zu();a.B.j?f.bv():f.$u();f.Yu();f.uj&&(f.uj=!1,a.G("vrconfigloaded",{}));window.__igloo__&&f.qf.traverse(t=>{t.frustumCulled=!1})});this.Hy();this.Ho=!0}}}bv(){function a(){var x=0;let y=2*Math.PI,z=0,ab=Math.PI;if(15==f.format&&(x=Math.PI/2,y=Math.PI,0<b.B.width&&0<
b.B.height)){let eb;eb=.5*b.B.width/b.B.height;1<eb&&(ab=Math.PI/eb,z=(Math.PI-ab)/2)}x=new kg(h,60,40,x,y,z,ab);x.scale(-1,1,1);return x}let b=this.o,e=this.ag,f=b.B,h=uj/3;if(b.Qb){var n=new hm(b.B.j);n.wrapS=1001;n.wrapT=1001;n.minFilter=1006;n.colorSpace=this.Lc;var r=a(),t=r.attributes.uv.array;for(var w=0;w<t.length;w+=2)15==f.format?(t[w]*=.5,t[w]+=.5):t[w+1]*=.5;t=new Qd({map:n});r=new Bd(r,t);r.rotateY(-90*Math.PI/180);r.layers.set(b.tg?1:2);e.add(r);r=a();t=r.attributes.uv.array;for(w=0;w<
t.length;w+=2)15==f.format?t[w]*=.5:(t[w+1]*=.5,t[w+1]+=.5);t=new Qd({map:n});r=new Bd(r,t);r.rotateY(-90*Math.PI/180);r.layers.set(b.tg?2:1);e.add(r)}else n=a(),r=new hm(b.B.j),r.colorSpace=this.Lc,r.wrapS=1001,r.wrapT=1001,r.minFilter=1006,r=new Qd({map:r}),n=new Bd(n,r),n.rotateY(-90*Math.PI/180),e.add(n);try{b.B.j.play()}catch(x){b.Rb(x)}}$u(){let a=this.o;var b=this.o.D.M;let e=[];var f=this.Zv();let h=this.ag,n=uj/3,r=a.Qb?2:1,t;if(b.levels.length>f){var w=b.levels[f];for(var x=0;6>x;x++){e[x]=
new af;for(var y=0;y<w.ta;y++)for(var z=0;z<w.aa;z++)for(let db=0;db<r;db++){let bb=new Rd;bb.colorSpace=this.Lc;this.Vd(bb,a.D.Eh(x,f,z,y,1==db),!0);bb.wrapS=1001;bb.wrapT=1001;bb.minFilter=1008;bb.anisotropy=1;var ab=b.W+2*b.lb;let gb=b.W+2*b.lb;z==w.aa-1&&(ab=w.width-b.W*(w.aa-1)+2*b.lb);y==w.ta-1&&(gb=w.width-b.W*(w.ta-1)+2*b.lb);var eb=new Df(n*ab/w.width,n*gb/w.width,8),cb=new Qd({map:bb});eb=new Bd(eb,cb);cb.transparent=!0;cb.side=0;cb=1*b.W;eb.position.x=n*(z*cb+ab/2-b.lb-w.width/2)/w.width;
eb.position.y=n*-(y*cb+gb/2-b.lb-w.width/2)/w.width;eb.position.z=-.5*n;a.Qb&&(eb.visible=!1,eb.layers.set(1==db?1:2),bb.zi=eb,0==db?t=eb:(ab=t.material.map,bb.Xe=ab,ab.Xe=bb));e[x].add(eb);eb.frustumCulled=this.frustumCulled}4>x?e[x].rotation.y=-x*Math.PI/2:e[x].rotation.x=(4==x?1:-1)*Math.PI/2;h.add(e[x])}}else for(b=a.Fh,f=0;6>f;f++)for(e[f]=new af,w=0;w<r;w++)y=f,a.Qb&&(y=f+(1==w?6:0)),x=new Rd,x.colorSpace=this.Lc,this.Vd(x,a.Ka(a.gi[y]),!1),x.wrapS=1001,x.wrapT=1001,x.minFilter=1006,z=new Df(b*
n,b*n,64),y=new Qd({map:x}),z=new Bd(z,y),y.transparent=!0,y.side=0,z.position.x=0,z.position.y=0,z.position.z=-.5*n,a.Qb&&(z.layers.set(1==w?1:2),z.visible=!1,x.zi=z,0==w?t=z:(y=t.material.map,x.Xe=y,y.Xe=x)),e[f].add(z),4>f?e[f].rotation.y=-f*Math.PI/2:e[f].rotation.x=(4==f?1:-1)*Math.PI/2,h.add(e[f])}Zu(){let a=this.o,b=this.Td;new Nd(0,0,-100);let e=a.P.Kl;for(let w=0;w<a.L.length;w++){let x=a.L[w];if("poly"==x.type)continue;var f=null,h=x.Nz(),n=!1;let y=x.wg?100:5;a.vrSkinObj&&a.vrSkinObj.addSkinHotspot&&
(f=a.vrSkinObj.addSkinHotspot(x))&&(n=!0,f.userData.gB&&(y=100));if(!n&&(n=.22,!1!==h)){y=!x.distance||0>=x.distance?5:1>x.distance?1:5>x.distance?x.distance:5;x.yd?(n=(new gj).load(x.yd),n.colorSpace=this.Lc,f=new Qd({map:n}),x.wg?(n=2*y*Math.tan(x.fov/2*Math.PI/180),h=new Df(n,n*x.Od/x.Of,1,1),f.transparent=!0,f.opacity=1):(h=new Df(.005*x.Of,.005*x.Od,1,1),f.transparent=!0,f.opacity=.25),n=.005*x.Od/2,f.side=2,f=new Bd(h,f)):(f=new kg(.2*this.Vm,16,16),h=(new gj).load(this.tr(h)),h.colorSpace=
this.Lc,h=new Qd({map:h}),h.transparent=!0,h.opacity=.25,f=new Bd(f,h));var r=x.title;if(e.enabled&&""!=r){h=document.createElement("canvas");h.width=256;h.height=32;let z=h.getContext("2d");this.Ij||(this.Ij=document.createElement("canvas"),this.Ij.width=h.width,this.Ij.height=h.height);let ab=this.Ij.getContext("2d");ab.clearRect(0,0,h.width,h.height);ab.font="16px Helvetica";ab.textAlign="center";ab.textBaseline="top";var t=ab.measureText(r);let eb=t.width;0<e.height&&(eb=Math.min(e.width,h.width-
6),eb=Math.max(eb,t.width));t=eb+6;e.background&&(ab.fillStyle=this.o.Ib(e.oc,e.nc),ab.fillRect((h.width-eb)/2-3,2,eb+6,24));0<e.ak&&(ab.strokeStyle=this.o.Ib(e.qc,e.pc),ab.strokeRect((h.width-eb)/2-3,2,eb+6,24));ab.fillStyle=this.o.Ib(e.Ll,e.Jl);ab.fillText(r,h.width/2,5,h.width-6);z.drawImage(this.Ij,(h.width-t)/2,2,t,24,0,0,h.width,h.height);r=new Rd(h);r.colorSpace=this.Lc;r.needsUpdate=!0;h=new Df(1.5*t/h.width,4.5/h.height,1,1);r=new Qd({map:r,side:2});h=new Bd(h,r);h.translateY(-(n*this.Vm)-
.09375);h.frustumCulled=this.frustumCulled;f.add(h);r.transparent=!0;r.opacity=.5}f.userData={N:x}}f&&(f.rotateY(x.pan*Math.PI/180),f.rotateX(x.u*Math.PI/180),f.translateZ(-y),f.castShadow=!1,f.receiveShadow=!1,f.frustumCulled=this.frustumCulled,b.add(f))}}Yu(){var a=this.o;for(var b=0;b<a.$a.length;b++){var e=a.$a[b];if(e.j){var f=(new gj).load(e.j.src);f.colorSpace=this.Lc;this.oq(e,f)}}for(b=0;b<a.V.length;b++)e=a.V[b],e.j&&"_videopanorama"!=e.id&&!e.Gd&&(e.j.play(),f=new hm(e.j),f.colorSpace=
this.Lc,f.wrapS=1001,f.wrapT=1001,f.minFilter=1006,this.oq(e,f))}oq(a,b){const e=this.Ng;let f=uj/8;var h=2*Math.tan(a.fov*Math.PI/360)*f;let n;n=0<a.tc?h*a.kd/a.tc:h;a.Tc&&1!=a.Tc&&(n*=a.Tc);h=new Df(h,n,5,5);b=new Qd({map:b,side:2,transparent:!0});b=new Bd(h,b);b.rotateY(a.pan*Math.PI/180);b.rotateX(a.u*Math.PI/180);b.translateY(-0);b.translateZ(-f);b.rotateZ(-a.Ua*Math.PI/180);b.rotateY(-a.Ea*Math.PI/180);b.rotateX(-a.za*Math.PI/180);b.userData=a;b.castShadow=!1;b.receiveShadow=!1;e.add(b)}zl(a,
b,e){for(let f=0;f<this.Ng.children.length;f++){let h=this.Ng.children[f];h.userData.id==a&&this.Xy(h,b,e)}}Xy(a,b,e){b=2==b?a.visible?0:1:b;0<e?this.Xv(a,b,e):a.visible=1==b}Xv(a,b,e){1==b&&(a.material.opacity=0,a.visible=!0);let f=(new Date).getTime(),h=setInterval(()=>{let n=(new Date).getTime()-f,r=n/e;a.material.opacity=0==b?1-r:r;n>e&&(0==b&&(a.visible=!1,a.material.opacity=1),clearInterval(h))},20)}li(a){for(let b=a.children.length-1;0<=b;b--){let e=a.children[b];this.li(e);a.remove(e)}a.geometry&&
a.geometry.dispose();a.material&&(a.material.texture&&(a.material.texture.dispose(),a.material.texture.Xe=null,a.material.texture.zi=null),a.material.map&&(a.material.map.dispose(),a.material.map.Xe=null,a.material.map.zi=null),a.material.dispose())}og(){lg&&(this.Fk=[],this.li(this.ag),this.li(this.Td),this.li(this.Ng))}iy(){if(lg){var a=this.camera;a.aspect=window.innerWidth/window.innerHeight;a.updateProjectionMatrix();this.Bb.setSize(window.innerWidth,window.innerHeight)}}Gs(){if(lg){var a=this.o;
if(0<this.Sa.length){for(var b=0,e;b<this.Sa.length&&!e;)this.fo(this.Sa[b])&&(e=this.Sa[0]),b++;e&&(b=e.userData,b.N&&!b.fromSkin?(e=b.N,a.$c(e.url,e.target)):(this.Le(e,"onmousedown"),this.Le(e,"onclick")))}}}Fs(a){if(lg){a=a.target;var b=this.$q(a);0<b.length&&this.Xj(b,a.userData.ek)}}$q(a){this.Ej.identity().extractRotation(a.matrixWorld);this.mh.ray.origin.setFromMatrixPosition(a.matrixWorld);this.mh.ray.direction.set(0,0,-1).applyMatrix4(this.Ej);return this.Kn(this.mh)}Kn(a){let b=[],e;this.Td.visible&&
(e=a.intersectObjects(this.Td.children,!0),b=b.concat(e));this.uf.visible&&(e=a.intersectObjects(this.uf.children,!0),b=b.concat(e));e=a.intersectObjects(this.Ic.children,!0);return b=b.concat(e)}Xj(a,b=-1){for(let e=0;e<a.length;e++){const f=a[e].object;f&&f.userData&&(void 0!==f.userData.isVisible&&f.userData.isVisible()||void 0===f.userData.isVisible&&this.fo(f)||f.userData.clickInvisible&&this.fo(f))&&(f.selected=!0,f.distance=a[e].distance,f.ek=b,this.Sa.push(f))}}mx(a){var b=this.controller[a],
e=b.getObjectByName("line");let f=this.$q(b);0<f.length&&this.Xj(f,b.userData.ek);e&&(e.scale.z=0<this.Sa.length?this.Sa[0].distance:5);this.Nk==a&&(a=this.Ms.direction,b=this.mh.ray.direction,e=a.clone(),e.sub(b),e.normalize(),a.angleTo(b)>Math.PI/4?Math.abs(e.x)+Math.abs(e.z)>Math.abs(e.y)&&this.lo<Date.now()&&(this.qh(0<e.x?20:-20),this.lo=Date.now()+500):this.lo=Date.now())}jq(){for(;this.Sa.length;)this.Sa.pop().selected=!1}ay(a){a.preventDefault();let b=this.da,e=this.Bb;b.x=a.clientX/e.domElement.clientWidth*
2-1;b.y=2*-(a.clientY/e.domElement.clientHeight)+1;1==a.buttons&&(this.Ui=this.md.x-b.x)}lx(){var a=this.mh;a.setFromCamera(this.da,this.camera);a=this.Kn(a);0<a.length&&this.Xj(a)}nx(){var a=this.mh;this.camera.updateProjectionMatrix();a.setFromCamera({x:0,y:0},this.camera);a=this.Kn(a);0<a.length&&this.Xj(a)}by(){this.Ui=0;if(0<this.Sa.length){let a=this.Sa[0];a.userData.N||this.Le(a,"onmouseup")}}Le(a,b,e=!1){let f=a;do if(f.userData[b])if(e){var h=a.ek;0<=h&&this.ac&&this.ac[h]&&(h=this.ac[h],
h.hapticActuators&&0<h.hapticActuators.length&&h.hapticActuators[0].pulse(.8,5))}else f.userData[b]();while(!f.userData.stopPropagation&&(f=f.parent))}Yp(a,b){const e=this.Bm;do if(a.userData.onclick||a.userData.N&&!a.userData.fromSkin)if(b)a.userData.xj=-1;else if(a.userData.xj&&-1!=a.userData.xj){const f=(Date.now()-a.userData.xj)/1E3;1<=f?a.userData.onclick?(a.userData.onclick(),a.userData.xj=-1):a.userData.N&&a.userData.N.url&&this.o.$c(a.userData.N.url,a.userData.N.target):e.material instanceof
Zd&&(e.material.opacity=.5+.5*f)}else a.userData.xj=Date.now();while(!a.userData.stopPropagation&&(a=a.parent))}$x(a){var b=this.o;50>a.clientX&&50>a.clientY&&b.Qg();if(0<this.Sa.length){a=this.Sa[0];for(b=1;b<this.Sa.length;b++)this.Sa[b].position.z>a.position.z&&(a=this.Sa[b]);b=a.userData;b.N?(a=b.N,this.o.$c(a.url,a.target)):(this.Le(a,"onclick"),this.Le(a,"onmousedown"))}else this.md.x=this.da.x,this.md.y=this.da.y}animate(){let a=this.ps=this;this.Bb&&this.Bb.setAnimationLoop(function(){a.render();
a.o.au()})}render(){if(lg){var a=null;try{a=this.Bb.xr.getCamera()}catch(n){}!this.Yl&&a&&(a.add(this.Gg),this.qf.add(a));if(this.Yl=a)this.Td.translateY(a.position.y-this.Ek),this.Ek=a.position.y;var b=this.ps,e=b.o;if(e.zf){b.xg=!0;b.controller.forEach(n=>{n.visible&&(b.xg=!1)});var f=this.$w();this.ax();this.nl&&0<this.Fk.length&&this.Fk.every(function(n){return n.Er})&&(this.li(this.nl),this.ag.remove(this.nl),this.nl=null);var h=this.Td;for(let n=h.children.length-1;0<=n;n--){let r=h.children[n],
t=1,w=1;r.selected?(t=1.5,w=1):f?(t=.6,w=.7):(t=.4,w=.5);let x=r.scale.x;x+=.1*(t-x);r.userData.fromSkin?r.userData.ggUse3d&&(x=10):(r.material.opacity+=.1*(w-r.material.opacity),r.userData&&r.userData.N&&r.userData.N.yd?(r.userData.N.wg&&(x=1,r.material.opacity=1),0<r.children.length&&(r.children[0].material.opacity=r.material.opacity)):(r.rotateY(1*Math.PI/180),0<r.children.length&&(r.children[0].rotateY(-1*Math.PI/180),r.children[0].material.opacity=r.material.opacity)));r.scale.x=r.scale.y=r.scale.z=
x}f=b.camera.rotation.clone();f.reorder("YXZ");this.wp=180*f.y/Math.PI;this.Zl=180*f.x/Math.PI;e.vrSkinObj&&!this.uf.visible&&this.zq&&(0==this.Dl&&10<this.Zl||1==this.Dl&&-10>this.Zl?this.Zk||(this.Zk=!0,this.Jx=new Date):(this.Zk=!1,!this.Tg&&!this.Ic.visible||this.qk||(this.qk=!0,this.bn=new Date),this.Tg=!1),this.Zk&&!this.Tg&&!this.Ic.visible&&500<(new Date).getTime()-this.Jx.getTime()&&(this.Tg=!0,this.bn=new Date),this.Tg?(this.Ic.visible=!0,h=((new Date).getTime()-this.bn.getTime())/5,100<=
h?(this.qj(1),this.Tg=!1):this.qj(h/100)):this.qk&&(h=((new Date).getTime()-this.bn.getTime())/5,100<=h?(this.qj(0),this.qk=!1):this.qj(1-h/100)));this.Ho&&(this.qh(this.wp-e.D.pan.m),this.Ho=!1);e.Po(this.wp-this.kg,this.Zl,180*f.z/Math.PI);e=this.Gg;b.xg?a&&(e.visible=!0):e.visible=!1;e=this.Ic;a&&!this.uf.visible&&(e.translateZ(-(this.rg+.1)),e.rotateY(-this.ip),f=new mb(0,0,1),f.applyEuler(a.rotation),this.ip=Math.atan2(f.x,f.z),e.rotateY(this.ip),e.translateZ(this.rg+.1));b.Bb.autoClear=!0;b.Bb.render(b.qf,
b.camera);0==this.Ui||isNaN(this.Ui)||this.qh(this.Ui)}}}$w(){function a(w,x){if(b.ac[w].buttons[x].pressed){if(!b.Am.get(w+"_"+x))return b.Am.set(w+"_"+x,!0),!0}else b.Am.set(w+"_"+x,!1);return!1}let b=this;const e=b.o;this.ac=[];let f=!0;this.session?(this.session.inputSources.forEach(w=>{let x=w.profiles;"gaze"==w.targetRayMode?b.xg=!0:(this.ac.push(w.gamepad),0<=x.indexOf("oculus-go")&&(f=!1),0<=x.indexOf("generic-trigger-squeeze-thumbstick")&&(f=!0),0<=x.indexOf("oculus-touch")&&(f=!0))}),this.ac.push(...navigator.getGamepads())):
this.ac=navigator.getGamepads&&navigator.getGamepads();let h=!1;if(this.ac)for(let w=0;w<this.ac.length;w++){var n=this.ac[w];if(n&&0<n.buttons.length)if(6<n.buttons.length&&(a(w,4)&&e.$c("{"+e.sr()+"}"),a(w,5)&&e.$c("{"+e.jr()+"}")),2<=n.axes.length&&2<n.buttons.length&&!f)if(n.buttons[2].pressed)this.eg[w]||(this.eg[w]=!0,this.ze());else if(n.buttons[2].touched){h=!0;this.eg[w]=!1;var r=n.axes[0];n=n.axes[1];if(-1==this.ef[w])this.ef[w]=r;else{var t=this.ef[w]-r;-.3>t&&(this.qh(20),this.ef[w]=r,
this.ff[w]=n);.3<t&&(this.qh(-20),this.ef[w]=r,this.ff[w]=n)}-1==this.ff[w]?this.ff[w]=n:(t=this.ff[w]-n,-.5>t&&(this.ze(!0),this.ff[w]=n,this.ef[w]=r),.5<t&&(this.ze(!1),this.ff[w]=n,this.ef[w]=r))}else this.ef[w]=-1,this.ff[w]=-1,this.eg[w]=!1;else 4<=n.axes.length&&(r=n.axes[2],.8<r?(h=!0,1!=this.dg[w]&&(this.dg[w]=1,this.Sk[w]=Date.now()-1E4)):-.8>r?(h=!0,-1!=this.dg[w]&&(this.dg[w]=-1,this.Sk[w]=Date.now()-1E4)):this.dg[w]=0,0!=this.dg[w]&&400<Date.now()-this.Sk[w]&&(this.Sk[w]=Date.now(),this.qh(20*
this.dg[w])),n.buttons[1].pressed?this.eg[w]||(this.eg[w]=!0,this.ze()):this.eg[w]=!1)}b.dk.visible==(!this.ac||0==this.ac.length)&&(b.dk.visible=!b.dk.visible);return h}yy(a){for(a=a.parent;a;){if(a.selected)return!0;a=a.parent}return!1}fo(a){let b=a.visible||a.userData.clickInvisible;for(a=a.parent;b&&a;)b=b&&a.visible,a=a.parent;return b}ax(){let a=this.ps;a.hl=a.Sa.slice();a.jq();for(var b=0;b<a.controller.length;b++)a.controller[b].visible&&a.mx(b);a.tk||a.lx();if(a.xg){a.nx();b=this.Bm;b.position.z=
0<a.Sa.length?-a.Sa[0].distance+.1:-5;var e=-.2*b.position.z;b.scale.set(e,e,e);b.material instanceof Zd&&(b.material.opacity=.2)}for(b=0;b<a.Sa.length;b++)e=a.Sa[b],a.xg&&this.Yp(e,!1),-1==a.hl.indexOf(e)&&(this.Le(e,"onmouseenter"),this.ac&&0<this.ac.length&&this.Le(e,"onclick",!0));for(b=0;b<a.hl.length;b++)e=a.hl[b],-1==a.Sa.indexOf(e)&&(this.yy(e)||this.Le(e,"onmouseleave"),a.xg&&this.Yp(e,!0))}ze(a){let b=this.uf;void 0===a&&(a=!b.visible);var e=this.Yl;a?(b.translateZ(-this.rg),b.rotateY(-this.Ro),
e&&(a=new mb(0,0,1),a.applyEuler(e.rotation),this.Ro=Math.atan2(a.x,a.z)),b.rotateY(this.Ro),b.translateZ(this.rg),e=-this.rg/5,b.scale.set(e,e,e),this.uf.visible=!0,this.Ic.visible=!0,this.qj(1),this.qg.visible=!1,this.ah.visible=!0):(this.uf.visible=!1,this.Ic.visible=!1,this.qg.visible=!0,this.ah.visible=!1)}qj(a){this.qg.userData.setOpacity(a);0==a&&(this.Ic.visible=!1)}Ys(a){a.position.x=0;a.position.y=0;a.position.z=0;a.userData.x=0;a.userData.y=0;a.userData.z=0}ez(a){this.Ys(a);this.Ic.remove(this.qg);
a.userData.setOpacity(0);this.qg=a;this.Ic.add(this.qg)}Sy(a){this.Ys(a);this.Ic.remove(this.ah);a.userData.setOpacity(1);a.visible=!1;this.ah=a;this.Ic.add(this.ah)}Hy(){this.kg=0;this.kf.setRotationFromEuler(this.Ds)}qh(a){this.kg+=a;this.kf.rotateY(a*Math.PI/180)}ht(a,b){a&&(this.Lc=a);b&&(this.Bp=b)}}class bg{constructor(){this.value=this.time=0;this.tp="";this.Kf=this.Jf=this.If=this.Hf=this.wb=this.type=this.Mb=0;this.Ld="";this.Np=0}}class Qx{constructor(){this.$z=this.ev=this.length=0}}class Rx{}
class Ng{kt(){this.yc=1;this.Yc=this.zc=this.Sb=0;this.Ac=1;this.Bc=this.hc=this.Zc=0;this.ic=1}constructor(){this.kt()}clone(a){this.yc=a.yc;this.Sb=a.Sb;this.zc=a.zc;this.Yc=a.Yc;this.Ac=a.Ac;this.Zc=a.Zc;this.hc=a.hc;this.Bc=a.Bc;this.ic=a.ic}bz(a){let b=Math.cos(a);a=Math.sin(a);this.yc=1;this.Yc=this.zc=this.Sb=0;this.Ac=b;this.Zc=-a;this.hc=0;this.Bc=a;this.ic=b}cz(a){let b=Math.cos(a);a=Math.sin(a);this.yc=b;this.Sb=0;this.zc=a;this.Yc=0;this.Ac=1;this.Zc=0;this.hc=-a;this.Bc=0;this.ic=b}dz(a){let b=
Math.cos(a);a=Math.sin(a);this.yc=b;this.Sb=-a;this.zc=0;this.Yc=a;this.Ac=b;this.Bc=this.hc=this.Zc=0;this.ic=1}kc(a){this.za(a*Math.PI/180)}ad(a){this.Ea(a*Math.PI/180)}ye(a){this.Ua(a*Math.PI/180)}za(a){this.Fd||(this.Fd=new Ng,this.hf=new Ng);this.Fd.bz(a);this.hf.clone(this);this.multiply(this.Fd,this.hf)}Ea(a){this.Fd||(this.Fd=new Ng,this.hf=new Ng);this.Fd.cz(a);this.hf.clone(this);this.multiply(this.Fd,this.hf)}Ua(a){this.Fd||(this.Fd=new Ng,this.hf=new Ng);this.Fd.dz(a);this.hf.clone(this);
this.multiply(this.Fd,this.hf)}multiply(a,b){this.yc=a.yc*b.yc+a.Sb*b.Yc+a.zc*b.hc;this.Sb=a.yc*b.Sb+a.Sb*b.Ac+a.zc*b.Bc;this.zc=a.yc*b.zc+a.Sb*b.Zc+a.zc*b.ic;this.Yc=a.Yc*b.yc+a.Ac*b.Yc+a.Zc*b.hc;this.Ac=a.Yc*b.Sb+a.Ac*b.Ac+a.Zc*b.Bc;this.Zc=a.Yc*b.zc+a.Ac*b.Zc+a.Zc*b.ic;this.hc=a.hc*b.yc+a.Bc*b.Yc+a.ic*b.hc;this.Bc=a.hc*b.Sb+a.Bc*b.Ac+a.ic*b.Bc;this.ic=a.hc*b.zc+a.Bc*b.Zc+a.ic*b.ic}Rx(a){let b,e,f;b=a.x;e=a.y;f=a.z;a.x=b*this.yc+e*this.Sb+f*this.zc;a.y=b*this.Yc+e*this.Ac+f*this.Zc;a.z=b*this.hc+
e*this.Bc+f*this.ic}}class AC{constructor(){this.levels=[];this.ml="0x000000";this.Ps=!1;this.gs=this.fs=.4;this.W=512;this.lb=1;this.Un=0;this.Vn="";this.Vs=this.height=this.width=0}}class Sx{constructor(){this.height=this.width=0;this.lh=this.cache=!1;this.ta=this.aa=0;this.loaded=!1;this.Qa={}}}class Hk{constructor(a){this.id=0;this.le=this.yb=this.M=null;this.loaded=this.visible=!1;this.Yf=this.Hb=null;this.mf=this.Bo=0;this.Xg=[];this.zn=0;this.qb=[];this.Uk=this.Ra=0;this.level=null;this.Qk=
0;this.id=a}}class Tx{constructor(a,b){this.Ca=yd.create();this.ab=yd.create();this.re=0;this.ij=this.xd=this.Me=this.hk=this.Vg=this.jj=this.Co=this.Do=null;this.ib=[];this.kb=null;this.Ii=!1;this.Zo=this.dn=this.Ao=1;this.Lg=1E6;this.gk=[!1,!1,!1,!1,!1,!1];this.kp=0;this.om=1;this.El=!1;this.Um=[];this.mi=!1;this.Ap=8;this.Lx=new Ng;this.offset=this.mp=0;this.Oe=[];this.vp=null;this.o=a;this.D=b;b.hh=this;if(a.Uc||a.Ei)b.hp=2}Di(){const a=this.o;let b=a.O;if(b){var e=b.createShader(b.FRAGMENT_SHADER);
if(e){b.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\n\t\t\t\t\tuniform sampler2D uSampler;\n\t\t\t\t\tvoid main(void) {\n\t\t\t\t\t\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n\t\t\t\t\t}");b.compileShader(e);b.getShaderParameter(e,b.COMPILE_STATUS)||(console&&console.log(b.getShaderInfoLog(e)),alert(b.getShaderInfoLog(e)),e=null);var f=b.createShader(b.VERTEX_SHADER);
a.Sc(f,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nattribute vec3 aVertexPosition;\n\t\t\t\tattribute vec2 aTextureCoord;\n\t\t\t\tuniform mat4 uMVMatrix;\n\t\t\t\tuniform mat4 uPMatrix;\n\t\t\t\tuniform float uZoffset;\n\t\t\t\tvarying vec2 vTextureCoord;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n\t\t\t\t\tgl_Position.z += uZoffset;\n\t\t\t\t\tvTextureCoord = aTextureCoord;\n\t\t\t\t}");
this.R=b.createProgram();a.gg(this.R,f,e);this.R.ma=b.getAttribLocation(this.R,"aVertexPosition");b.enableVertexAttribArray(this.R.ma);this.R.Ia=b.getAttribLocation(this.R,"aTextureCoord");b.enableVertexAttribArray(this.R.Ia);this.R.jf=b.getUniformLocation(this.R,"uPMatrix");this.R.Wi=b.getUniformLocation(this.R,"uMVMatrix");this.R.rh=b.getUniformLocation(this.R,"uSampler");this.R.jm=b.getUniformLocation(this.R,"uZoffset");e=b.createShader(b.VERTEX_SHADER);a.Sc(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nattribute vec3 aVertexPosition;\n\t\t\t\tuniform vec2 uCanvasDimensions;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tvec2 pointNorm = (aVertexPosition.xy / uCanvasDimensions) * 2.0 - vec2(1.0, 1.0);\n\t\t\t\t\tgl_Position = vec4(pointNorm.x, pointNorm.y * -1.0, 0.0, 1.0);\n\t\t\t\t}");
f=b.createShader(b.FRAGMENT_SHADER);a.Sc(f,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec3 uColor;\n\t\t\t\tuniform float uAlpha;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tgl_FragColor = vec4(uColor, uAlpha);\n\t\t\t\t}");this.we=b.createProgram();a.gg(this.we,e,f);this.we.ma=b.getAttribLocation(this.we,"aVertexPosition");b.enableVertexAttribArray(this.we.ma);f=b.createShader(b.VERTEX_SHADER);a.Sc(f,"precision highp float;\n\t\t\t\tattribute vec3 aVertexPosition;\n\t\t\t\tvarying vec2 vTextureCoord;\n\t\t\t\tuniform vec2 uCanvasDimensions;\n\t\t\t\tuniform vec4 uRect;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tvec2 pos = vec2(uRect.x + uRect.z*aVertexPosition.x,uRect.y + uRect.w*aVertexPosition.y);\n\t\t\t\t\tvec2 pointNorm = (pos / uCanvasDimensions) * 2.0 - vec2(1.0, 1.0);\n\t\t\t\t\tgl_Position = vec4(pointNorm.x, pointNorm.y * -1.0, 1.0, 1.0);\n\t\t\t\t\tvTextureCoord.s=aVertexPosition.x;\n\t\t\t\t\tvTextureCoord.t=1.0-aVertexPosition.y;\n\t\t\t\t}");
e=b.createShader(b.FRAGMENT_SHADER);a.Sc(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec2 vTextureCoord;\n\t\t\t\tuniform sampler2D uSampler;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tgl_FragColor = texture2D(uSampler,vTextureCoord);\n\t\t\t\t}");this.Vg=b.createProgram();a.gg(this.Vg,f,e)}else console.log("error creating shader")}}Ik(){let a=this.o,b=a.O,e;if(b){e=b.createShader(b.FRAGMENT_SHADER);var f=this.un(13);a.Sc(e,f);f=b.createShader(b.VERTEX_SHADER);
a.Sc(f,"precision highp float;\nattribute vec3 aVertexPosition;\nuniform vec2 uCanvasDimensions;\nvarying vec2 dst;\nuniform vec2 dstSize;\nuniform float zOffset;\nvoid main(void) {\n vec2 pointNorm = (aVertexPosition.xy / uCanvasDimensions) * 2.0 - vec2(1.0, 1.0);\n gl_Position = vec4(pointNorm.x, pointNorm.y * -1.0, zOffset, 1.0);\n dst.x= -1.0 + 2.0*((aVertexPosition.x + 0.5) / uCanvasDimensions.x);\n dst.y= (-1.0 * uCanvasDimensions.y + 2.0*(aVertexPosition.y + 0.5)) / uCanvasDimensions.x;\n}\n");
this.Co=b.createProgram();a.gg(this.Co,f,e);e=b.createShader(b.FRAGMENT_SHADER);f=this.un(4);a.Sc(e,f);f=b.createShader(b.VERTEX_SHADER);a.Sc(f,"precision highp float;\nattribute vec3 aVertexPosition;\nuniform vec2 uCanvasDimensions;\nvarying vec2 dst;\nuniform vec2 dstSize;\nuniform float zOffset;\nvoid main(void) {\n vec2 pointNorm = (aVertexPosition.xy / uCanvasDimensions) * 2.0 - vec2(1.0, 1.0);\n gl_Position = vec4(pointNorm.x, pointNorm.y * -1.0, zOffset, 1.0);\n dst.x= -1.0 + 2.0*((aVertexPosition.x + 0.5) / uCanvasDimensions.x);\n dst.y= (-1.0 * uCanvasDimensions.y + 2.0*(aVertexPosition.y + 0.5)) / uCanvasDimensions.x;\n}\n");
this.Do=b.createProgram();a.gg(this.Do,f,e);this.rq();this.ij||(this.ij=b.createBuffer())}}rq(){const a=this.o,b=a.O;const e=b.createShader(b.FRAGMENT_SHADER);var f=this.un(a.B.format);a.Sc(e,f);f=b.createShader(b.VERTEX_SHADER);a.Sc(f,"precision highp float;\nattribute vec3 aVertexPosition;\nuniform vec2 uCanvasDimensions;\nvarying vec2 dst;\nuniform vec2 dstSize;\nvoid main(void) {\n vec2 pointNorm = (aVertexPosition.xy / uCanvasDimensions) * 2.0 - vec2(1.0, 1.0);\n gl_Position = vec4(pointNorm.x, pointNorm.y * -1.0, 0.0, 1.0);\n dst.x= -1.0 + 2.0*((aVertexPosition.x + 0.5) / uCanvasDimensions.x);\n dst.y= (-1.0 * uCanvasDimensions.y + 2.0*(aVertexPosition.y + 0.5)) / uCanvasDimensions.x;\n}\n");
this.jj&&b.deleteProgram(this.jj);this.jj=b.createProgram();a.gg(this.jj,f,e);b.deleteShader(f);b.deleteShader(e)}un(a){let b=this.o,e;e="#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define M_PI 3.14159265358979323846\nvarying vec2 dst;\nuniform vec2 srcScale;\nuniform vec2 srcOffset;\nuniform float rectDstDistance;\nuniform float fisheyeDistance;\nuniform float stereoDistance;\nuniform float directionBlend;\nuniform float transitionBlend;\nuniform mat4 matRotate; // = mat4( 1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0 );\nconst float rectSrcDistance = 1.0;\nuniform vec2 tonemap;\n";
e=(13==a?e+"uniform samplerCube cubeTexture;":e+"uniform sampler2D tileTexture;\n")+"void main()\n{\n";e+="vec4 direction;\n";e+="vec2 src;\n";e+="vec2 srcCord;\n";e+="vec2 texc;\n";let f=this.wr(b.$());if(b.$()!=b.Rc()&&0!=b.Rc()){let h=this.wr(b.Rc());e+="vec4 direction1,direction2;\n";e+=f.replace("direction=","direction1=");e+=h.replace("direction=","direction2=");e+="direction=normalize(mix(direction1, direction2,1.0-directionBlend));\n"}else e+=f;e+="direction=direction*matRotate;\n";13==a&&
(e+="direction.z=-direction.z;",e+="gl_FragColor = textureCube(cubeTexture, direction.xyz);",e+="gl_FragColor.a *= transitionBlend;\n");4==a&&(e+="float iz=1.0/(direction.z * rectSrcDistance);\n",e+="src.x=-direction.x*iz;\n",e+="src.y= direction.y*iz;\n",e+="texc=src * srcScale + srcOffset;\n",e+="if (",e+="(direction.z<0.0) && ",e+="(texc.x>=0.0) && (texc.x<=1.0) && (texc.y>=0.0) && (texc.y<=1.0)) {\n",this.mi?e+=" gl_FragColor = vec4(0.5,0.5,0,1);\n":(e+="  gl_FragColor = texture2D(tileTexture, texc);\n",
e+="  gl_FragColor.a*= transitionBlend;\n"),e+="} else {\n",e=this.mi?e+" gl_FragColor = vec4(0.5,0,0,0.3);\n":e+"  discard;\n",e+="}\n");1==a&&(e+="src.x=atan(float(-direction.x), float(-direction.z));",e+="src.y=asin(direction.y);\n",e+="texc=src * srcScale + srcOffset;\n",e+="gl_FragColor = texture2D(tileTexture, texc);\n");15==a&&(e+="src.x=atan(float(-direction.x), float(-direction.z));",e+="src.y=asin(direction.y);\n",e+="texc=src * srcScale + srcOffset;\n",e=b.Qb?e+"vec2 s=step(vec2(0.5,0.0), texc) - step(vec2(1.0,1.0), texc);\n":
e+"vec2 s=step(vec2(0.0,0.0), texc) - step(vec2(1.0,1.0), texc);\n",e+="gl_FragColor = s.x*s.y*texture2D(tileTexture, texc);\n");14==a&&(e+="vec2 cf;\n",e+="if ((direction.z<0.0) && (direction.z<=-abs(direction.x)) && (direction.z<=-abs(direction.y))) {\n",e+="  src.x=-direction.x/direction.z;\n",e+="  src.y=+direction.y/direction.z;\n",e+="  cf.x=1.0;cf.y=3.0;\n",e+="}\n",e+="if ((direction.x>=0.0) && (direction.x>=abs(direction.y)) && (direction.x>=abs(direction.z))) {\n",e+="  src.x=+direction.z/direction.x;\n",
e+="  src.y=-direction.y/direction.x;\n",e+="  cf.x=3.0;cf.y=3.0;\n",e+="}\n",e+="if ((direction.z>=0.0) && (direction.z>=abs(direction.x)) && (direction.z>=abs(direction.y))) {\n",e+="  src.x=-direction.x/direction.z;\n",e+="  src.y=-direction.y/direction.z;\n",e+="  cf.x=5.0;cf.y=3.0;\n",e+="}\n",e+="if ((direction.x<=0.0) && (direction.x<=-abs(direction.y)) && (direction.x<=-abs(direction.z))) {\n",e+="  src.x=+direction.z/direction.x;\n",e+="  src.y=+direction.y/direction.x;\n",e+="  cf.x=1.0;cf.y=1.0;\n",
e+="}\n",e+="if ((direction.y>=0.0) && (direction.y>=abs(direction.x)) && (direction.y>=abs(direction.z))) {\n",e+="  src.x=+direction.x/direction.y;\n",e+="  src.y=-direction.z/direction.y;\n",e+="  cf.x=5.0;cf.y=1.0;\n",e+="}\n",e+="if ((direction.y<=0.0) && (direction.y<=-abs(direction.x)) && (direction.y<=-abs(direction.z))) {\n",e+="  src.x=-direction.x/direction.y;\n",e+="  src.y=-direction.z/direction.y;\n",e+="  cf.x=3.0;cf.y=1.0;\n",e+="}\n",e+="texc.x=(cf.x+src.x*srcScale.x) / 6.0;\n",e+=
"texc.y=(cf.y+src.y*srcScale.y) / 4.0;\n",e+="gl_FragColor = texture2D(tileTexture, texc);\n");return e+="}\n"}wr(a){let b="";switch(a){case 4:b+="direction.x=dst.x*rectDstDistance;\ndirection.y=dst.y*rectDstDistance;\ndirection.z=-1.0;\n";break;case 12:b+="float r,ph,ro;\nr=length(dst.xy)*0.5;\nro=atan(float(dst.x),float(-dst.y));\nph=r / fisheyeDistance;\ndirection.x= sin(ph) * sin(ro);\ndirection.y=-sin(ph) * cos(ro);\ndirection.z=-cos(ph);\n";break;case 9:b+="float n;\nvec2 ind;\nind=dst*stereoDistance;\nn=1.0 + ind.x*ind.x + ind.y*ind.y;\ndirection.x=2.0*ind.x/n;\ndirection.y=2.0*ind.y/n;\ndirection.z=(n-2.0)/n;\n"}return b+
"direction.w=0.0;\ndirection=normalize(direction);\n"}Or(a){let b,e,f,h,n=this.o,r=this.o.O;this.hk=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this.hk);let t=[-1,-1,1,1,-1,1,1,1,1,-1,1,1];for(b=0;12>b;b++)2>b%3&&(t[b]*=a);r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);this.Me=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this.Me);let w=[1,0,0,0,0,1,1,1];r.bufferData(r.ARRAY_BUFFER,new Float32Array(w),r.STATIC_DRAW);this.xd=r.createBuffer();r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.xd);
let x=[0,1,2,0,2,3];r.bufferData(r.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),r.STATIC_DRAW);t=[];x=[];w=[];let y=new Nd;for(a=0;6>a;a++){f=a%3;h=3>a?1:0;for(e=0;4>e;e++){y.x=-1;y.y=-1;y.z=1;for(b=0;b<e;b++)y.bt();w.push((0>y.x?.33:0)+.33*f,(0>y.y?0:.5)+.5*h);if(4>a)for(b=0;b<a;b++)y.Ly();else 5==a?y.Ky():y.Jy();t.push(y.x,y.y,y.z)}b=4*a;x.push(0+b,1+b,2+b,0+b,2+b,3+b)}n.B.Vl=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,n.B.Vl);r.bufferData(r.ARRAY_BUFFER,new Float32Array(t),r.STATIC_DRAW);n.B.Fj=r.createBuffer();
r.bindBuffer(r.ARRAY_BUFFER,n.B.Fj);r.bufferData(r.ARRAY_BUFFER,new Float32Array(w),r.STATIC_DRAW);n.B.Hk=r.createBuffer();r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,n.B.Hk);r.bufferData(r.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),r.STATIC_DRAW);this.Yw=r.createBuffer();this.Xw=r.createBuffer()}Bn(a){let b=this;return function(){try{if(a.Yx)return;let e=b.o.O;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1);let f=!1;null!=a.hg&&a.hg.complete?a.Jr||(e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,
e.UNSIGNED_BYTE,a.hg),f=a.Jr=!0):null!=a.ng&&a.ng.complete&&(e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.ng),f=!0);f&&(a.loaded=!0,b.o.F.pd&&("previewtrack"==b.o.F.delay||"videopano"==b.o.F.delay&&!b.o.B.j)&&b.Os()&&b.o.Hl(null));e.bindTexture(e.TEXTURE_2D,null);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0)}catch(e){}b.o.update(2)}}Qr(){let a=this.o,b=a.O;if(this.ib)for(;0<this.ib.length;)b.deleteTexture(this.ib.pop());this.ib=[];for(let h=0;6>h;h++){var e=b.createTexture();
this.re++;e.ng=null;e.hg=null;e.Jr=!1;b.bindTexture(b.TEXTURE_2D,e);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,1,1,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);if(a.hi[h]){var f=new Image;f.crossOrigin=a.crossOrigin;f.src=a.Ka(a.hi[h]);e.ng=f;f.addEventListener&&f.addEventListener("load",this.Bn(e),!1);a.wd.push(f)}this.ib.push(e)}for(e=
0;6>e;e++)a.gi[e]&&(f=new Image,f.crossOrigin=a.crossOrigin,f.src=a.Ka(a.gi[e]),f.addEventListener?f.addEventListener("load",this.Bn(this.ib[e]),!1):f.onload=this.Bn(this.ib[e]),this.ib[e].hg=f,a.wd.push(f));for(f=0;f<a.V.length;f++)a.V[f].Gd||(a.V[f].texture=b.createTexture(),a.re++,b.bindTexture(b.TEXTURE_2D,a.V[f].texture),b.texImage2D(b.TEXTURE_2D,0,b.RGB,1,1,0,b.RGB,b.UNSIGNED_BYTE,null));a.B.texture=b.createTexture();a.re++;b.bindTexture(b.TEXTURE_2D,a.B.texture);b.texImage2D(b.TEXTURE_2D,0,
b.RGB,1,1,0,b.RGB,b.UNSIGNED_BYTE,null);b.bindTexture(b.TEXTURE_2D,null)}uA(){var a=this.o;if(a.O){var b=a.O;b.useProgram(this.R);this.xh(0);b.uniform1i(this.R.rh,0);b.enableVertexAttribArray(this.R.ma);b.enableVertexAttribArray(this.R.Ia);b.bindBuffer(b.ARRAY_BUFFER,this.Me);b.vertexAttribPointer(this.R.Ia,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.xd);b.uniform1f(this.R.jm,1E-4);b.vertexAttribPointer(this.R.ma,3,b.FLOAT,!1,0,0);yd.identity(this.ab);yd.perspective(a.Gb(),
a.Za.width/a.Za.height,.1,100,this.ab);b.uniformMatrix4fv(this.R.jf,!1,this.ab);for(a=0;6>a;a++)this.xh(a),b.bindBuffer(b.ARRAY_BUFFER,this.hk),b.vertexAttribPointer(this.R.ma,3,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,this.Me),b.vertexAttribPointer(this.R.Ia,2,b.FLOAT,!1,0,0),6<=this.ib.length&&this.ib[a].loaded&&(b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,this.ib[a]),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.xd),b.uniform1i(this.R.rh,0),b.uniformMatrix4fv(this.R.Wi,!1,this.Ca),b.uniformMatrix4fv(this.R.jf,
!1,this.ab),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}}Zt(){let a=this.o;var b=this.D;b.M.ml&&6<b.M.ml.length&&(b=parseInt(b.M.ml),a.O.clearColor((b>>16&255)/255,(b>>8&255)/255,(b>>0&255)/255,1))}xh(a,b=1){const e=this.D;yd.identity(this.Ca);yd.rotate(this.Ca,b*-e.Y.m*Math.PI/180,[0,0,1]);yd.rotate(this.Ca,b*-e.u.m*Math.PI/180,[1,0,0]);-1==b?yd.rotate(this.Ca,-e.pan.m*Math.PI/180,[0,1,0]):yd.rotate(this.Ca,(180-e.pan.m)*Math.PI/180,[0,1,0]);e.ub&&(yd.rotate(this.Ca,-e.ub.pitch*Math.PI/180,
[1,0,0]),yd.rotate(this.Ca,e.ub.Y*Math.PI/180,[0,0,1]));4>a?yd.rotate(this.Ca,-Math.PI/2*a,[0,1,0]):yd.rotate(this.Ca,Math.PI/2*(5==a?1:-1),[1,0,0])}Qz(a){let b=this;return function(){b.Um.push(a)}}Mv(a){function b(){a.Hb=f.createTexture();e.o.re++;f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,1);f.bindTexture(f.TEXTURE_2D,a.Hb);try{f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,a.M)}catch(h){f.texImage2D(f.TEXTURE_2D,0,f.RGBA,1,1,0,f.RGBA,f.UNSIGNED_BYTE,new Uint8Array([128,128,128,250]))}}let e=
this;e.o.Oa=!0;e.o.ki=!0;a.loaded=!0;a.Bo=0;a.mf=0;let f=e.o.O;this.vq();null!=a.M&&a.M.complete&&("decode"in a.M?a.M.decode().then(()=>{a.M&&(a.yb=document.createElement("canvas"),a.yb.width=a.M.width,a.yb.height=a.M.height,a.le=a.yb.getContext("2d"),a.le&&a.le.drawImage(a.M,0,0),b(),a.le&&(delete a.le,a.le=null))}):b());e.o.update(2)}vq(){this.D.Hj&&this.D.Hj--}Pv(){let a=2;for(;0<this.Um.length&&0<a;){let b=this.Um.shift();this.Mv(b);a--}}Sx(a){const b=this,e=b.o;return function(){e.Oa=!0;e.ki=
!0;const f=b.D.M;try{if(null!=a&&a.complete){let h=f.levels[f.levels.length-1],n=f.lb;h.height=h.width=a.width-2*n;h.aa=h.ta=1;for(let r=0;6>r;r++){let t=new Hk(r);t.yb=document.createElement("canvas");b.o.qa?(t.yb.width=h.width+2*n,t.yb.height=h.height+2*n):(t.yb.width=f.W+2*n,t.yb.height=f.W+2*n);t.le=t.yb.getContext("2d");t.yb.style[b.o.Qe+"Origin"]="0% 0%";t.yb.style.overflow="hidden";t.yb.style.position="absolute";t.M=a;let w=h.width+2*n,x=h.height+2*n;t.le&&t.le.drawImage(a,0,r*x,w,x,0,0,w,
x);if(b.o.qa&&b.o.O){let y=b.o.O;y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,1);t.Hb=y.createTexture();b.o.re++;y.bindTexture(y.TEXTURE_2D,t.Hb);try{y.texImage2D(y.TEXTURE_2D,0,y.RGBA,y.RGBA,y.UNSIGNED_BYTE,t.yb)}catch(z){}y.bindTexture(y.TEXTURE_2D,null);y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,0)}b.o.Lh&&(t.yb.eB=-1,b.o.ja.insertBefore(t.yb,b.o.ja.firstChild));h.Qa[r]=t}h.loaded=!0;b.o.F.pd&&("previewtrack"==b.o.F.delay||"videopano"==b.o.F.delay&&!b.o.B.j)&&b.o.Hl(null)}}catch(h){}b.o.update(2)}}Qt(a){let b=
this;return function(){b.o.Oa=!0;b.o.ki=!0;b.vq();a.M=null}}sA(){let a=this.o,b=this.D;var e=b.M;let f=e.levels;if(a.O){var h=a.O;h.useProgram(this.R);h.enable(h.DEPTH_TEST);yd.identity(this.ab);yd.perspective(b.Gb(),a.Za.width/a.Za.height,.1,100,this.ab);h.uniformMatrix4fv(this.R.jf,!1,this.ab);b.gA();b.ms();var n=b.Hq();var r=f.length-1;for(b.Ee=0;r>=n;){var t=f[r],w=1;r==f.length-1&&0==e.lb&&(w=e.W/(e.W-.5));for(var x=0;6>x;x++){var y=void 0;y=b.cube.Sf[x];var z=y.aj;if(y.dc&&0<z.Qj&&0<z.$l&&0<
z.scale||t.cache){y.Oa=!1;var ab=void 0;y.bounds[r]||(y.bounds[r]={fx:0,fy:0,Wd:0,Xd:0});ab=y.bounds[r];t.cache?(ab.fx=0,ab.fy=0,ab.Wd=t.aa-1,ab.Xd=t.ta-1):b.Kw(t,z,ab);z=!0;for(var eb=ab.fy;eb<=ab.Xd;eb++)for(let db=ab.fx;db<=ab.Wd;db++){var cb=db+eb*t.aa+x*t.aa*t.ta;let bb=t.Qa[cb];bb||(bb=t.Qa[cb]=new Hk(cb));this.nk()?bb.M||(bb.mf?bb.mf--:(this.Xk(bb,t,b.Eh(x,r,db,eb)),a.Oa=!0)):b.Ee++;if(bb.Hb){if(!bb.Yf){cb=.5*r+1;bb.Yf=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,bb.Yf);let gb=[-1,-1,1,1,-1,
1,1,1,1,-1,1,1];gb[3]=db*e.W-e.lb;gb[0]=Math.min((db+1)*e.W,t.width)+e.lb;gb[7]=eb*e.W-e.lb;gb[1]=Math.min((eb+1)*e.W,t.height)+e.lb;gb[4]=gb[1];gb[6]=gb[3];gb[9]=gb[0];gb[10]=gb[7];for(let kb=0;12>kb;kb++)gb[kb]=0==kb%3?w*cb*(-2*gb[kb]/t.width+1):1==kb%3?w*cb*(-2*gb[kb]/t.height+1):cb;h.bufferData(h.ARRAY_BUFFER,new Float32Array(gb),h.STATIC_DRAW)}}else z=!1;bb.visible=y.dc}ab.es=z}}r--}for(e=0;6>e;e++)if(t=b.cube.Sf[e],t.dc)for(w=t.aj,this.xh(e),h.uniform1i(this.R.rh,0),h.uniformMatrix4fv(this.R.jf,
!1,this.ab),h.uniformMatrix4fv(this.R.Wi,!1,this.Ca),h.enableVertexAttribArray(this.R.ma),h.enableVertexAttribArray(this.R.Ia),h.bindBuffer(h.ARRAY_BUFFER,this.Me),h.vertexAttribPointer(this.R.Ia,2,h.FLOAT,!1,0,0),h.activeTexture(h.TEXTURE0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,this.xd),h.useProgram(this.R),r=n;r<=f.length-1;){x=f[r];if(t.dc&&0<w.Qj&&t.bounds[r]&&0<=t.bounds[r].fx){y=t.bounds[r];for(ab=y.fy;ab<=y.Xd;ab++)for(z=y.fx;z<=y.Wd;z++)(eb=x.Qa[z+ab*x.aa+e*x.aa*x.ta])&&eb.Hb&&(h.uniform1f(this.R.jm,
1E-4*(z%2+ab%2*2)),h.bindBuffer(h.ARRAY_BUFFER,eb.Yf),h.vertexAttribPointer(this.R.ma,3,h.FLOAT,!1,0,0),h.bindTexture(h.TEXTURE_2D,eb.Hb),this.vj(h),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)),eb.visible=t.dc;y.es&&(r=f.length)}r++}this.Fo();a.ki=!1}}vj(a){a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}nk(){return this.D.Hj<
this.D.hp}Xk(a,b,e){let f=this.D,h=this.o;f.hx++;a.M=new Image;a.Bo++;a.mf=1<<a.Bo;a.M.onload=this.Qz(a);a.M.onerror=this.Qt(a);a.M.onabort=this.Qt(a);a.M.crossOrigin=h.crossOrigin;a.M.setAttribute("src",e);b.cache&&h.wd.push(a.M);f.Hj++}ru(){let a=this.o,b=this.D;if(a.O){var e=a.O;this.Zt();e.disable(e.CULL_FACE);e.bindBuffer(e.ARRAY_BUFFER,this.ij);var f=[0,0];f[2]=a.H.width;f[3]=0;f[4]=a.H.width;f[5]=a.H.height;f[6]=0;f[7]=a.H.height;e.bufferData(e.ARRAY_BUFFER,new Float32Array(f),e.STATIC_DRAW);
b.Ee=0;this.Pm();a.B.Vc?this.ny():(e.enable(e.DEPTH_TEST),e.depthRange(0,1),e.depthFunc(e.LESS),this.El=!1,0<this.D.M.levels.length&&this.tA(),this.kb&&!this.El&&this.my())}}Pm(){const a=this.D.M;if(!this.kb||this.Ii)0<a.levels.length?this.Kv():this.Lv()}sz(a,b,e,f,h,n,r){const t=this.o;var w=this.D;h=w.M;let x=t.H;var y=e*h.W/b.width,z=(e+1)*h.W/b.width;e=f*h.W/b.height;b=(f+1)*h.W/b.height;h=.1;r&&(h=.2);this.mi&&(h=0);f=(z-y)*h;1<z&&(z=1);1<b&&(b=1);y-=f;e-=f;h=this.Ap;r=(z+f-y)/h;z=(b+f-e)/h;
b={x:0,y:0};f={x:0,y:0};a.zn=0;let ab=t.yk(),eb=new Nd,cb=this.Lx;cb.kt();4>n?cb.ad(-90*n):cb.kc(5==n?90:-90);w.ub&&(cb.ye(w.ub.Y),cb.kc(-w.ub.pitch));cb.ad(-w.pan.m);cb.kc(w.u.m);cb.ye(w.Y.m);for(n=0;n<=h;n++)for(w=0;w<=h;w++){var db=2*(y+w*r)-1;var bb=2*(e+n*z)-1;eb.x=1*db;eb.y=1*bb;eb.z=-1;eb.normalize();cb.Rx(eb);db=this.ur(eb,b,t.$());0!=t.Rc()&&1>ab&&(bb=this.ur(eb,f,t.Rc()),db&&bb?(b.x=b.x*ab+f.x*(1-ab),b.y=b.y*ab+f.y*(1-ab)):!db&&bb&&(db=!0,b.x=f.x,b.y=f.y));db||(b.x=NaN);a.Xg[a.zn++]=x.width/
2+b.x*x.width/2;a.Xg[a.zn++]=x.height/2-b.y*x.width/2}this.uz(a,h)}ur(a,b,e){let f=!0;switch(e){case 0:case 4:e=1/(a.z*this.Ao);b.x=-a.x*e;b.y=a.y*e;0<a.z&&(f=!1);break;case 9:1==a.z&&(f=!1);e=1/((1-a.z)*this.Zo);b.x=a.x*e;b.y=-a.y*e;break;case 12:if(e=Math.sqrt(a.x*a.x+a.y*a.y),0==e)b.x=0,b.y=0;else{let h=2*this.dn*Math.acos(-a.z)/e;if(2<e)return!1;b.x=h*a.x;b.y=-h*a.y}}return f}uz(a,b){let e=this.o,f=[],h;a.Ra=0;for(let r=0;r<b;r++)for(let t=0;t<b;t++){f[0]=r+t*(b+1);f[1]=r+1+t*(b+1);f[2]=r+(t+
1)*(b+1);f[3]=r+1+(t+1)*(b+1);h=!0;for(var n=0;4>n;n++)isNaN(a.Xg[2*f[0]])&&(h=!1);if(h){let w=n=!1,x=!1,y=!1;for(let z=0;4>z;z++){let ab=a.Xg[2*f[z]];ab<e.H.width&&(w=!0);0<=ab&&(n=!0);ab=a.Xg[2*f[z]+1];ab<e.H.height&&(x=!0);0<=ab&&(y=!0)}if(h=h&&w&&n&&x&&y)this.mi?(a.qb[a.Ra++]=f[0],a.qb[a.Ra++]=f[1],a.qb[a.Ra++]=f[1],a.qb[a.Ra++]=f[3],a.qb[a.Ra++]=f[3],a.qb[a.Ra++]=f[2],a.qb[a.Ra++]=f[2],a.qb[a.Ra++]=f[0],a.qb[a.Ra++]=f[3],a.qb[a.Ra++]=f[0],a.qb[a.Ra++]=f[1],a.qb[a.Ra++]=f[2]):(a.qb[a.Ra++]=f[0],
a.qb[a.Ra++]=f[3],a.qb[a.Ra++]=f[2],a.qb[a.Ra++]=f[0],a.qb[a.Ra++]=f[1],a.qb[a.Ra++]=f[3])}}}tA(){let a=this.o,b=this.D,e=b.M,f=e.levels;if(a.O){var h=a.O,n=this.Do;h.useProgram(n);this.Sl(n);h.enable(h.CULL_FACE);h.cullFace(h.FRONT);h.enable(h.STENCIL_TEST);h.stencilOp(h.KEEP,h.KEEP,h.INCR);h.stencilFunc(h.EQUAL,0,255);h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.SRC_ALPHA,h.ONE);h.enable(h.BLEND);yd.identity(this.ab);yd.perspective(a.Gb(),a.Za.width/a.Za.height,.1,100,this.ab);h.uniformMatrix4fv(h.getUniformLocation(n,
"uPMatrix"),!1,this.ab);b.Ee=0;b.ms();var r=b.Hq(),t=0;var w=f.length-1;for(var x={},y=f[w];y.lh&&0<w;)w--,y=f[w];var z=w,ab=z;for(var eb=0;6>eb;eb++)for(var cb=0;cb<y.ta;cb++)for(var db=0;db<y.aa;db++)x[db+cb*y.aa+eb*y.aa*y.ta]=1;for(;w>=r;){eb={};y=f[w];cb=null;0<w&&(cb=f[w-1]);db=!0;for(var bb in x)if(x.hasOwnProperty(bb)){var gb=Number(bb),kb=y.Qa[gb],qb=Number(Math.floor(gb/(y.aa*y.ta))),ob=Math.floor((gb-qb*y.aa*y.ta)/y.aa),pb=Math.floor(gb-(ob*y.aa+qb*y.aa*y.ta));if(6<=qb)console.log("Grrr...");
else if(b.cube.Sf[qb].Oa=!1,kb||(kb=y.Qa[gb]=new Hk(gb)),this.sz(kb,y,pb,ob,Math.max(1,this.Ap>>z-w),qb,0!=a.Rc()),kb.visible=0<kb.Ra||y.cache,kb.Qk=3,kb.Uk=Date.now(),kb.visible&&!kb.Hb&&(db=!1,this.nk()?kb.M||(kb.mf?kb.mf--:(this.Xk(kb,y,b.Eh(qb,w,pb,ob)),a.Oa=!0)):this.D.Ee++),cb&&(kb.visible||cb.cache)){gb=(pb*e.W+1)/y.width;pb=Math.min(1,((pb+1)*e.W-1)/y.width);var ub=(ob*e.W+1)/y.height;ob=Math.min(1,((ob+1)*e.W-1)/y.height);kb=e.W/cb.width;let rb=e.W/cb.height,Ab=ub;ub=Math.floor(ub*cb.height/
e.W);do{let wb=gb,Cb=Math.floor(gb*cb.width/e.W);do{let Fb=Cb+ub*cb.aa+qb*cb.aa*cb.ta;Cb<cb.aa&&ub<cb.ta&&(eb[Fb]=1);Cb++;wb+=kb}while(wb<pb);ub++;Ab+=rb}while(Ab<ob)}}db&&(ab=w,20>b.fov.m&&w<this.Lg&&(this.El=!0));x=eb;w--}this.Fo();h.uniform1i(h.getUniformLocation(n,"tileTexture"),0);h.activeTexture(h.TEXTURE0);w=r;for(r=-1;w<=Math.min(ab,this.Lg-1);){y=f[w];for(let rb in y.Qa)if(y.Qa.hasOwnProperty(rb)){eb=Number(rb);x=y.Qa[eb];z=Math.floor(eb/(y.aa*y.ta));bb=Math.floor((eb-z*y.aa*y.ta)/y.aa);
eb=Math.floor(eb-(bb*y.aa+z*y.aa*y.ta));r!=z&&(r=z,this.Jh(z,n));if(t>b.Si){this.El=!1;break}x.Hb&&(db=cb=e.W,eb==y.aa-1&&(cb=y.width-e.W*eb),bb==y.ta-1&&(db=y.height-e.W*bb),cb=(cb+2*e.lb)/e.W,db=(db+2*e.lb)/e.W,h.bindTexture(h.TEXTURE_2D,x.Hb),h.uniform2f(h.getUniformLocation(n,"uCanvasDimensions"),a.H.width,a.H.height),qb=h.getUniformLocation(n,"srcScale"),h.uniform2f(qb,.5*y.width/e.W/cb,.5*y.height/e.W/db),qb=h.getUniformLocation(n,"srcOffset"),h.uniform2f(qb,(.5*y.width+e.lb-e.W*eb)/e.W/cb,
-(.5*y.height+e.lb-e.W*bb)/e.W/db+1),qb=h.getUniformLocation(n,"zOffset"),h.uniform1f(qb,(w+1)/(f.length+5)),bb=h.getAttribLocation(n,"aVertexPosition"),h.disableVertexAttribArray(0),h.disableVertexAttribArray(1),h.disableVertexAttribArray(2),h.enableVertexAttribArray(bb),h.activeTexture(h.TEXTURE0),this.vj(h),h.bindBuffer(h.ARRAY_BUFFER,this.Yw),h.vertexAttribPointer(bb,2,h.FLOAT,!1,0,0),h.bufferData(h.ARRAY_BUFFER,new Float32Array(x.Xg),h.DYNAMIC_DRAW),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,this.Xw),
h.bufferData(h.ELEMENT_ARRAY_BUFFER,new Uint16Array(x.qb),h.DYNAMIC_DRAW),this.mi?0==w&&0==z&&h.drawElements(h.LINES,x.Ra,h.UNSIGNED_SHORT,0):h.drawElements(h.TRIANGLES,x.Ra,h.UNSIGNED_SHORT,0),t++)}w++}h.disable(h.CULL_FACE);h.cullFace(h.FRONT_AND_BACK);a.ki=!1;h.disable(h.STENCIL_TEST)}}Jh(a,b){let e=this.o.O;yd.identity(this.Ca);this.xh(a,-1);e.uniformMatrix4fv(e.getUniformLocation(b,"matRotate"),!1,this.Ca)}ny(){let a=this.o;if(a.O){var b=a.O,e=this.jj;b.useProgram(e);this.Jh(0,e);b.uniform2f(b.getUniformLocation(e,
"uCanvasDimensions"),a.H.width,a.H.height);var f=b.getUniformLocation(e,"srcOffset");b.uniform2f(f,.5,.5);1==a.B.format&&(f=b.getUniformLocation(e,"srcScale"),a.Qb?(b.uniform2f(f,-.5/Math.PI,(a.B.flipY?-.5:.5)/Math.PI),f=b.getUniformLocation(e,"srcOffset"),a.tg?b.uniform2f(f,.5,.75):b.uniform2f(f,.5,.25)):b.uniform2f(f,-.5/Math.PI,(a.B.flipY?-1:1)/Math.PI));if(15==a.B.format){f=b.getUniformLocation(e,"srcScale");let h=1;0<a.B.width&&0<a.B.height&&(h=.5*a.B.width/a.B.height);a.Qb?(b.uniform2f(f,-.5/
Math.PI,(a.B.flipY?-h:h)/Math.PI),f=b.getUniformLocation(e,"srcOffset"),a.tg?b.uniform2f(f,.25,.5):b.uniform2f(f,.75,.5)):b.uniform2f(f,-1/Math.PI,2*(a.B.flipY?-h:h)/Math.PI)}14==a.B.format&&(f=b.getUniformLocation(e,"srcScale"),b.uniform2f(f,1-2*a.B.Lf/(a.B.width/3),1-2*a.B.Lf/(a.B.height/2)));this.Sl(e);f=b.getUniformLocation(e,"cubeTexture");b.uniform1i(f,0);f=b.getAttribLocation(e,"aVertexPosition");b.disableVertexAttribArray(0);b.disableVertexAttribArray(1);b.disableVertexAttribArray(2);b.enableVertexAttribArray(f);
b.bindBuffer(b.ARRAY_BUFFER,this.ij);b.vertexAttribPointer(f,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,a.B.texture);this.vj(b);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.xd);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}Sl(a){const b=this.D;let e=this.o.O;var f=this.o.H;let h=1;switch(b.fov.mode){case 0:h=f.width/f.height;break;case 1:h=1;break;case 2:h=f.width/Math.sqrt(f.width*f.width+f.height*f.height);break;case 3:4*f.height/3<f.width&&(h=4/3)}f=e.getUniformLocation(a,
"rectDstDistance");this.Ao=Math.tan(Math.min(b.fov.m,179)/2*Math.PI/180)*h;e.uniform1f(f,this.Ao);f=e.getUniformLocation(a,"fisheyeDistance");this.dn=180/(b.fov.m*Math.PI*h);e.uniform1f(f,this.dn);f=e.getUniformLocation(a,"stereoDistance");this.Zo=Math.tan(Math.min(b.fov.m,359)/4*Math.PI/180)*h;e.uniform1f(f,this.Zo);f=e.getUniformLocation(a,"directionBlend");e.uniform1f(f,b.yk());f=e.getUniformLocation(a,"transitionBlend");e.uniform1f(f,this.kp)}my(){var a=this.o;let b=a.O;var e=this.Co;b.useProgram(e);
b.enable(b.STENCIL_TEST);b.stencilOp(b.KEEP,b.KEEP,b.INCR);b.stencilFunc(b.EQUAL,0,255);this.Jh(0,e);b.uniform2f(b.getUniformLocation(e,"uCanvasDimensions"),a.H.width,a.H.height);a=b.getUniformLocation(e,"srcScale");b.uniform2f(a,1,1);a=b.getUniformLocation(e,"srcOffset");b.uniform2f(a,0,0);a=b.getUniformLocation(e,"zOffset");b.uniform1f(a,.9999);this.Sl(e);this.Jh(0,e);a=b.getUniformLocation(e,"cubeTexture");b.uniform1i(a,0);e=b.getAttribLocation(e,"aVertexPosition");b.disableVertexAttribArray(0);
b.disableVertexAttribArray(1);b.disableVertexAttribArray(2);b.enableVertexAttribArray(e);b.bindBuffer(b.ARRAY_BUFFER,this.ij);b.vertexAttribPointer(e,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_CUBE_MAP,this.kb);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.xd);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST)}Lv(){var a,b;let e=this.o,f=e.O;if(f){f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE);var h=[1,3,5,4,0,2],n=!0,r=!0,t=!1;for(var w=0;6>w;w++)(null===(a=this.ib[w].hg)||void 0===a?0:a.complete)?this.gk[w]||(t=!0):n=!1,(null===(b=this.ib[w].ng)||void 0===b?0:b.complete)||(r=!1);if(r||n)if(!r||n||!this.kb||t){r=Math.round(e.wf/e.Fh);a=(e.wf-r)/2;this.Lg=0;this.kb||(this.kb=f.createTexture(),
e.re++);f.bindTexture(f.TEXTURE_CUBE_MAP,this.kb);f.texParameteri(f.TEXTURE_CUBE_MAP,f.TEXTURE_MIN_FILTER,f.LINEAR);f.texParameteri(f.TEXTURE_CUBE_MAP,f.TEXTURE_MAG_FILTER,f.LINEAR);f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,1);b=document.createElement("canvas");b.width=r;b.height=r;r=b.getContext("2d");for(t=0;6>t;t++)w=h[t],this.ib[w].hg.complete?this.gk[w]||(r.drawImage(this.ib[w].hg,-a,-a),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b),this.gk[w]=!0):(r.drawImage(this.ib[w].ng,
-a,-a,e.wf,e.wf),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b));this.Ii=!n}}}Kv(){var a=this.o,b=this.D.M;let e=b.levels,f=a.O;if(f){var h=e.length-1;if(!(0>h)){e[h].lh&&h--;var n=512;a.Hi?n=2<=a.devicePixelRatio?512:256:!a.ph&&2<=a.devicePixelRatio&&(n=1024);var r=f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE);for(r&&r<n&&(n=r);0<h&&e[h-1].width<=n;)h--;r=e[h];if(0!=r.aa){n=h;r=this.xv(h);this.Ii&&r&&(this.Ii=!1);r||(h=e.length-1,r||(r=this.loadLevel(h)),this.Ii=!0);
for(var t=h;t>=n;t--)this.loadLevel(t)&&(h=t);if(r){this.kb||(this.kb=f.createTexture(),a.re++);r=e[h];this.Lg>h&&(this.Lg=h);a=b.lb;t=0<a||1<r.aa||1<r.ta||h==n;let x,y=this.Rz;t&&(y||(this.Rz=y=document.createElement("canvas")),2048>r.width?1500<r.width?(y.width=2048,y.height=2048):700<r.width?(y.width=1024,y.height=1024):(y.width=512,y.height=512):(y.width=r.width,y.height=r.height),x=y.getContext("2d"));f.bindTexture(f.TEXTURE_CUBE_MAP,this.kb);f.texParameteri(f.TEXTURE_CUBE_MAP,f.TEXTURE_WRAP_S,
f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_CUBE_MAP,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,1);let z=[1,3,5,4,0,2];b=b.W;for(let ab=0;6>ab;ab++){x&&x.clearRect(0,0,y.width,y.height);for(let eb=h;eb>=n;eb--){r=e[eb];for(let cb=0;cb<r.ta;cb++)for(let db=0;db<r.aa;db++){var w=r.Qa[db+cb*r.aa+z[ab]*r.aa*r.ta];if(w){let bb=w.M;w.yb&&(bb=w.yb);bb&&0<bb.width&&(t?(w=y.width/r.width,x.drawImage(bb,w*(db*b-a),w*(cb*b-a),w*bb.width,w*bb.height)):f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+
ab,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,bb))}}}t&&f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+ab,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,y)}}}}}}loadLevel(a){let b=this.o,e=this.D,f=e.M.levels[a];if(0==f.aa)return!1;let h=!0;f.cache=!0;for(let n=0;6>n;n++)for(let r=0;r<f.ta;r++)for(let t=0;t<f.aa;t++){let w=t+r*f.aa+n*f.aa*f.ta,x=f.Qa[w];x||(x=f.Qa[w]=new Hk(w));this.nk()?x.M||(x.mf?x.mf--:(this.Xk(x,f,e.Eh(n,a,t,r)),b.Oa=!0)):e.Ee++;x.Hb||(h=!1,b.Oa=!0)}h&&(f.loaded=!0);return h}xv(a){a=this.D.M.levels[a];if(0==
a.aa)return!1;for(let b=0;6>b;b++)for(let e=0;e<a.ta;e++)for(let f=0;f<a.aa;f++){let h=a.Qa[f+e*a.aa+b*a.aa*a.ta];if(!h||!h.Hb)return!1}return a.loaded=!0}ready(){return null!=this.kb}Os(){if(this.D.vx()){var a=this.D.M;return a.levels[a.levels.length-1].loaded}for(a=0;6>a;a++)if(!this.ib[a].ng.complete)return!1;return!0}Fo(){let a=this.o,b=this.D;var e=b.M.levels;let f=a.O,h=Date.now();for(let r=e.length-1;0<=r;r--){let t=e[r];if(!t.cache)for(let w in t.Qa)if(t.Qa.hasOwnProperty(w)){var n=t.Qa[w];
0<n.Qk&&n.Qk--;n.visible||0<n.Qk?(n.visible&&(n.Uk=h),n=this.Oe.indexOf(n),-1!==n&&this.Oe.splice(n,1)):-1===this.Oe.indexOf(n)&&(n.level=t,this.Oe.push(n))}}if(this.Oe.length>1.1*b.Pt)for(this.Oe.sort(function(r,t){return t.Uk-r.Uk});this.Oe.length>b.Pt;)e=this.Oe.pop(),e.Hb&&(f.deleteTexture(e.Hb),a.re--,e.Hb=0),e.M=null,e.Yf&&(f.deleteBuffer(e.Yf),e.Yf=0),delete e.level.Qa[e.id]}kA(){let a=this.o;if(a.O){var b=this.o.O,e=this.D,f;for(f=0;f<a.V.length;f++){let h=a.V[f];if(h.Gd)continue;yd.identity(this.Ca);
yd.rotate(this.Ca,-e.Y.m*Math.PI/180,[0,0,1]);yd.rotate(this.Ca,-e.u.m*Math.PI/180,[1,0,0]);yd.rotate(this.Ca,(180-e.pan.m)*Math.PI/180,[0,1,0]);yd.rotate(this.Ca,h.pan*Math.PI/180,[0,1,0]);yd.rotate(this.Ca,-h.u*Math.PI/180,[1,0,0]);yd.translate(this.Ca,[0,0,1]);yd.rotate(this.Ca,h.Ua*Math.PI/180,[0,0,1]);yd.rotate(this.Ca,-h.Ea*Math.PI/180,[0,1,0]);yd.rotate(this.Ca,h.za*Math.PI/180,[1,0,0]);let n=Math.tan(h.fov/2*Math.PI/180),r=h.aspect;r||(r=16/9);yd.scale(this.Ca,[n,n/r,1]);yd.translate(this.Ca,
[0,0,-1]);b.bindBuffer(b.ARRAY_BUFFER,this.hk);b.vertexAttribPointer(this.R.ma,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.Me);b.vertexAttribPointer(this.R.Ia,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,h.texture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.vj(b);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.xd);b.uniform1i(this.R.rh,0);b.uniformMatrix4fv(this.R.Wi,!1,this.Ca);b.uniformMatrix4fv(this.R.jf,
!1,this.ab);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}jA(){let a=this.o,b;if(a.O){var e=a.O;e.useProgram(this.R);yd.identity(this.ab);yd.perspective(a.Gb(),a.Za.width/a.Za.height,.1,100,this.ab);e.uniformMatrix4fv(this.R.jf,!1,this.ab);this.xh(0);e.uniform1i(this.R.rh,0);e.uniformMatrix4fv(this.R.jf,!1,this.ab);e.uniformMatrix4fv(this.R.Wi,!1,this.Ca);e.enableVertexAttribArray(this.R.ma);e.enableVertexAttribArray(this.R.Ia);e.bindBuffer(e.ARRAY_BUFFER,this.Me);e.vertexAttribPointer(this.R.Ia,
2,e.FLOAT,!1,0,0);e.activeTexture(e.TEXTURE0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.xd);e.uniform1f(this.R.jm,1E-4);e.vertexAttribPointer(this.R.ma,3,e.FLOAT,!1,0,0);e.bindTexture(e.TEXTURE_2D,a.B.texture);for(b=0;1>b;b++)this.xh(0),e.bindBuffer(e.ARRAY_BUFFER,a.B.Vl),e.vertexAttribPointer(this.R.ma,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,a.B.Fj),e.vertexAttribPointer(this.R.Ia,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a.B.Hk),e.uniform1i(this.R.rh,
0),e.uniformMatrix4fv(this.R.Wi,!1,this.Ca),e.uniformMatrix4fv(this.R.jf,!1,this.ab),e.drawElements(e.TRIANGLES,36,e.UNSIGNED_SHORT,0)}}iA(){let a=this.o,b=a.O,e=a.B;if(0<a.V.length)for(var f=0;f<a.V.length;f++){let h=a.V[f];if(!h.Gd&&h.isRunning&&h.Ai!=h.j.currentTime&&(h.Ai=h.j.currentTime,!h.aspect&&0<h.j.videoHeight&&(h.aspect=h.j.videoWidth/h.j.videoHeight),a.Pj))try{h.texture&&(b.bindTexture(b.TEXTURE_2D,h.texture),b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,h.j),a.update())}catch(n){}}if(e.j&&
(f=Number(e.j.currentTime),e.Ai!=f)){e.Ai=f;try{let h=0<e.j.readyState;a.Fi&&e.Vc&&(h=h&&0<e.j.currentTime);e.texture&&e.dh&&h&&(e.Vc||this.rq(),e.Vc=!0,e.width=e.j.videoWidth,e.height=e.j.videoHeight,b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,a.B.flipY),b.bindTexture(b.TEXTURE_2D,e.texture),b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,e.j),e.gp=!0,a.update())}catch(h){}}}Js(){let a;var b;let e=this.o,f=this.o.O;e.P.Rn!=e.P.mode&&(e.P.Rn=e.P.mode);if((0<=e.P.mode||0<e.P.lc.length)&&!e.F.Jj){let t=
1;0>=e.P.mode&&(t=0);3==e.P.mode&&(t=e.P.Ja);for(a=0;a<e.L.length;a++){let w=e.L[a];if("poly"==w.type){var h=w.kh;let x=t;2==e.P.mode&&(x=w.Ja);var n=e.P.lc.indexOf(w.id);-1!=n&&(x=e.P.bd[n]);if(0<h.length){n=[];var r=e.Fa()?-e.margin.left.ba:0;let y=e.Fa()?-e.margin.top.ba:0;for(b=0;b<h.length;b++)n.push(h[b].Gc+r),n.push(h[b].jc+y),n.push(0);f.useProgram(this.we);f.enable(f.BLEND);f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.SRC_ALPHA,f.ONE);f.disable(f.DEPTH_TEST);this.vp||(this.vp=
f.createBuffer());f.bindBuffer(f.ARRAY_BUFFER,this.vp);f.bufferData(f.ARRAY_BUFFER,new Float32Array(n),f.STATIC_DRAW);f.uniform2f(f.getUniformLocation(this.we,"uCanvasDimensions"),e.H.width,e.H.height);h=f.getUniformLocation(this.we,"uColor");b=w.qc;f.uniform3f(h,(b>>16&255)/255,(b>>8&255)/255,(b&255)/255);r=f.getUniformLocation(this.we,"uAlpha");f.uniform1f(r,w.pc*x);f.vertexAttribPointer(this.we.ma,3,f.FLOAT,!1,0,0);f.drawArrays(f.LINE_LOOP,0,n.length/3);b=w.oc;f.uniform3f(h,(b>>16&255)/255,(b>>
8&255)/255,(b&255)/255);f.uniform1f(r,w.nc*x);f.enable(f.STENCIL_TEST);f.clearStencil(0);f.clear(f.STENCIL_BUFFER_BIT);f.colorMask(!1,!1,!1,!1);f.stencilFunc(f.ALWAYS,1,1);f.stencilOp(f.INCR,f.INCR,f.INCR);f.drawArrays(f.TRIANGLE_FAN,0,n.length/3);f.colorMask(!0,!0,!0,!0);f.stencilFunc(f.EQUAL,1,1);f.stencilOp(f.ZERO,f.ZERO,f.ZERO);f.drawArrays(f.TRIANGLE_FAN,0,n.length/3);f.disable(f.BLEND);f.enable(f.DEPTH_TEST);f.disable(f.STENCIL_TEST);f.useProgram(this.R)}}}}}hA(){var a=this.o,b=this.D;let e=
b.M;if(a.O){var f=a.O;f.disable(f.DEPTH_TEST);f.disable(f.CULL_FACE);f.useProgram(this.Vg);var h=f.getUniformLocation(this.Vg,"uRect");f.uniform2f(f.getUniformLocation(this.Vg,"uCanvasDimensions"),a.H.width,a.H.height);f.activeTexture(f.TEXTURE0);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,this.xd);var n=f.getAttribLocation(this.Vg,"aVertexPosition");f.disableVertexAttribArray(0);f.disableVertexAttribArray(1);f.disableVertexAttribArray(2);f.enableVertexAttribArray(n);f.bindBuffer(f.ARRAY_BUFFER,this.Me);
f.vertexAttribPointer(n,2,f.FLOAT,!1,0,0);b.Ee=0;var r=100/b.fov.m;var t=e.width/e.height;n=a.H.height*r*t;r*=a.H.height;t=(b.pan.m/100/t-.5)*n+a.H.width/2;for(var w=(b.u.m/100-.5)*r+a.H.height/2,x,y,z,ab=0;e.levels.length>=ab+2&&e.levels[ab+1].width>n;)ab++;var eb;var cb=[];for(eb=e.levels.length-1;eb>=ab;){var db=e.levels[eb];let bb;db.cache?(bb={fx:0,fy:0},bb.Wd=db.aa-1,bb.Xd=db.ta-1):(bb={},x=-w/r*(db.height/e.W),y=(-t+a.H.width)/n*(db.width/e.W),z=(-w+a.H.height)/r*(db.height/e.W),bb.fx=Math.min(Math.max(0,
Math.floor(-t/n*(db.width/e.W))),db.aa-1),bb.fy=Math.min(Math.max(0,Math.floor(x)),db.ta-1),bb.Wd=Math.min(Math.max(0,Math.floor(y)),db.aa-1),bb.Xd=Math.min(Math.max(0,Math.floor(z)),db.ta-1));cb[eb]=bb;let gb=!0;for(y=bb.fy;y<=bb.Xd;y++)for(x=bb.fx;x<=bb.Wd;x++){z=x+y*db.aa;let kb=db.Qa[z];kb||(kb=new Hk(z),db.Qa[z]=kb);this.nk()?kb.M||(this.Xk(kb,db,b.Eh(0,eb,x,y)),a.Oa=!0):b.Ee++;kb.M&&kb.M.complete||(gb=!1);kb.visible=!0}bb.es=gb;eb--}for(eb=e.levels.length-1;eb>=ab;){a=e.levels[eb];if(cb[eb]&&
0<=cb[eb].fx)for(b=cb[eb],y=b.fy;y<=b.Xd;y++)for(x=b.fx;x<=b.Wd;x++)z=x+y*a.aa,(db=a.Qa[z])&&db.M&&db.M.complete&&(f.uniform4f(h,t+(-e.lb+e.W*x)*n/a.width,w+(-e.lb+e.W*y)*r/a.height,db.M.width*n/a.width,db.M.height*r/a.height),db&&db.Hb&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,this.xd),f.bindTexture(f.TEXTURE_2D,db.Hb),this.vj(f),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)));eb--}this.Fo()}}og(){let a=this.o.O;if(a&&this.ib)for(;0<this.ib.length;){let b=this.ib.pop();b.Yx=!0;a.deleteTexture(b)}this.kb&&
(a.deleteTexture(this.kb),this.kb=null);this.Lg=1E6;this.gk=[!1,!1,!1,!1,!1,!1]}}class BC{constructor(a){this.Kj=[];this.o=a;this.enabled=!1;this.Mb=2;this.sq=!1}Fq(a){if(2==a.mode||3==a.mode||5==a.mode){var b=this.o.ha.currentTime;if(a.pb&&a.pb.gain&&a.Fb&&a.Db&&a.Eb){let e=a.Fb.gain.value,f=a.Db.gain.value,h=a.Eb.gain.value;a.pb.gain.linearRampToValueAtTime(a.pb.gain.value,b);a.pb.gain.linearRampToValueAtTime(0,b+this.Mb);a.Fb.gain.linearRampToValueAtTime(e,b);a.Fb.gain.linearRampToValueAtTime(0,
b+this.Mb);a.Db.gain.linearRampToValueAtTime(f,b);a.Db.gain.linearRampToValueAtTime(0,b+this.Mb);a.Eb.gain.linearRampToValueAtTime(h,b);a.Eb.gain.linearRampToValueAtTime(0,b+this.Mb)}}else b=this.o.ha.currentTime,a.Cb&&a.Cb.gain&&(a.Cb.gain.linearRampToValueAtTime(a.Cb.gain.value,b),a.Cb.gain.linearRampToValueAtTime(0,b+this.Mb));a.cn=!0;setTimeout(function(){a.nf()},1E3*this.Mb+5)}Jz(){for(var a=0;a<this.o.X.length;a++){let b=this.o.X[a];!b.stopped&&!this.o.isPlaying(b.id)&&-1<b.loop&&4!=b.mode&&
6!=b.mode&&(b.ua?b.ie():(b.Kd&&b.He(),b.j.play(),b.j.currentTime=0))}}Yv(){let a=(this.o.ha.currentTime-this.Ez)/this.Mb;a=Math.min(1,a);for(let b=0;b<this.o.X.length;b++){let e=this.o.X[b];this.o.isPlaying(e.id)&&1>e.wa&&(e.wa=a)}1==a&&clearInterval(this.Dz)}}class CC{constructor(a){this.Ni=[];this.Fc=[];this.rc=[];this.Hc=[];this.Qo=!0;this.o=a;this.Iv()}Di(){let a=this.o.O;var b=a.createShader(a.VERTEX_SHADER);a.shaderSource(b,"attribute vec3 aVertexPosition;\nvoid main(void) {\n gl_Position = vec4(aVertexPosition, 1.0);\n}\n");
a.compileShader(b);a.getShaderParameter(b,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(b)),b=null);var e=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec4 vColor;\nuniform vec2 uCanvasDimensions;\nuniform vec2 uFlareCenterPosition;\nuniform float uBlindingValue;\nuniform float uAspectRatio;\nvoid main(void) {\n float canvasDiag = sqrt( (uCanvasDimensions.x * uCanvasDimensions.x) + (uCanvasDimensions.y * uCanvasDimensions.y) );\n vec2 diff = uFlareCenterPosition - gl_FragCoord.xy;\n diff.y = diff.y * uAspectRatio;\n float distFromFlarePoint = sqrt( (diff.x * diff.x) + (diff.y * diff.y) );\n float factor = (distFromFlarePoint / canvasDiag) / 10.0;\n gl_FragColor = vec4(1.0, 1.0, 1.0, pow(((1.0 - factor) * 0.8) * uBlindingValue, 2.0));\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.Nc=a.createProgram();a.attachShader(this.Nc,b);a.attachShader(this.Nc,e);a.linkProgram(this.Nc);a.getProgramParameter(this.Nc,a.LINK_STATUS)||alert("Could not initialise shaders");this.Nc.ma=a.getAttribLocation(this.Nc,"aVertexPosition");a.enableVertexAttribArray(this.Nc.ma);e=a.createShader(a.VERTEX_SHADER);b=a.createShader(a.VERTEX_SHADER);a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nattribute vec3 aVertexPosition;\nvarying vec4 vColor;\nuniform vec2 uCirclePosition;\nuniform float uCircleRadius;\nuniform vec2 uCanvasDimensions2;\nuniform float uAspectRatio;\nvoid main(void) {\n vec2 circleOnScreen = aVertexPosition.xy * uCircleRadius + uCirclePosition;\n circleOnScreen.y = circleOnScreen.y / uAspectRatio;\n vec2 circleNorm = (circleOnScreen / uCanvasDimensions2) * 2.0 - vec2(1.0, 1.0);\n gl_Position = vec4(circleNorm.x, circleNorm.y, 0.0, 1.0);\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);a.shaderSource(b,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nattribute vec3 aVertexPosition;\nvarying vec4 vColor;\nuniform vec2 uCirclePosition;\nuniform float uCircleRadius;\nuniform vec2 uCanvasDimensions2;\nuniform float uAspectRatio;\nvoid main(void) {\n vec2 circleOnScreen = aVertexPosition.xy * uCircleRadius + uCirclePosition;\n circleOnScreen.y = circleOnScreen.y / uAspectRatio;\n vec2 circleNorm = (circleOnScreen / uCanvasDimensions2) * 2.0 - vec2(1.0, 1.0);\n gl_Position = vec4(circleNorm.x, circleNorm.y, 0.0, 1.0);\n}\n");
a.compileShader(b);a.getShaderParameter(b,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(b)),e=null);let f=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(f,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec4 vColor;\nuniform vec2 uCircleTexturePosition;\nuniform vec3 uCircleColor;\nuniform float uCircleRadius;\nuniform float uCircleAlpha;\nuniform float uCircleSoftness;\nuniform float uAspectRatio;\nvoid main(void) {\n vec2 diff = uCircleTexturePosition - gl_FragCoord.xy;\n diff.y = diff.y * uAspectRatio;\n float distFromCircleCenter = sqrt( (diff.x * diff.x) + (diff.y * diff.y) );\n float softnessDistance = uCircleRadius * (1.0 - uCircleSoftness);\n if (distFromCircleCenter > uCircleRadius)\n {\n\t  gl_FragColor = vec4(uCircleColor, 0.0);\n }\n else if (distFromCircleCenter <= (softnessDistance))\n {\n\t  float factor = distFromCircleCenter / softnessDistance;\n\t  gl_FragColor = vec4(uCircleColor, pow((1.0 - (0.2 * factor)) * uCircleAlpha, 1.8));\n }\n else\n {\n\t  float factor = (distFromCircleCenter - softnessDistance) / (uCircleRadius - softnessDistance);\n\t  gl_FragColor = vec4(uCircleColor, pow((0.8 - (0.8 * factor)) * uCircleAlpha, 1.8));\n }\n}\n");
a.compileShader(f);a.getShaderParameter(f,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(f)),f=null);this.Da=a.createProgram();a.attachShader(this.Da,e);a.attachShader(this.Da,f);a.linkProgram(this.Da);a.getProgramParameter(this.Da,a.LINK_STATUS)||alert("Could not initialise shaders");this.Da.ma=a.getAttribLocation(this.Da,"aVertexPosition");a.enableVertexAttribArray(this.Da.ma);e=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(e,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nvarying vec4 vColor;\nuniform vec2 uRingTexturePosition;\nuniform float uRingRadius;\nuniform float uRingAlpha;\nuniform float uAspectRatio;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec2 diff = uRingTexturePosition - gl_FragCoord.xy;\n diff.y = diff.y * uAspectRatio;\n float distFromRingCenter = sqrt( (diff.x * diff.x) + (diff.y * diff.y) );\n float factor = distFromRingCenter / uRingRadius;\n if (distFromRingCenter > uRingRadius)\n {\n\t gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);\n }\n else\n {\n vec4 textureColor = texture2D(uSampler, vec2(factor / uAspectRatio, 0.5));\n gl_FragColor = vec4(textureColor.x, textureColor.y, textureColor.z, uRingAlpha);\n }\n}\n");
a.compileShader(e);a.getShaderParameter(e,a.COMPILE_STATUS)||(alert(a.getShaderInfoLog(e)),e=null);this.Kb=a.createProgram();a.attachShader(this.Kb,b);a.attachShader(this.Kb,e);a.linkProgram(this.Kb);a.getProgramParameter(this.Kb,a.LINK_STATUS)||alert("Could not initialise shaders");this.Kb.ma=a.getAttribLocation(this.Kb,"aVertexPosition")}bg(){let a=this.o.O;this.ne=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.ne);a.bufferData(a.ARRAY_BUFFER,new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]),a.STATIC_DRAW);
this.ne.itemSize=3;this.ne.numberOfItems=4;this.Ug=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.Ug);var b=[0,0,0],e=2*Math.PI/6,f=Math.PI/180*35;let h=1;for(var n=f;n<=f+2*Math.PI;n+=e)b.push(Math.sin(n)),b.push(-Math.cos(n)),b.push(0),h++;a.bufferData(a.ARRAY_BUFFER,new Float32Array(b),a.STATIC_DRAW);this.Ug.itemSize=3;this.Ug.numberOfItems=h;this.$s=a.createTexture();a.bindTexture(a.TEXTURE_2D,this.$s);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,
a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);b=document.createElement("canvas");b.width=100;b.height=1;e=b.getContext("2d");e.width=100;e.height=1;f=e.createLinearGradient(0,0,100,0);f.addColorStop(0,this.o.Ib(0,0));f.addColorStop(.88,this.o.Ib(0,0));f.addColorStop(.9,this.o.Ib(16654848,1));f.addColorStop(.92,this.o.Ib(16776448,1));f.addColorStop(.94,this.o.Ib(4849466,1));f.addColorStop(.96,
this.o.Ib(131071,1));f.addColorStop(.98,this.o.Ib(8190,1));f.addColorStop(1,this.o.Ib(0,0));e.fillStyle=f;e.fillRect(0,0,100,1);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,b)}Fy(){for(;0<this.Ni.length;)this.Ni.pop()}Iv(){let a=[],b=[],e=[];var f={radius:14,alpha:.2,color:11390415,C:.27};a.push(f);f={radius:20,alpha:.25,color:11390415,C:.4};a.push(f);f={radius:10,alpha:.2,color:12442332,C:.6};a.push(f);f={radius:15,alpha:.2,color:11390415,C:.8};a.push(f);f={radius:10,alpha:.2,color:12442332,
C:1.5};a.push(f);f={radius:15,alpha:.2,color:11390415,C:1.8};a.push(f);f={radius:8,alpha:.2,color:12575203,J:.8,C:.7};b.push(f);f={radius:7,alpha:.4,color:12575203,J:.5,C:1.6};b.push(f);f={radius:5,alpha:.4,color:12575203,J:.6,C:.9};b.push(f);f={radius:8,alpha:.3,color:12575203,J:.4,C:1.1};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:30,alpha:.3,color:11390415,C:.5};a.push(f);f={radius:10,alpha:.3,color:11390415,C:1};a.push(f);f={radius:20,alpha:.3,color:11390415,
C:1.3};a.push(f);f={radius:10,alpha:.3,color:11390415,C:1.5};a.push(f);f={radius:15,alpha:.3,color:11390415,C:1.8};a.push(f);f={radius:10,alpha:.3,color:15506856,J:.8,C:.7};b.push(f);f={radius:20,alpha:.5,color:15506856,J:.5,C:1.6};b.push(f);f={radius:5,alpha:.5,color:15506856,J:.6,C:.9};b.push(f);f={radius:60,alpha:.4,color:15506856,J:.2,C:1.1};b.push(f);e.push({radius:220,alpha:.035,C:2});this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:30,alpha:.5,color:15465727,C:.5};a.push(f);
f={radius:40,alpha:.28,color:15726842,C:.8};a.push(f);f={radius:25,alpha:.32,color:15726842,C:1.1};a.push(f);f={radius:15,alpha:.25,color:15726842,C:1.35};a.push(f);f={radius:10,alpha:.28,color:15465727,C:1.65};a.push(f);f={radius:10,alpha:.45,color:15465727,J:.8,C:.7};b.push(f);f={radius:7,alpha:.5,color:15465727,J:.4,C:.9};b.push(f);f={radius:40,alpha:.4,color:15465727,J:.3,C:.38};b.push(f);f={radius:50,alpha:.4,color:15465727,J:.5,C:1.25};b.push(f);f={radius:18,alpha:.2,color:15465727,J:.5,C:1.25};
b.push(f);f={radius:10,alpha:.34,color:15726842,J:.8,C:1.5};b.push(f);f={radius:38,alpha:.37,color:15465727,J:.3,C:-.5};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:16,alpha:.5,color:16363159,C:.1};a.push(f);f={radius:26,alpha:.3,color:16091819,C:.32};a.push(f);f={radius:29,alpha:.2,color:16091819,C:1.32};a.push(f);f={radius:20,alpha:.18,color:16363159,C:1.53};a.push(f);f={radius:27,alpha:.13,color:16425092,C:1.6};a.push(f);f={radius:20,alpha:.1,color:16091819,
C:1.75};a.push(f);f={radius:12,alpha:.45,color:16312238,J:.45,C:.2};b.push(f);f={radius:8,alpha:.25,color:16434209,J:.7,C:.33};b.push(f);f={radius:9,alpha:.25,color:16091819,J:.4,C:.7};b.push(f);f={radius:7,alpha:.2,color:16091819,J:.4,C:.85};b.push(f);f={radius:60,alpha:.23,color:16091819,J:.55,C:1.05};b.push(f);f={radius:37,alpha:.1,color:16091819,J:.55,C:1.22};b.push(f);f={radius:10,alpha:.25,color:16363159,J:.65,C:1.38};b.push(f);f={radius:7,alpha:.2,color:16434209,J:.5,C:1.45};b.push(f);f={radius:3,
alpha:.2,color:16416033,J:.5,C:1.78};b.push(f);f={radius:6,alpha:.18,color:16434209,J:.45,C:1.9};b.push(f);f={radius:4,alpha:.14,color:16766514,J:.45,C:2.04};b.push(f);f={radius:30,alpha:.14,color:16766514,J:.8,C:.04};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:9,alpha:.3,color:14346999,J:.3,C:.3};b.push(f);f={radius:5,alpha:.5,color:14148072,J:.8,C:.6};b.push(f);f={radius:3,alpha:.37,color:14346999,J:.66,C:.8};b.push(f);f={radius:45,alpha:.2,color:14346999,
J:.36,C:1.2};b.push(f);f={radius:13,alpha:.2,color:14346999,J:.36,C:1.23};b.push(f);f={radius:11,alpha:.2,color:14148072,J:.36,C:1.28};b.push(f);f={radius:27,alpha:.16,color:14346999,J:.36,C:1.55};b.push(f);f={radius:6,alpha:.36,color:14148072,J:.8,C:1.7};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:24,alpha:.2,color:15186464,C:.2};a.push(f);f={radius:7,alpha:.26,color:15186464,C:.35};a.push(f);f={radius:23,alpha:.18,color:15186464,C:.65};a.push(f);f={radius:13,
alpha:.2,color:15186464,C:.8};a.push(f);f={radius:11,alpha:.15,color:15186464,C:1.4};a.push(f);f={radius:15,alpha:.11,color:15451904,C:1.6};a.push(f);f={radius:6,alpha:.45,color:15579138,J:.45,C:.22};b.push(f);f={radius:3,alpha:.3,color:15451904,J:.25,C:.4};b.push(f);f={radius:4,alpha:.2,color:15451904,J:.25,C:.45};b.push(f);f={radius:65,alpha:.17,color:15186464,J:.25,C:.5};b.push(f);f={radius:5,alpha:.45,color:15579138,J:.45,C:.88};b.push(f);f={radius:140,alpha:.18,color:15579138,J:.32,C:.95};b.push(f);
f={radius:12,alpha:.22,color:15579138,J:.32,C:1.1};b.push(f);f={radius:8,alpha:.32,color:15451904,J:.72,C:1.2};b.push(f);f={radius:55,alpha:.2,color:15451904,J:.45,C:1.33};b.push(f);f={radius:4,alpha:.3,color:15451904,J:.25,C:1.42};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:16,alpha:.4,color:10933495,C:.32};a.push(f);f={radius:14,alpha:.3,color:11007484,C:.36};a.push(f);f={radius:10,alpha:.3,color:4037331,C:.58};a.push(f);f={radius:14,alpha:.22,color:8835068,
C:.68};a.push(f);f={radius:10,alpha:.27,color:11007484,C:.82};a.push(f);f={radius:11,alpha:.27,color:10867450,C:1};a.push(f);f={radius:9,alpha:.2,color:6158332,C:1.05};a.push(f);f={radius:10,alpha:.17,color:10867450,C:1.78};a.push(f);f={radius:10,alpha:.3,color:4037331,C:-.23};a.push(f);f={radius:8,alpha:.45,color:8835068,J:.45,C:.175};b.push(f);f={radius:7,alpha:.4,color:12574715,J:.55,C:.46};b.push(f);f={radius:3,alpha:.3,color:10867450,J:.35,C:.5};b.push(f);f={radius:60,alpha:.37,color:4031699,
J:.75,C:.75};b.push(f);f={radius:3,alpha:.25,color:4031699,J:.25,C:.75};b.push(f);f={radius:3,alpha:.2,color:6158332,J:.25,C:.9};b.push(f);f={radius:7,alpha:.45,color:8835068,J:.45,C:1.3};b.push(f);f={radius:32,alpha:.22,color:8835068,J:.75,C:1.62};b.push(f);f={radius:9,alpha:.45,color:4031699,J:.65,C:1.6};b.push(f);f={radius:8,alpha:.25,color:4031699,J:.65,C:1.83};b.push(f);f={radius:7,alpha:.4,color:12574715,J:.55,C:-.18};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];
f={radius:16,alpha:.4,color:16389120,C:.32};a.push(f);f={radius:26,alpha:.22,color:16389120,C:.4};a.push(f);f={radius:26,alpha:.25,color:16389120,C:.65};a.push(f);f={radius:18,alpha:.3,color:16389120,C:1.23};a.push(f);f={radius:14,alpha:.26,color:16389120,C:1.33};a.push(f);f={radius:17,alpha:.18,color:16389120,C:1.7};a.push(f);f={radius:30,alpha:.16,color:16389120,C:2.15};a.push(f);f={radius:100,alpha:.25,color:16389120,J:.22,C:1.45};b.push(f);f={radius:7,alpha:.5,color:15628151,J:.3,C:1.5};b.push(f);
f={radius:3,alpha:.5,color:15628151,J:.3,C:1.52};b.push(f);f={radius:4,alpha:.5,color:16389120,J:.3,C:1.745};b.push(f);f={radius:9,alpha:.22,color:16389120,J:.3,C:1.8};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:16,alpha:.4,color:10933495,C:.32};a.push(f);f={radius:14,alpha:.3,color:11007484,C:.36};a.push(f);f={radius:10,alpha:.3,color:4037331,C:.58};a.push(f);f={radius:14,alpha:.22,color:8835068,C:.68};a.push(f);f={radius:10,alpha:.27,color:11007484,C:.82};
a.push(f);f={radius:11,alpha:.27,color:10867450,C:1};a.push(f);f={radius:9,alpha:.2,color:6158332,C:1.05};a.push(f);f={radius:10,alpha:.17,color:10867450,C:1.78};a.push(f);f={radius:10,alpha:.3,color:4037331,C:-.23};a.push(f);f={radius:8,alpha:.45,color:8835068,J:.45,C:.175};b.push(f);f={radius:7,alpha:.4,color:12574715,J:.55,C:.46};b.push(f);f={radius:3,alpha:.3,color:10867450,J:.35,C:.5};b.push(f);f={radius:60,alpha:.37,color:4031699,J:.75,C:.75};b.push(f);f={radius:3,alpha:.25,color:4031699,J:.25,
C:.75};b.push(f);f={radius:3,alpha:.2,color:6158332,J:.25,C:.9};b.push(f);f={radius:7,alpha:.45,color:8835068,J:.45,C:1.3};b.push(f);f={radius:32,alpha:.22,color:8835068,J:.75,C:1.62};b.push(f);f={radius:9,alpha:.45,color:4031699,J:.65,C:1.6};b.push(f);f={radius:8,alpha:.25,color:4031699,J:.65,C:1.83};b.push(f);f={radius:7,alpha:.4,color:12574715,J:.55,C:-.18};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:16,alpha:.4,color:16389120,C:.32};a.push(f);f={radius:26,
alpha:.22,color:16389120,C:.4};a.push(f);f={radius:26,alpha:.25,color:16389120,C:.65};a.push(f);f={radius:18,alpha:.3,color:16389120,C:1.23};a.push(f);f={radius:14,alpha:.26,color:16389120,C:1.33};a.push(f);f={radius:17,alpha:.18,color:16389120,C:1.7};a.push(f);f={radius:30,alpha:.16,color:16389120,C:2.15};a.push(f);f={radius:100,alpha:.25,color:16389120,J:.22,C:1.45};b.push(f);f={radius:7,alpha:.5,color:15628151,J:.3,C:1.5};b.push(f);f={radius:3,alpha:.5,color:15628151,J:.3,C:1.52};b.push(f);f={radius:4,
alpha:.5,color:16389120,J:.3,C:1.745};b.push(f);f={radius:9,alpha:.22,color:16389120,J:.3,C:1.8};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e);a=[];b=[];e=[];f={radius:24,alpha:.2,color:15186464,C:.2};a.push(f);f={radius:7,alpha:.26,color:15186464,C:.35};a.push(f);f={radius:23,alpha:.18,color:15186464,C:.65};a.push(f);f={radius:13,alpha:.2,color:15186464,C:.8};a.push(f);f={radius:11,alpha:.15,color:15186464,C:1.4};a.push(f);f={radius:15,alpha:.11,color:15451904,C:1.6};a.push(f);f={radius:6,
alpha:.45,color:15579138,J:.45,C:.22};b.push(f);f={radius:3,alpha:.3,color:15451904,J:.25,C:.4};b.push(f);f={radius:4,alpha:.2,color:15451904,J:.25,C:.45};b.push(f);f={radius:65,alpha:.17,color:15186464,J:.25,C:.5};b.push(f);f={radius:5,alpha:.45,color:15579138,J:.45,C:.88};b.push(f);f={radius:140,alpha:.18,color:15579138,J:.32,C:.95};b.push(f);f={radius:12,alpha:.22,color:15579138,J:.32,C:1.1};b.push(f);f={radius:8,alpha:.32,color:15451904,J:.72,C:1.2};b.push(f);f={radius:55,alpha:.2,color:15451904,
J:.45,C:1.33};b.push(f);f={radius:4,alpha:.3,color:15451904,J:.25,C:1.42};b.push(f);this.Fc.push(a);this.rc.push(b);this.Hc.push(e)}ly(){if(this.Qo){var a=this.o.O,b,e=new Nd(0,0,-100),f=this.o.oe(),h=0,n=0,r=!1,t=this.o.D;if(this.o.qa){var w=this.o.Za.width;var x=this.o.Za.height;this.o.F.Jj&&(w=this.o.F.Ub.width,x=this.o.F.Ub.height)}var y=Math.sqrt(w*w+x*x),z=y/800;for(b=0;b<this.Ni.length;b++){var ab=this.Ni[b];e.init(0,0,-100);e.za(-ab.u*Math.PI/180);e.Ea(ab.pan*Math.PI/180);e.Ea(-t.pan.m*Math.PI/
180);e.za(t.u.m*Math.PI/180);e.Ua(t.Y.m*Math.PI/180);if(-.01>e.z){n=-f/e.z;h=e.x*n;n*=e.y;var eb=Math.max(w,x);Math.abs(h)<eb/2+100&&Math.abs(n)<eb/2+100&&(r=!0,h+=w/2,n+=x/2)}if(r){this.o.qa&&(a.blendFunc(a.SRC_ALPHA,a.ONE),a.enable(a.BLEND),a.disable(a.DEPTH_TEST));eb=w/2;var cb=x/2;var db=Math.sqrt((eb-h)*(eb-h)+(cb-n)*(cb-n));var bb=y/2;eb=ab.Xp/100*((bb-db)/bb);0>eb&&(eb=0);this.o.qa&&(a.useProgram(this.Nc),a.bindBuffer(a.ARRAY_BUFFER,this.o.F.zb),a.vertexAttribPointer(this.Nc.ma,this.o.F.zb.itemSize,
a.FLOAT,!1,0,0),a.uniform2f(a.getUniformLocation(this.Nc,"uCanvasDimensions"),a.drawingBufferWidth,a.drawingBufferHeight),a.uniform2f(a.getUniformLocation(this.Nc,"uFlareCenterPosition"),a.drawingBufferWidth/w*h,x-a.drawingBufferHeight/x*n),a.uniform1f(a.getUniformLocation(this.Nc,"uBlindingValue"),eb),a.uniform1f(a.getUniformLocation(this.Nc,"uAspectRatio"),this.o.F.Jj?a.drawingBufferWidth/a.drawingBufferHeight:a.drawingBufferWidth/a.drawingBufferHeight/(w/x)),a.drawArrays(a.TRIANGLE_STRIP,0,this.o.F.zb.numberOfItems));
if(0!=Number(ab.type)&&!this.o.F.Jj){eb=w/2-h;cb=x/2-n;let ob=1,pb=Number(ab.type)-1;db<.35*bb&&(ob=db/(.35*bb),ob*=ob);db>.7*bb&&(ob=(bb-db)/(.3*bb));ob*=ab.alpha/100;if(0<this.Fc[pb].length)for(db=0;db<this.Fc[pb].length;db++){bb=this.Fc[pb][db];var gb=bb.radius*z,kb=bb.alpha*ob;0>kb&&(kb=0);var qb=bb.color;if(8==pb||9==pb||10==pb)qb=ab.color;this.o.qa&&(a.useProgram(this.Da),a.bindBuffer(a.ARRAY_BUFFER,this.Ug),a.vertexAttribPointer(this.Da.ma,this.Ug.itemSize,a.FLOAT,!1,0,0),a.uniform2f(a.getUniformLocation(this.Da,
"uCanvasDimensions2"),a.drawingBufferWidth,a.drawingBufferHeight),a.uniform2f(a.getUniformLocation(this.Da,"uCirclePosition"),a.drawingBufferWidth/w*(h+eb*bb.C),a.drawingBufferWidth/w*(x-(n+cb*bb.C))),a.uniform2f(a.getUniformLocation(this.Da,"uCircleTexturePosition"),a.drawingBufferWidth/w*(h+eb*bb.C),x-(n+cb*bb.C)),a.uniform1f(a.getUniformLocation(this.Da,"uCircleRadius"),gb),a.uniform3f(a.getUniformLocation(this.Da,"uCircleColor"),(qb>>16&255)/255,(qb>>8&255)/255,(qb&255)/255),a.uniform1f(a.getUniformLocation(this.Da,
"uCircleAlpha"),kb),a.uniform1f(a.getUniformLocation(this.Da,"uCircleSoftness"),.1),a.uniform1f(a.getUniformLocation(this.Da,"uAspectRatio"),a.drawingBufferWidth/a.drawingBufferHeight/(w/x)),a.drawArrays(a.TRIANGLE_FAN,0,this.Ug.numberOfItems))}if(0<this.rc[pb].length)for(db=0;db<this.rc[pb].length;db++){bb=this.rc[pb][db];gb=bb.radius*z;kb=bb.alpha*ob;0>kb&&(kb=0);qb=bb.color;if(8==pb||9==pb||10==pb)qb=ab.color;this.o.qa&&(a.useProgram(this.Da),a.bindBuffer(a.ARRAY_BUFFER,this.ne),a.vertexAttribPointer(this.Da.ma,
this.ne.itemSize,a.FLOAT,!1,0,0),a.uniform2f(a.getUniformLocation(this.Da,"uCanvasDimensions2"),a.drawingBufferWidth,a.drawingBufferHeight),a.uniform2f(a.getUniformLocation(this.Da,"uCirclePosition"),a.drawingBufferWidth/w*(h+eb*bb.C),a.drawingBufferWidth/w*(x-(n+cb*bb.C))),a.uniform2f(a.getUniformLocation(this.Da,"uCircleTexturePosition"),a.drawingBufferWidth/w*(h+eb*bb.C),x-(n+cb*bb.C)),a.uniform1f(a.getUniformLocation(this.Da,"uCircleRadius"),gb),a.uniform3f(a.getUniformLocation(this.Da,"uCircleColor"),
(qb>>16&255)/255,(qb>>8&255)/255,(qb&255)/255),a.uniform1f(a.getUniformLocation(this.Da,"uCircleAlpha"),kb),a.uniform1f(a.getUniformLocation(this.Da,"uCircleSoftness"),bb.J),a.uniform1f(a.getUniformLocation(this.Da,"uAspectRatio"),a.drawingBufferWidth/a.drawingBufferHeight/(w/x)),a.drawArrays(a.TRIANGLE_FAN,0,this.ne.numberOfItems))}if(0<this.Hc[pb].length)for(db=0;db<this.Hc[pb].length;db++)ab=this.Hc[pb][db],bb=ab.radius*z,gb=ab.alpha*ob,0>gb&&(gb=0),this.o.qa&&(a.useProgram(this.Kb),a.activeTexture(a.TEXTURE0),
a.bindTexture(a.TEXTURE_2D,this.$s),a.bindBuffer(a.ARRAY_BUFFER,this.ne),a.vertexAttribPointer(this.Kb.ma,this.ne.itemSize,a.FLOAT,!1,0,0),a.uniform2f(a.getUniformLocation(this.Kb,"uCanvasDimensions2"),w,x),a.uniform2f(a.getUniformLocation(this.Kb,"uCirclePosition"),h+eb*ab.C,x-(n+cb*ab.C)),a.uniform2f(a.getUniformLocation(this.Kb,"uRingTexturePosition"),a.drawingBufferWidth/w*(h+eb*ab.C),x-(n+cb*ab.C)),a.uniform1f(a.getUniformLocation(this.Kb,"uCircleRadius"),bb),a.uniform2f(a.getUniformLocation(this.Kb,
"uRingPosition"),h+eb*ab.C,x-(n+cb*ab.C)),a.uniform1f(a.getUniformLocation(this.Kb,"uRingRadius"),bb),a.uniform1f(a.getUniformLocation(this.Kb,"uRingAlpha"),gb),a.uniform1f(a.getUniformLocation(this.Kb,"uAspectRatio"),a.drawingBufferWidth/a.drawingBufferHeight/(w/x)),a.uniform1i(a.getUniformLocation(this.Kb,"uSampler"),0),a.drawArrays(a.TRIANGLE_FAN,0,this.ne.numberOfItems))}this.o.qa&&(a.useProgram(this.o.D.hh.R),a.disable(a.BLEND),a.enable(a.DEPTH_TEST))}}}}}class DC{constructor(a,b){this.o=a;this.N=
b;let e,f,h=this.__div=document.createElement("div");h.ggVisible=!0;e=document.createElement("img");let n;b.yd?(n=b.yd,e.setAttribute("style","position: absolute; width: "+b.Of+"px; height: "+b.Od+"px; top: -"+b.Od/2+"px; left: -"+b.Of/2+"px; cursor: pointer; "+a.Yb+"user-select: none; max-width: none;")):(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA5xJREFUeNqclmlIVFEUx997TjrplFQW2WKBBSYtRFlpWUILSSsRZRQIBdGHCFqIoKIvQRsUFRJC9LEgaSFbMMpcWi1pLzOLsjItKms0U5t5/c/wH7nc5o2jF374xrv87z33nHOPaRsRtbFgDpgJxoD+wATfwDNQDK6CyrCr5OcbhgiGIRsUAZt4QTWoIFXgp9JfAhY7rgdBl8NeBoLDYBloA+dBOagFTcDHcVEgDgwBGWA+OAcugvXgvb5wKMGJoAAMp9BpUA96EBf/Btsf8BI8AWfAErAcpHHDZeriliY2AVwDg8AucAQ0Ag+I4XhTm2Oxz8PT46KMbTx5EZjuJDgAnAVusJUm9DhYwalFcc59sIXXIaceFkowDySBPTRPL20xm+b7zYXa+N3CPrWJ6GuwGySA40HLBHc/GywFhbS5R1lEBrZy7FQwiSaX9pmnqeAYt+KUcew7BVZw/QKTq0ocpYPVvDOXItZCk2xgDIZqL8BR8Ab0VDbr4yZOgLeIwzQx6WiQxcCt1+6sld66L4yYtFSwF4yg2dU7/cEwGW9YVkAwmycp1dzdpvgm0DcCh4kHmxWzBls0uBX4qqmZJ4KzePm1IeJLgjmlC16aDKZpp5Q168B3o6wsSwTHgU+MIUs74RSj6y1d+212HKimJlUE+tFRfJpYtOKNXWmJTASqWf2Bu/R6+4TKHOrOzG4IhptjWgHbGkZvepQ6SQK7oRuCXzjX1DJavBEX1ygfT8FgBqpfm1zRDcEKbR2bsZlkJCdXieB1ZhZ5YtqVgXIPN+m9kbY6hpdb+d9fPncJRmZmqQheZkemJmgxyxykl3XWJEkcAl7N21s7PDcl5ZJ0PAa3wVwmWtVbZafPwQ7wLozYB7ATPNJO56d/LAikP9u+66KNJS1d4IOZp7wU0hfLukUyzgwm70T2N/DOxIy/eFdqawa5DL2NEGwP5k15Ja4woz9glvcomd9NzyvkFcQo5gomaLfm5c0svnKZ2k7q7+FauvR2MJKZR3+sY5WgtvkdG6JyELGhNHMTXyGfLviRJ5Tcd4Dlhle7086Sgp8CqVxDkn4OqHaqacr5ekjy3Q/W0FRNNGmoMtamdzdxsytZC0lqXKhEgWPVVgImg2NgFT1MHOoOk3yLEtgWN5TEOYvoIFI1rGM19//2wpAD7imF7lfwENwAxaASNCj90pcLLKdC2Iyw1M9gnEplMEp5kOU1f8WwKGJm8oUr9f8JMAAVMDM6HSDa9QAAAABJRU5ErkJggg%3D%3D",
e.setAttribute("style","position: absolute; width: 28px; height: 28px; top: -14px; left: -14px; cursor: pointer; "+a.Yb+"user-select: none; max-width: none;"));e.setAttribute("src",n);e.ondragstart=function(){return!1};h.appendChild(e);n="position:absolute;"+(a.Yb+"user-select: none;");n+=a.Yb+"touch-callout: none;";n+=a.Yb+"tap-highlight-color: rgba(0,0,0,0);";a.Pb&&!a.qa&&(n+=a.Yb+"transform: translateZ(9999999px);");h.setAttribute("style",n);h.onclick=function(){a.rf(b);a.il(a.Ma(b.url),b.target);
a.la&&a.la.hotspotProxyClick&&a.la.hotspotProxyClick(b.id,b.url);a.G("hsproxyclick",{id:b.id,url:b.url})};h.ondblclick=function(){a.la&&a.la.hotspotProxyDoubleClick&&a.la.hotspotProxyDoubleClick(b.id,b.url);a.G("hsproxydblclick",{id:b.id,url:b.url})};let r=a.P.Kl;r.enabled&&""!=b.title&&(f=document.createElement("div"),n="position:absolute;",n=b.yd?a.qn()?n+("top: -"+(b.Od/2+20)+"px;"):n+("top: "+b.Od/2+"px;"):a.qn()?n+"top:\t -50px;":n+"top:\t 20px;",n=r.Sj?n+"white-space: pre-wrap;":n+"white-space: nowrap;",
n+=a.Yb+"transform-origin: 50% 50%;",f.setAttribute("style",n+"visibility: hidden;overflow: hidden;padding: 0px 1px 0px 1px;"),f.style.color=this.o.Ib(r.Ll,r.Jl),f.style.backgroundColor=r.background?this.o.Ib(r.oc,r.nc):"transparent",f.style.border="solid "+this.o.Ib(r.qc,r.pc)+" "+r.ak+"px",f.style.borderRadius=r.xm+"px",f.style.textAlign="center",0<r.width?(f.style.left=-r.width/2+"px",f.style.width=r.width+"px"):f.style.width="auto",f.style.height=0<r.height?r.height+"px":"auto",f.style.overflow=
"hidden",f.innerHTML=a.Ma(b.title),f.classList.add("ggskin"),f.classList.add("ggdefaulthotspot"),h.addEventListener("mouseover",function(){0==r.width&&(f.style.left=-f.offsetWidth/2+"px");f.style.visibility="inherit";a.la&&a.la.hotspotProxyOver&&a.la.hotspotProxyOver(b.id,b.url);a.G("hsproxyover",{id:b.id,url:b.url})}),h.addEventListener("mouseout",function(){f.style.visibility="hidden";a.la&&a.la.hotspotProxyOut&&a.la.hotspotProxyOut(b.id,b.url);a.G("hsproxyout",{id:b.id,url:b.url})}),h.appendChild(f),
this.Tt=f);h.addEventListener("mouseover",function(){a.rf(b)});h.addEventListener("mouseout",function(){a.rf(null)})}Vw(){this.Tt&&(this.Tt.innerHTML=this.o.Ma(this.N.title))}}class gf{constructor(a,b){this.x=a;this.y=b}init(a,b){this.x=a;this.y=b}ue(a,b,e){let f=b.y-a.y;this.x=a.x+(b.x-a.x)*e;this.y=a.y+f*e}lv(a,b,e,f,h){var n=new gf;n.ue(a,e,h);a=new gf;a.ue(e,f,h);e=new gf;e.ue(f,b,h);b=new gf;b.ue(n,a,h);n=new gf;n.ue(a,e,h);a=new gf;a.ue(b,n,h);this.x=a.x;this.y=a.y}wm(a,b,e,f,h){let n=new gf,
r=.5,t=.25,w;do n.lv(a,b,e,f,r),w=n.x-h,r=0<w?r-t:r+t,t/=2;while(.01<Math.abs(w));this.x=n.x;this.y=n.y}}class EC{constructor(){this.aj={si:1,ti:1,Pi:0,Qi:0,Qj:0,$l:0,scale:1};this.dc=!0;this.bounds=[]}}class FC{constructor(){let a;this.Sf=Array(6);for(a=0;6>a;a++)this.Sf[a]=new EC}checkVisibility(a,b,e,f){for(let n=0;6>n;n++){let r;if(r=this.Sf[n]){let t;t=[];t.push(new Nd(-1,-1,-1,0,0));t.push(new Nd(1,-1,-1,1,0));t.push(new Nd(1,1,-1,1,1));t.push(new Nd(-1,1,-1,0,1));for(var h=0;h<t.length;h++)4>
n?t[h].Ea(-Math.PI/2*n):t[h].za(Math.PI/2*(4===n?-1:1)),f&&(t[h].Ua(f.Y*Math.PI/180),t[h].za(-f.pitch*Math.PI/180)),t[h].Ea(-a*Math.PI/180),t[h].za(b*Math.PI/180),t[h].Ua(e*Math.PI/180);r.dc=0<t.length}}}}class Ux{constructor(a){this.pan={m:0,Wa:0,min:0,max:360,d:0,eo:0,Zb:0,open:0};this.u={m:0,Wa:0,min:-90,max:90,d:0,Zb:0,open:0};this.Y={m:0,Wa:0,min:-180,max:180,d:0,open:0};this.jd={pan:0,u:-90,Y:0,fov:170,vb:9};this.fov={m:70,Wa:70,min:1,Ti:0,max:170,Xn:360,Yn:270,prev:0,d:0,hd:{enabled:!1,x:0,
y:0},mode:0,Kt:0,tq:0,open:0};this.cube=new FC;this.hh=null;this.ub={Y:0,pitch:0};this.tg=this.Qb=!1;this.kl=this.Is=4;this.nd=this.Hs=this.io=0;this.M=new AC;this.Si=200;this.Hj=0;this.hp=5;this.Ee=0;this.Pt=50;this.hx=0;this.B={src:[],Lf:4,width:640,height:480,Vc:!1,dh:!1,Gl:!0,Fl:!1,Re:"loop",Il:"",j:null,gp:!1,texture:null,Vl:null,Fj:null,Hk:null,format:1,Ai:0,flipY:1,jb:function(){return 0},Jo:function(){},loop:function(){return!1}};this.fg={pan:-1,u:-1,fov:-1};this.Sn=0;this.gi=[];this.Qm="";
this.hi=[];this.Fh=this.wf=1;this.qo=new Gk;this.o=a}sa(){this.o.sa(!1)}update(){this.o.update()}pe(){return this.pan.m}wk(){let a=this.pan.m;if(!this.Fa()){for(;-180>a;)a+=360;for(;180<a;)a-=360}return a}qe(){let a=this.pan.m-this.pan.eo;if(!this.Fa()){for(;-180>a;)a+=360;for(;180<a;)a-=360}return a}Zd(a){this.sa();isNaN(a)||(this.pan.m=Number(a));this.update()}nj(a){this.sa();isNaN(a)||(this.pan.m=Number(a)+this.pan.eo);this.update()}bi(a,b){isNaN(a)||(this.Zd(this.pe()+a),b&&(this.pan.d=a))}Cm(a,
b){this.bi(a*this.ri(),b)}ri(){return Math.min(1,2*Math.tan(Math.PI*Math.min(this.fov.m,90)/360))}Vf(){return this.u.m}$d(a){this.sa();isNaN(a)||(this.u.m=Number(a));this.update()}ci(a,b){this.$d(this.Vf()+a);b&&(this.u.d=a)}Em(a,b){this.ci(a*this.ri(),b)}uh(a){this.sa();isNaN(a)||(this.Y.m=Number(a));this.update()}zk(){return this.Y.m}Cd(){return this.fov.m}Lb(a){this.sa();switch(this.$()){case 4:var b=170;break;case 12:b=360;break;case 9:b=355;break;default:b=170}this.Fa()&&(b=9999999999);return!isNaN(a)&&
0<a&&a<b&&(b=this.fov.m,this.fov.m=1*a,b!=this.fov.m)?(this.update(),!0):!1}Lo(a){0<=a&&4>a&&(this.fov.mode=Number(a),this.ke(),this.update())}Fa(){return 2==this.nd}vx(){return 0<this.M.levels.length}ai(a,b){return this.Lb(this.Cd()+a)?(b&&(this.fov.d=a),!0):!1}bk(a,b){if(!isNaN(a)){let e;e=a/90*Math.cos(Math.min(this.fov.m,90)*Math.PI/360);e=this.fov.m*Math.exp(e);this.Lb(e);b&&(this.fov.d=a)}}Bl(a,b){this.sa();isNaN(a)||(this.pan.m=Number(a));isNaN(b)||(this.u.m=Number(b));this.update()}Po(a,b,
e){this.sa();!isNaN(a)&&1E7>a&&-1E7<a&&(this.pan.m=Number(a));!isNaN(b)&&1E7>b&&-1E7<b&&(this.u.m=Number(b));!isNaN(e)&&1E7>e&&-1E7<e&&(this.Y.m=Number(e));this.update()}th(a,b,e){this.sa();isNaN(a)||(this.pan.m=Number(a));isNaN(b)||(this.u.m=Number(b));isNaN(e)||this.Lb(e);this.update()}vl(){this.th(this.pan.Wa,this.u.Wa,this.fov.Wa)}oe(){return Number(this.o.H.height)/(2*Math.tan(Math.PI/180*(this.Gb()/2)))}Sd(a,b,e){var f=this.o;a||(a=f.da.x,b=f.da.y);if(this.Fa())e=this.fov.m/f.H.height,a=-(a-
f.H.width/2)*e+this.pan.m,b=-(b-f.H.height/2)*e+this.u.m;else{f=new Nd(0,0,1);b=this.xk(a,b);f.kc(-b.tilt);f.ad(b.pan);f.kc(-this.u.m);f.ad(-this.pan.m);e||(f.kc(-this.ub.pitch),f.ye(this.ub.Y));for(a=f.Ff()-180;-180>a;)a+=360;b=f.Gf()}e={};e.pan=a;e.tilt=b;return e}xk(a,b){var e=this.o;a||(a=e.da.x,b=e.da.y);var f=e.H;e=f.height/(2*Math.tan(this.Gb()*Math.PI/360));a-=f.width/2;b-=f.height/2;f={};f.pan=180*Math.atan(a/e)/Math.PI;f.tilt=180*Math.atan(-b/Math.sqrt(a*a+e*e))/Math.PI;return f}bb(a,b,
e){let f=b?Number(b):0;if(0!=a&&4!=a&&12!=a&&9!=a)this.o.Rb("Unsupported projection type: "+a);else if(b&&0!==f&&4!==f&&12!==f&&9!==f)this.o.Rb("Unsupported projection2 type: "+f);else if(a==f&&(f=0),this.Hs=e?Number(e):1,this.kl!=a||this.io!=f)this.kl=a,this.io=f,this.hh.Ik()}$(){return 0==this.kl?4:this.kl}Rc(){return this.io}xi(){return this.Is}yk(){return this.Hs}aspect(){return this.o.H.width/this.o.H.height}Vr(){return 4==this.$()&&0==this.Rc()}Gb(a,b){a||(a=this.fov.m);b||(b=this.$());return this.Kg(b,
1/this.Jq(this.o.H),a)}Kg(a,b,e){return this.Fa()?b*e:4==a?360*Math.atan(b*Math.tan(e/2*Math.PI/180))/Math.PI:9==a?720*Math.atan(b*Math.tan(e/4*Math.PI/180))/Math.PI:b*e}nn(a,b){a||(a=this.Gb());b||(b=this.$());return this.Kg(b,this.aspect(),a)}ln(a,b){a||(a=this.Gb());b||(b=this.$());let e=this.aspect();e=Math.sqrt(1+e*e);return this.Kg(b,e,a)}$p(a){var b;b||(b=this.$());return this.Kg(b,this.Jq(this.o.H),a)}Jq(a){let b=1;switch(this.fov.mode){case 0:b=1;break;case 1:b=a.width/a.height;break;case 2:b=
Math.sqrt(a.width*a.width+a.height*a.height)/a.height;break;case 3:b=4*a.height/3>a.width?1:3*a.width/(4*a.height)}return b}rj(a){this.Lb(this.$p(a))}Mo(a){let b=this.$(),e=1/this.aspect();this.rj(this.Kg(b,e,a))}Ko(a){let b=this.$(),e=this.aspect();e=1/Math.sqrt(1+e*e);this.rj(this.Kg(b,e,a))}ke(){if(!this.o.zf){var a=this.qo;a.pan=this.pan.m;a.u=this.u.m;a.fov=this.fov.m;this.Ig(a);this.Ig(a);this.Ig(a);this.pan.m=a.pan;this.u.m=a.u;this.fov.m!=a.fov&&(this.fov.m=a.fov);this.o.G("checklimits",{pan:a.pan,
tilt:a.u,fov:a.fov})}}Ig(a){var b=this.aspect();var e=this.o.H;var f=this.o;let h=f.A;if(this.Fa()){if(0<this.fov.Ti){var n=this.wf;this.M.levels&&0<this.M.levels.length&&(n=this.M.levels[0].height);10<n&&(this.fov.min=100*e.height/(n*this.fov.Ti))}n=a.fov/2;e=n*b;var r=this.M.width/this.M.height*50;b=f.K.et?2*Math.min(50,r/b):2*Math.max(50,r/b);a.fov<this.fov.min&&(a.fov=this.fov.min);a.fov>b&&(a.fov=b);50<n?a.u=0:(50<a.u+n&&(a.u=50-n),-50>a.u-n&&(a.u=-50+n));e>r?a.pan=0:(a.pan+e>r&&(a.pan=r-e,f.A.active&&
(f.A.speed=-f.A.speed,this.pan.d=0)),a.pan-e<-r&&(a.pan=-r+e,h.active&&(h.speed=-h.speed,this.pan.d=0)))}else{0<this.fov.Ti&&(n=this.wf,this.M.levels&&0<this.M.levels.length&&(n=this.M.levels[0].height),10<n&&(this.fov.min=360*Math.atan2(e.height/2,n/2*this.fov.Ti)/Math.PI));a.fov<this.fov.min&&(a.fov=this.fov.min);r=this.fov.max;var t=179;n=this.Gb()/2;e=b*n;4==this.$()?e=180*Math.atan(b*Math.tan(n*Math.PI/180))/Math.PI:9==this.$()?(r=this.fov.Yn,t=355):12==this.$()&&(r=this.fov.Xn,t=360);f.qa||
(r=Math.max(160,r));a.fov>r&&(a.fov=r);12==this.$()&&(2*e>t&&(a.fov=t/b),n=this.Gb()/2,2*n>t&&(a.fov=t),n=this.Gb()/2,e=b*n);2*n>this.u.max-this.u.min&&180>this.u.max-this.u.min&&(n=(this.u.max-this.u.min)/2,a.fov=this.$p(2*n));90>this.u.max?a.u+n>this.u.max&&(a.u=this.u.max-n):a.u>this.u.max&&(a.u=this.u.max);-90<this.u.min?a.u-n<this.u.min&&(a.u=this.u.min+n):a.u<this.u.min&&(a.u=this.u.min);f=this.pan.max-this.pan.min;359.99>f&&(a.pan<this.pan.min&&a.pan+360<this.pan.max&&(a.pan+=360),this.pan.m>
this.pan.max&&a.pan-360>this.pan.min&&(a.pan-=360),b=90,r=Math.tan(n*Math.PI/180),t=Math.tan((Math.abs(a.u)+n)*Math.PI/180),t=Math.sqrt(t*t+1)/Math.sqrt(r*r+1),n=180*Math.atan(t*Math.tan(e*Math.PI/180))/Math.PI,2*n>f&&(t=Math.tan(f*Math.PI/360)/Math.tan(e*Math.PI/180),f=t*Math.sqrt(r*r+1),t=Math.sqrt(f*f-1),b=180/Math.PI*Math.atan(t)),a.pan+n>this.pan.max&&(a.pan=this.pan.max-n,h.active&&(h.speed=-h.speed,this.pan.d=0)),a.pan-n<this.pan.min&&(a.pan=this.pan.min+n,h.active&&(h.speed=-h.speed,this.pan.d=
0)),a.u+e>b&&(a.u=b-e),a.u-e<-b&&(a.u=-b+e))}}Eh(a,b,e,f,h){let n=this.M.Un-1-b,r=this.M.Vn,t="x";switch(a){case 0:t="f";break;case 1:t="r";break;case 2:t="b";break;case 3:t="l";break;case 4:t="u";break;case 5:t="d";break;case "vr":t="vr"}h&&(a+="l",t+="l");h=this.o.Ws;for(let w=0;3>w;w++)r=h(r,"c",a),r=h(r,"s",t),r=h(r,"r",b),r=h(r,"l",n),r=h(r,"x",e),r=h(r,"y",f),r=h(r,"v",f),r=h(r,"h",e);return this.o.Ka(r)}Kw(a,b,e){e.fx=a.width/this.M.W*b.si;e.fy=a.height/this.M.W*b.ti;e.Wd=a.width/this.M.W*
b.Pi;e.Xd=a.height/this.M.W*b.Qi;e.fx=Math.min(Math.max(0,Math.floor(e.fx)),a.aa-1);e.fy=Math.min(Math.max(0,Math.floor(e.fy)),a.ta-1);e.Wd=Math.min(Math.max(0,Math.floor(e.Wd)),a.aa-1);e.Xd=Math.min(Math.max(0,Math.floor(e.Xd)),a.ta-1)}gA(){if(!(6>this.cube.Sf.length))for(let e=0;6>e;e++){var a=void 0;a=this.cube.Sf[e];let f;f=[];f.push(new Nd(-1,-1,-1,0,0));f.push(new Nd(1,-1,-1,1,0));f.push(new Nd(1,1,-1,1,1));f.push(new Nd(-1,1,-1,0,1));for(var b=0;4>b;b++)4>e?f[b].Ea(-Math.PI/2*e):f[b].za(Math.PI/
2*(4==e?-1:1)),this.ub&&(f[b].Ua(this.ub.Y*Math.PI/180),f[b].za(-this.ub.pitch*Math.PI/180)),f[b].ad(-this.pan.m),f[b].kc(this.u.m),f[b].ye(this.Y.m);f=this.o.Hm(f);a.dc=0<f.length;if(a.dc){a=a.aj;a.si=f[0].Jd;a.Pi=f[0].Jd;a.ti=f[0].v;a.Qi=f[0].v;for(b=1;b<f.length;b++)a.si=Math.min(a.si,f[b].Jd),a.Pi=Math.max(a.Pi,f[b].Jd),a.ti=Math.min(a.ti,f[b].v),a.Qi=Math.max(a.Qi,f[b].v);a.Qj=a.Pi-a.si;a.$l=a.Qi-a.ti;a.scale=Math.max(a.Qj,a.$l)}else a.aj.Qj=-1,a.aj.$l=-1}}ms(){for(var a=0;a<this.M.levels.length;a++){let e=
this.M.levels[a];for(var b in e.Qa)e.Qa.hasOwnProperty(b)&&(e.Qa[b].visible=!1)}}Hq(){let a=0,b=this.o.H,e=Math.tan(Math.min(this.Gb(),175)*Math.PI/360),f=b.height/(2*e);f*=1+b.width/b.height*e/2;for(f*=Math.pow(2,1<this.o.devicePixelRatio?this.M.gs:this.M.fs);this.M.levels.length>=a+2&&!this.M.levels[a+1].lh&&this.M.levels[a+1].width>f;)a++;return a}ty(){if(this.o.K.ct&&this.o.K.uc){var a=this.qo;a.pan=this.pan.m;a.u=this.u.m;a.fov=this.fov.m;this.Ig(a);this.Ig(a);this.Ig(a);let b=a.pan-this.pan.m,
e=a.u-this.u.m;a=a.fov-this.fov.m;if(0!=b||0!=e||0!=a){let f;f=.2+.9*Math.min((Math.abs(b)+Math.abs(e)+Math.abs(a))/Math.abs(Math.min(this.fov.m,90))*.3,1);this.pan.m+=b*f;this.u.m+=e*f;this.fov.m+=a*f;this.o.ra.Io=.3;this.update()}else this.o.ra.Io=0}else this.ke();if(isNaN(this.pan.m)||1E7<this.pan.m||-1E7>this.pan.m)this.pan.m=0;if(isNaN(this.u.m)||1E7<this.u.m||-1E7>this.u.m)this.u.m=0;if(isNaN(this.Y.m)||1E7<this.Y.m||-1E7>this.Y.m)this.Y.m=0;if(!this.Fa()){for(;360<this.pan.m;)this.pan.m-=360;
for(;-360>this.pan.m;)this.pan.m+=360}}}var GC=Vb(768),Um=Vb.n(GC);class vj extends nf{Uw(){return this.O}constructor(a,b){super(a,b);this.D=new Ux(this);this.nd=0;this.H={width:10,height:10};this.Rm=new Nd;this.crossOrigin="anonymous";this.re=this.Cg=0;this.qu={};this.tg=this.Qb=!1;this.pa={start:{x:0,y:0},oa:{x:0,y:0},ve:{x:0,y:0},m:{x:0,y:0},na:{x:0,y:0}};this.U={md:!1,Ad:!1,Lk:function(){return this.Ad||this.md},Iq:0,startTime:0,start:{x:0,y:0},oa:{x:0,y:0},ve:{x:0,y:0},m:{x:0,y:0},na:{x:0,y:0},
cj:!1,Bh:null};this.Te=this.me=!0;this.ra={enabled:!0,oa:{x:0,y:0},na:{x:0,y:0},Io:0,fov:{active:!1,sc:0,center:{enabled:!1,x:0,y:0}}};this.rb={alpha:0,beta:0,gamma:0,orientation:0,kg:0,kj:!0,fadeIn:0};this.Ci={alpha:0,beta:0,gamma:0,orientation:0};this.B={src:[],Lf:4,width:640,height:480,Vc:!1,dh:!1,Gl:!0,Fl:!1,level:1,Re:"loop",Il:"",j:null,gp:!1,texture:null,Vl:null,Fj:null,Hk:null,format:1,Ai:0,flipY:1,jb:function(){return 0},Jo:function(){},loop:function(){return!1}};this.control=this.T=this.Oc=
this.Na=this.ja=null;this.wd=[];this.Oa=!1;this.Pe=1;this.ca=null;this.Ie=this.Df=this.se=!1;this.Zh=0;this.fe=.02;this.qm=0;this.rm=!1;this.pm=this.Yj=this.$h=this.Cf=this.Sp=0;this.Qp=-1;this.Cc="";this.Go=this.pf=!1;this.gi=[];this.Qm="";this.hi=[];this.Fh=this.wf=1;this.ph=!1;this.A={enabled:!1,timeout:5,active:!1,zh:!1,speed:.4,Ml:0,Mr:!1,fl:0,Cs:!0,gh:"",Bs:!1,yg:!1,rd:!1,Zj:"",kq:!1,ge:"Animation01",Dg:!1,cl:!1,bp:!1,startTime:0,Ed:0,pi:!1,ik:!1,Vk:0,Ud:0,Li:0,Mi:0,Ki:0,$r:0};this.I={active:!1,
aborted:!1,speed:.1,pan:0,u:0,Y:0,fov:70,Cj:70,Li:0,Mi:0,cs:0,Ki:0,vb:0,fj:0,lastTime:0,rp:!1,fh:!1,Pp:0,Op:0,Gk:!1};this.Wl=null;this.Sn=0;this.Ne=[];this.Rp={};this.xc={};this.Xc={};this.eh={};this.L=[];this.At=!1;this.X=[];this.V=[];this.$a=[];this.Vb=[];this.yf=[];this.eb=[];this.Aa=[];this.sg=[];this.lf=this.Xb=null;this.ea=[];this.ky={target:0,current:0,Md:.01,delay:2,Xm:0,jk:!1,jv:!1};this.K={Oi:!1,Ix:!1,wc:!1,gf:!1,uc:!0,Rr:!1,Vo:1,ct:!1,Ge:!0,Tm:!0,Km:!0,Lm:!0,lq:!1,Dk:!1,et:!0,sensitivity:8};
this.ki=!0;this.Pj=this.Mh=this.Lh=this.zf=this.sp=this.qa=!1;this.mA=!0;this.Dn=this.nA=!1;this.en=!0;this.Oh=this.An=this.Cn=!1;this.ju=!0;this.Yb="";this.Pc="transition";this.Qe="transform";this.mk="perspective";this.Za={width:0,height:0};this.Mq=new Nd;this.Lq=new Nd;this.Nq=new Nd;this.Oq=new Nd;this.Kq=new Nd;this.Dd=!1;this.cd=this.Zr=this.va="";this.Xl=[];this.bo=[];this.yn=!1;this.Oj=!0;this.ia=this.F=null;this.di=!1;this.cb=null;this.Ha={enabled:!1,speed:1,running:!1,finished:!0,Qd:{pan:0,
u:0,fov:0,vb:0,iu:!1}};this.Wc=null;this.ei=function(f,h){if(0==f.length)return f;let n,r,t,w,x,y,z,ab;ab=[];n=h.pl(f[0])-0;for(w=0;w<f.length;w++){y=w;z=w+1;z==f.length&&(z=0);r=h.pl(f[z])-0;if(0<=n&&0<=r)ab.push(f[y]);else if(0<=n||0<=r)t=r/(r-n),0>t&&(t=0),1<t&&(t=1),x=new Nd,x.ue(f[y],f[z],t),0>n||ab.push(f[y]),ab.push(x);n=r}return ab};this.qo=new Gk;this.Ol=1;this.Tk=-1;this.el=1;this.gn=this.$m=this.zo=this.rl=0;this.Yr=!1;this.Rd=!0;this.qz();this.Gp="aHR0cHM6Ly9wYW5vMnZyLmNvbQ==";this.Hp=
"Q3JlYXRlZCB3aXRoIFBhbm8yVlI=";this.Dn=Jv();this.qa=Kv();this.Lh=this.Dn;this.qa&&(this.Lh=!1);this.pf=!0;this.Go=!1;if(this.Uc||this.Ei)this.pt(80),this.D.hp=2;var e="Pano2VR player "+this.wn();this.Zf()&&(e+=", THREEjs 163");this.Ir()&&(e+=", HSL.js");e+=", "+(this.Dn?"CSS 3D available":"CSS 3D not available");e+=", "+(this.qa?(this.sp?"WebGL2":"WebGL")+" available":"WebGL not available");this.Rb(e);this.addListener("languagechanged",()=>{this.sv();this.tv()});document.addEventListener("visibilitychange",
()=>{});this.Xa=new Tm(this);this.Xa.af=!1;7<this.Yk.length&&(e=vj.ji("bG9n"),window[vj.ji("Y29uc29sZQ==")][e](vj.uq(this.Yk)));this.rf(this.Xa);this.Dv();this.Oj=this.Tr?this.Pb&&this.tl&&10<=Number(this.Tb)?!0:!1:!0;b&&b.hasOwnProperty("webGLFlags")&&b.webGLFlags&&(this.qu=b.webGLFlags);this.Wc=new CC(this);this.userdata=this.zg=this.Rg();this.emptyHotspot=this.Xa;this.mouse=this.da;this.F=new MB(this);this.cb=new BC(this);this.Om(a);this.ea.push(new Tx(this,this.D));this.ea.push(new Tx(this,new Ux(this)));
this.ka=new zC(this);this.hv();this.sa(!1);this.qd()}wn(a){return-99991===a?this.Ax:"7.1.10/21009"}Nm(){this.F.enabled=this.ia.enabled;this.F.type=this.ia.type;this.F.fa=this.ia.zoomin;this.F.dd=this.ia.zoomout;this.F.Mf=this.ia.blendtime;this.F.Rh=this.ia.zoomoutpause;this.F.em=this.ia.zoomfov;this.F.cm=this.ia.zoomafterinfov;this.F.dm=this.ia.zoomafteroutfov;this.F.Sh=this.ia.zoomspeed;this.F.Eg=this.ia.blendcolor;this.F.od=this.ia.softedge;this.ia=null}hz(a){this.ia={};this.ia.enabled=!0;
this.ia.type=this.F.type;this.ia.zoomin=this.F.fa;this.ia.zoomout=this.F.dd;this.ia.blendtime=this.F.Mf;this.ia.zoomoutpause=this.F.Rh;this.ia.zoomfov=this.F.em;this.ia.zoomafterinfov=this.F.cm;this.ia.zoomafteroutfov=this.F.dm;this.ia.zoomspeed=this.F.Sh;this.ia.blendcolor=this.F.Eg;this.ia.softedge=this.F.od;if(a.hasOwnProperty("type")){var b=a.type;"cut"==b||"crossdissolve"==b||"diptocolor"==b||"irisround"==b||"irisroundcenter"==b||"irisrectangular"==b||"irisrectangularcenter"==b||"wipeleftright"==
b||"wiperightleft"==b||"wipetopbottom"==b||"wipebottomtop"==b||"wiperandom"==b||"mesh"==b?this.ia.type=b:this.Rb("unknown transition type")}a.hasOwnProperty("before")&&(b=Number(a.before),0==b||2==b||6==b||7==b)&&(this.ia.zoomin=b);a.hasOwnProperty("after")&&(b=Number(a.after),0==b||2==b||3==b||4==b)&&(this.ia.zoomout=b);a.hasOwnProperty("transitiontime")&&(b=Number(a.transitiontime),0<=b&&50>=b&&(this.ia.blendtime=b));a.hasOwnProperty("waitfortransition")&&(this.ia.zoomoutpause=1==a.waitfortransition);
a.hasOwnProperty("zoomedfov")&&(b=Number(a.zoomedfov),.01<=b&&50>=b&&(this.ia.zoomfov=b));a.hasOwnProperty("zoomafterinfov")&&(b=Number(a.zoomafterinfov),70<=b&&120>=b&&(this.ia.zoomafterinfov=b));a.hasOwnProperty("zoomafteroutoutfov")&&(b=Number(a.zoomafteroutfov),.01<=b&&70>=b&&(this.ia.zoomafteroutfov=b));a.hasOwnProperty("zoomspeed")&&(b=Number(a.zoomspeed),.01<=b&&99>=b&&(this.ia.zoomspeed=b));a.hasOwnProperty("dipcolor")&&(this.ia.blendcolor=a.dipcolor);a.hasOwnProperty("softedge")&&(a=Number(a.softedge),
0<=a&&1E3>=a&&(this.ia.softedge=a));this.di||this.Nm()}bb(a,b,e){this.D.bb(a,b,e)}$(){return this.D.$()}xi(){return this.D.xi()}Rc(){return this.D.Rc()}yk(){return this.D.yk()}Dm(a,b){if(0!=a&&4!=a&&12!=a&&9!=a)this.Rb("Unsupported projection type: "+a);else if(this.qa||0==a||4==a||this.Rb("Projection changes require WebGL!"),this.$()!=a){let e={};const f=this.D;e.pan=f.pan.m;e.tilt=f.u.m;e.fov=f.fov.m;e.projection=a;e.timingFunction=3;e.speed=b;a=this.ui(a);e.fov=Math.min(a,e.fov);this.Vi(e)}}Dv(){if(!this.ha){try{window.AudioContext=
window.AudioContext||window.webkitAudioContext,this.ha=new AudioContext}catch(a){this.ha=null}this.Pb&&(!this.tl||9>Number(this.Tb))&&(this.ha=null);this.Pb&&!this.Uc&&12<=Number(this.Tb)&&13>Number(this.Tb)&&(this.ha=null);this.Pb&&this.Uc&&13==Number(this.cf[0])&&(1==Number(this.cf[1])||2<=Number(this.cf[1]))&&(this.ha=null)}}pt(a){this.D.Si=a}nw(){return this.Dd}Bw(){return this.Dd?this.kr().length:1}lw(){return this.A.active}vi(){return this.isLoaded}ar(){return!this.isLoaded}oe(){return this.D.oe()}tj(a,
b){try{this.vc&&(a=window.innerWidth,b=window.innerHeight);let n=a-this.margin.left.ba-this.margin.right.ba,r=b-this.margin.top.ba-this.margin.bottom.ba;if(!(10>n||10>r)){var e=window.devicePixelRatio||1;this.ph&&(e=1);this.ja.style.width=n+"px";this.ja.style.height=r+"px";this.ja.style.left=this.margin.left.ba+"px";this.ja.style.top=this.margin.top.ba+"px";if(this.qa)try{this.Na&&(this.Na.style.position="absolute",this.Na.style.display="inline",this.Na.style.width=n+"px",this.Na.style.height=r+"px",
this.Na.width=n*e,this.Na.height=r*e),this.O&&(this.Za.width=n*e,this.Za.height=r*e,this.O.viewport(0,0,this.O.drawingBufferWidth,this.O.drawingBufferHeight))}catch(t){alert(t)}this.Oc&&(this.Oc.style.width=a+"px",this.Oc.style.height=b+"px",this.Oc.width=a,this.Oc.height=b);this.ya&&(this.ya.style.width=a+"px",this.ya.style.height=b+"px",this.ca&&this.ca!=this.ya&&(this.ca.style.width=a+"px",this.ca.style.height=b+"px"));this.se&&(this.Oa=!0);var f=this.ja.offsetWidth,h=this.ja.offsetHeight;if(this.H.width!=
f||this.H.height!=h)this.H.width=f,this.H.height=h;this.lA();this.ca&&this.ca.ggUpdateSize&&this.ca.ggUpdateSize(a,b);this.G("sizechanged",{w:a,h:b});this.G("playerstatechanged",{})}}catch(n){}}qd(){this.eu();this.tj(this.container.offsetWidth,this.container.offsetHeight)}fq(a){0==a&&(this.K.uc=!1);1==a&&(this.K.uc=!0);2==a&&(this.K.uc=!this.K.uc);this.G("viewmodechanged",{});this.G("playerstatechanged",{})}Ar(){return 1==this.K.uc?1:0}vv(a){this.Wc&&(this.Wc.Qo=0==a?!0:1==a?!1:!this.Wc.Qo,this.update())}qr(){return this.P.mode}gq(){this.G("viewstatechanged",
{})}Br(){return 0}uw(a){return"_firstmap"==a?"web":"_firstfloorplan"==a?"file":(a=this.xc[a])?a.type:"web"}tw(a){"_firstmap"==a?a=this.Xq():"_firstfloorplan"==a&&(a=this.uk());return(a=this.xc[a])?a:{}}Xq(){let a="";for(let b in this.xc){let e=this.xc[b];"web"==e.type&&1E4>e.index&&(a=b)}return a}uk(){let a="";for(var b in this.xc){let e=this.xc[b];"file"==e.type&&1E4>e.index&&(a=b)}return a}xw(a,b){"_firstfloorplan"==b&&(b=this.uk());let e=[];a||(a=this.va);let f=this.Ne[a];f&&(a=f);""===a&&0<Object.keys(this.Xc).length&&
(a=Object.keys(this.Xc)[0]);this.Xc[a]&&this.Xc[a][b]&&(e.push(this.Xc[a][b].y),e.push(this.Xc[a][b].x));return e}yw(a,b){"_firstfloorplan"==b&&(b=this.uk());let e=[];a||(a=this.va);let f=this.Ne[a];f&&(a=f);""===a&&0<Object.keys(this.Xc).length&&(a=Object.keys(this.Xc)[0]);this.eh[a]&&this.eh[a][b]&&(e.push(this.eh[a][b].x),e.push(this.eh[a][b].y));return e}dr(a){var b=this.Ne[a];b&&(a=b);b=this.cr();let e=[];for(let f=0;f<b.length;f++)this.Xc[a]&&this.Xc[a][b[f]]&&e.push(b[f]);return e}sw(a){a=
this.dr(a);return 0<a.length?a[0]:""}cr(){let a=[];for(let b in this.xc)a.push(b);return a}gw(){let a=[];for(let b in this.xc)"file"==this.xc[b].type&&a.push(b);return a}ex(){for(let a in this.xc)if("web"==this.xc[a].type)return!0;return!1}bx(){for(let a in this.xc)if("file"==this.xc[a].type)return!0;return!1}jx(a,b,e){a=Math.atan2(a+1,e);var f=Math.atan2(b+1,e);b=Math.sin(a);e=Math.sin(f);a=Math.cos(a);f=Math.cos(f);this.Mq.init(0,0,-1);this.Lq.init(a,0,-b);this.Nq.init(-a,0,-b);this.Oq.init(0,f,
-e);this.Kq.init(0,-f,-e)}Hm(a){a=this.ei(a,this.Mq);a=this.ei(a,this.Lq);a=this.ei(a,this.Nq);a=this.ei(a,this.Oq);return a=this.ei(a,this.Kq)}du(a){if(!this.pf&&this.yx!=a){this.yx=a;let b;b=this.margin.left.ba+this.H.width/2+"px ";b+=this.margin.top.ba+this.H.height/2+"px ";this.ya.style[this.mk]=a+"px";this.ya.style[this.mk+"Origin"]=b;this.ja.style[this.mk]=a+"px";this.ja.style[this.mk+"Origin"]=b}}pn(){return this.F.Id||this.F.be||!this.Fa()&&this.qa&&(4!=this.$()||0!=this.Rc())?!1:!0}Rl(){const a=
this.D;let b=new Nd(0,0,-100),e=this.oe();const f=100/a.fov.m*this.H.height;let h=this.pn(),n=1E5,r=-1;for(let z=0;z<this.L.length;z++){let ab=this.L[z];if("point"==ab.type){var t=void 0,w=void 0;var x=!1;a.Fa()?(t=(a.pan.m-ab.pan)/100*f,w=(a.u.m-ab.u)/100*f,Math.abs(t)<this.H.width/2+500&&Math.abs(w)<this.H.height/2+500&&(x=!0)):(b.init(0,0,-100),b.za(-ab.u*Math.PI/180),b.Ea(ab.pan*Math.PI/180),b.Ea(-a.pan.m*Math.PI/180),b.za(a.u.m*Math.PI/180),b.Ua(a.Y.m*Math.PI/180),.01>b.z?(w=-e/b.z,t=b.x*w,w*=
b.y,Math.abs(t)<this.H.width/2+5E3&&Math.abs(w)<this.H.height/2+5E3&&(x=!0)):w=t=-1E4);ab.Gc=t+this.H.width/2;ab.jc=w+this.H.height/2;ab.uo=ab.Gc/this.H.width*100;ab.vo=ab.jc/this.H.height*100;ab.visible=x;ab.closestToCenter=!1;if(x&&h){var y=Math.sqrt(t*t+w*w);n>y&&(n=y,r=z)}ab.px=ab.Gc;ab.py=ab.jc;ab.pxp=ab.uo;ab.pyp=ab.vo;ab.visible=ab.visible;if(ab.j&&ab.j.onUpdatePosition)ab.j.onUpdatePosition(this,ab);else ab.j&&ab.j.__div&&("none"!=ab.j.__div.style[this.Pc]&&(ab.j.__div.style[this.Pc]="none"),
x&&h?(ab.j.ggUse3d?(this.pf||this.du(e),this.Fa()?(ab.j.__div.style[this.Qe]="scale("+(100/a.fov.m*this.H.height/ab.j.gg3dDistance).toFixed(10)+")",ab.j.__div.style.left=this.margin.left.ba+t+this.H.width/2+"px",ab.j.__div.style.top=this.margin.top.ba+w+this.H.height/2+"px"):(ab.j.__div.style.width="1px",ab.j.__div.style.height="1px",x="",this.pf&&(x+="perspective("+e+"px) "),x+="translate3d(0px,0px,"+e+"px) ",x+="rotateZ("+a.Y.m.toFixed(10)+"deg) ",x+="rotateX("+a.u.m.toFixed(10)+"deg) ",x+="rotateY("+
(-a.pan.m).toFixed(10)+"deg) ",x+="rotateY("+ab.pan.toFixed(10)+"deg) ",x+="rotateX("+(-ab.u).toFixed(10)+"deg) ",x+="translate3d(0px,0px,"+(-1*ab.j.gg3dDistance).toFixed(10)+"px) ",ab.j.__div.style[this.Qe+"Origin"]="0% 0%",ab.j.__div.style[this.Qe]=x,ab.j.__div.style.left=this.margin.left.ba+this.H.width/2+"px",ab.j.__div.style.top=this.margin.top.ba+this.H.height/2+"px")):this.At?(ab.j.__div.style.left=this.margin.left.ba+this.H.width/2+"px",ab.j.__div.style.top=this.margin.top.ba+this.H.height/
2+"px",ab.j.__div.style[this.Qe]="translate3d(0px,0px,-1000px) rotateY(0.1deg) translate3d("+t+"px,"+w+"px, 0.5px)",ab.j.__div.style["transform-style"]="preserve-3d"):(ab.j.__div.style.left=this.margin.left.ba+t+this.H.width/2+"px",ab.j.__div.style.top=this.margin.top.ba+w+this.H.height/2+"px"),ab.j.__div.ggVisible&&(ab.j.__div.style.visibility="visible")):(ab.j.ggUse3d&&(ab.j.__div.style[this.Qe]=""),ab.j.__div.style.left="-1000px",ab.j.__div.style.top="-1000px",ab.j.__div.style.visibility="hidden"))}if("poly"==
ab.type)if(t=[],this.Fa())for(ab.kh=[],x=0;x<ab.vertices.length;x++)t=ab.vertices[x],w=(a.pan.m-t.pan)/100*f,y=(a.u.m-t.u)/100*f,w+=this.margin.left.ba+this.H.width/2,y+=this.margin.top.ba+this.H.height/2,ab.kh.push({Gc:w,jc:y});else{for(x=0;x<ab.vertices.length;x++)w=ab.vertices[x],b.init(0,0,-100),b.za(-w.u*Math.PI/180),b.Ea(w.pan*Math.PI/180),b.Ea(-a.pan.m*Math.PI/180),b.za(a.u.m*Math.PI/180),b.Ua(a.Y.m*Math.PI/180),t.push(b.clone());t=this.Hm(t);if(0<t.length)for(x=0;x<t.length;x++)b=t[x],.1>
b.z?(y=-e/b.z,w=this.H.width/2+b.x*y,y=this.H.height/2+b.y*y):y=w=0,b.Gc=w,b.jc=y;ab.kh=t}}-1!=r&&(this.L[r].closestToCenter=!0);this.G("hotspotsupdated",{})}Vq(){let a=[];for(let b=0;b<this.L.length;b++){let e=this.L[b];"point"==e.type&&e.j&&e.j.__div&&a.push(e.j.__div)}return a}ck(a,b){let e=-1;if((0<=this.P.mode||0<this.P.lc.length)&&this.Vr())for(let f=0;f<this.L.length;f++){let h=this.L[f];"poly"==h.type&&h.kh&&0<h.kh.length&&(-1!=this.P.mode||-1!=this.P.lc.indexOf(h.id))&&vj.Lr(h.kh,a,b)&&(e=
f,h.Gc=a,h.jc=b)}return 0<=e?this.L[e]:!1}Vr(){return 4==this.$()&&0==this.Rc()}ke(){this.D.ke()}update(a=0){this.Oa=!0;a&&(this.Pe=Math.max(1*a,this.Pe))}rn(){return 0<this.D.Hj||0<this.D.Ee}Mj(){var a=Date.now();var b=this.O;this.ea[0].kp=1;3<this.Ol&&(this.Ol=-3);this.Ol+=.01;if(1<this.ea.length){var e=this.ea[0].D,f=this.ea[1].D;f.bb(e.$());f.pan.m=e.pan.m;f.u.m=e.u.m;f.fov.m=e.fov.m}e=this.ea[0];f=e.D;b&&(e.Zt(),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT));this.Fa()?(this.Rl(),
this.qa&&(e.hA(),e.Js())):0===this.nd&&(!this.qa||4==this.$()&&0==this.Rc()?(b=this.oe(),this.jx(this.H.width/2,this.H.height/2,b),this.Rl(),this.Pj?e.kA():this.mA&&this.hu(),this.op(),this.qa?(this.B.Vc?14==this.B.format?e.jA():e.ru():0<f.M.levels.length?e.sA():e.uA(),e.Js()):this.Mh&&this.eA(),this.Wc&&this.Wc.ly()):(this.ea[0].ru(),this.Rl(),this.gx()));50<Date.now()-a?this.ph||(2<this.To?(this.ph=!0,this.qd()):this.To++):this.To=0;this.se&&e.D.M.Vs++;this.qa&&this.O&&(a=this.O,a.disable(a.BLEND),
a.disable(a.STENCIL_TEST),a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE))}eA(){this.ke();let a;this.Oc&&(a=this.Oc.getContext("2d"));if(this.H.width!==this.ja.offsetWidth||this.H.height!==this.ja.offsetHeight)this.H.width=this.ja.offsetWidth,this.H.height=this.ja.offsetHeight;if(a){const b=this.D;let e=a.canvas.width/2,f=a.canvas.height/2,h=a.createRadialGradient(e,f,5,e,f,Math.max(e,f));h.addColorStop(0,"#333");h.addColorStop(1,"#fff");a.rect(0,0,a.canvas.width,a.canvas.height);a.fillStyle=h;a.fill();
a.fillStyle="#f00";a.font="20px Helvetica";a.textAlign="center";a.fillText("Pan: "+b.pan.m.toFixed(1),e,f-60);a.fillText("Tilt: "+b.u.m.toFixed(1),e,f-30);a.fillText("Fov: "+b.fov.m.toFixed(1),e,f+0);a.fillText("Node: "+this.Bd(),e,f+30);a.fillText("Title: "+this.zg.title,e,f+60)}}az(a){a=Math.round(a);this.pf=0<(a&1);this.Go=0<(a&2);this.Nh=0<(a&4);this.ph=0<(a&8);4096<=a&&(this.Lh=0<(a&4096),this.qa=0<(a&8192),this.Mh=0<(a&32768))}Hw(){let a=0;this.pf&&(a|=1);this.Go&&(a|=2);this.Nh&&(a|=4);this.Lh&&
(a|=4096);this.qa&&(a|=8192);this.Mh&&(a|=32768);return a}op(){let a=Math.round(this.oe());this.pf||this.du(a);for(var b=0;b<this.$a.length;b++){var e=void 0;e=this.$a[b];e.pp(a);e.j.hidden=!1}for(b=0;b<this.Vb.length;b++)e=this.Vb[b],e.pp(a),e.j.hidden=!1}hu(){let a=Math.round(this.oe());for(let b=0;b<this.V.length;b++){let e;e=this.V[b];e.Gd||(e.pp(a),e.j.hidden=this.F.Id?!0:!1)}}gx(){for(var a=0;a<this.$a.length;a++)this.$a[a].pg(!1);for(a=0;a<this.V.length;a++){let b;b=this.V[a];b.Gd||b.pg(!1)}for(a=
0;a<this.Vb.length;a++)this.Vb[a].pg(!1)}lA(){try{for(let a=0;a<this.Ck();a++){let b=this.xn(a);b.Gd||b.Fe()}}catch(a){}}bg(a){const b=this;b.en=!1;b.Na=a?a:document.createElement("canvas");b.Na.addEventListener("webglcontextlost",e=>{b.O=null;e.preventDefault();b.Rb("Pano2VR: Context lost")});b.Na.addEventListener("webglcontextrestored",e=>{e.preventDefault();b.Pr();b.Rb("Pano2VR: Context restored")});return b.Pr()}Pr(){const a=this;try{let b=a.container.offsetWidth-a.margin.left.ba-a.margin.right.ba,
e=a.container.offsetHeight-a.margin.top.ba-a.margin.bottom.ba;if(100>b||100>e)e=b=100;let f=window.devicePixelRatio||1;a.ph&&(f=1);a.ja.style.width=b+"px";a.ja.style.height=e+"px";a.Na.style.width=b+"px";a.Na.style.height=e+"px";a.Na.width=b*f;a.Na.height=e*f;a.Na.style.display="none";a.Na.style.touchAction="none";a.ja.insertBefore(a.Na,a.ja.firstChild);let h=a.qu;h.stencil=!0;h.depth=!0;h.powerPreference="high-performance";a.Uc&&10<=a.cf[0]&&(h.antialias=!1,h.alpha=!1);let n={};n.flags=h;n.canvas=
a.Na;a.G("beforewebglcontext",n);a.O=a.Na.getContext("webgl2",h);a.O?a.sp=!0:(a.sp=!1,a.O=a.Na.getContext("webgl",h));a.O||(a.O=a.Na.getContext("experimental-webgl",h));if(a.O){let r=a.O;a.Za.width=b*f;a.Za.height=e*f;r.clearColor(0,0,0,0);r.enable(a.O.DEPTH_TEST);r.viewport(0,0,500,500);r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT);4096<=r.getParameter(r.MAX_TEXTURE_SIZE)&&!a.Hi&&(a.D.Si=1<f?4*a.D.Si:2*a.D.Si);a.ea.forEach(t=>{t.Di();t.Ik();t.Or(a.Fh);t.Qr()});a.F&&(a.F.Di(),a.F.bg());a.Wc&&(a.Wc.Di(),
a.Wc.bg())}}catch(b){}a.O?(a.qa=!0,a.G("webglready",{gl:this.O})):alert("Could not initialise WebGL!")}Sc(a,b){const e=this.O;e.shaderSource(a,b);e.compileShader(a);e.getShaderParameter(a,e.COMPILE_STATUS)||(console&&console.log(e.getShaderInfoLog(a)),alert(e.getShaderInfoLog(a)))}gg(a,b,e){const f=this.O;f.attachShader(a,b);f.attachShader(a,e);f.linkProgram(a);f.getProgramParameter(a,f.LINK_STATUS)||(alert("Could not initialise shader program"),console&&console.log(f.getError()));f.useProgram(a)}pe(){return this.D.pe()}mr(){return this.I.pan}wk(){return this.D.wk()}qe(){return this.D.qe()}Fa(){return this.D.Fa()}Zd(a){this.D.Zd(a)}nj(a){this.D.nj(a)}bi(a,
b){this.D.bi(a,b)}Cm(a,b){this.D.Cm(a,b)}Vf(){return this.D.Vf()}zr(){return this.I.u}$d(a){this.D.$d(a)}ci(a,b){this.D.ci(a,b)}Em(a,b){this.D.Em(a,b)}uh(a){this.D.uh(a)}zk(){return this.D.zk()}Cd(){return this.D.Cd()}Gb(){return this.D.Gb()}nn(a,b){return this.D.nn(a,b)}ln(a,b){return this.D.ln(a,b)}hw(){return this.I.Cj}Lb(a){return this.D.Lb(a)}Lo(a){this.D.Lo(a)}rj(a){this.D.rj(a)}Mo(a){this.D.Mo(a)}Ko(a){this.D.Ko(a)}wl(a,b){const e=this.D;if(120<e.Cd())e.Lb(a);else{var f=this.Sd(b.x,b.y,!0);
if(this.Lb(a)){b=this.Sd(b.x,b.y,!0);a=f.pan-b.pan;b=f.tilt-b.tilt;if(15<Math.abs(a)||10<Math.abs(b))b=a=0;a=this.Fa()?-a:a*Math.cos(f.tilt*Math.PI/180);e.pan.Zb-=a;e.u.Zb+=b;e.Bl(e.pan.m-a,e.u.m+b)}}}ai(a,b){return this.D.ai(a,b)}bq(a,b){this.wl(this.Cd()+a,b)}bk(a,b){const e=this.D;if(!isNaN(a)){let f;f=a/90*Math.cos(Math.min(e.fov.m,90)*Math.PI/360);f=e.fov.m*Math.exp(f);this.Lb(f);b&&(e.fov.d=a)}}cq(a,b,e){const f=this.D;if(!isNaN(a)){let h;h=a/90*Math.cos(Math.min(f.fov.m,90)*Math.PI/360);h=
f.fov.m*Math.exp(h);this.wl(h,b);e&&(f.fov.d=a,f.fov.hd.enabled=!0,f.fov.hd.x=b.x,f.fov.hd.y=b.y)}}Bl(a,b){this.D.Bl(a,b)}Po(a,b,e){this.D.Po(a,b,e)}th(a,b,e){let f=a.toString().split("/");1<f.length&&(a=Number(f[0]),b=Number(f[1]),2<f.length&&(e=Number(f[2])));this.D.th(a,b,e)}vl(){this.D.vl()}Sw(){let a={};const b=this.D;a.pan={};a.pan.min=b.pan.min;a.pan.max=b.pan.max;a.tilt={};a.tilt.min=b.u.min;a.tilt.max=b.u.max;return a}pz(a){const b=this.D;a.hasOwnProperty("pan")&&(a.pan.hasOwnProperty("min")&&
(b.pan.min=a.pan.min),a.pan.hasOwnProperty("max")&&(b.pan.max=a.pan.max));a.hasOwnProperty("tilt")&&(a.tilt.hasOwnProperty("min")&&(b.u.min=a.tilt.min),a.tilt.hasOwnProperty("max")&&(b.u.max=a.tilt.max));this.ke();this.update()}kw(){return this.ra.enabled}Ty(a){let b=this.ra;a&&(b.na.x=0,b.na.y=0);b.enabled=!!a}Cr(){return this.K.Ge}vt(a){this.K.Ge=a}iw(){return this.En()?!0:this.An}st(a,b=!0){this.ju=b;this.Oh==!a&&(a&&this.En()?this.Xs():((this.Oh=!!a)?this.rb.kj=!0:this.D.Y.m=0,this.G("gyrochanged",
{}),this.G("playerstatechanged",{})))}En(){return window.hasOwnProperty("DeviceOrientationEvent")&&DeviceOrientationEvent.hasOwnProperty("requestPermission")&&"function"===typeof DeviceOrientationEvent.requestPermission?!0:!1}Xs(){let a=this;if(this.En())try{DeviceOrientationEvent.requestPermission().then(b=>{"granted"===b&&(a.rb.kj=!0,a.Oh=!0,a.G("gyrochanged",{}),a.G("playerstatechanged",{}))}).catch(console.error)}catch(b){console.log(b)}}Lw(){return this.Oh}moveTo(a,b,e,f,h,n){this.sa(!1);if("_blank"!==
a&&""!==a){this.I.active=!0;this.I.aborted=!1;this.I.rp=!1;var r=this.D,t=a.toString().split("/");1<t.length&&(a=Number(t[0]),f=Number(b),b=Number(t[1]),2<t.length&&(e=Number(t[2])));this.I.pan=isNaN(a)?r.pan.m:Number(a);this.I.u=isNaN(b)?r.u.m:Number(b);this.I.fov=!isNaN(e)&&0<e&&180>e?Number(e):r.fov.m;this.I.speed=!isNaN(f)&&0<f?Number(f):1;this.I.Y=isNaN(h)?r.Y.m:Number(h);void 0!==n?!a||4!=n&&12!=n&&9!=n||(this.I.vb=n):this.I.vb=this.$()}}Vi(a){this.sa(!1);let b=0,e=0,f=70,h=4,n=0,r=1;a.hasOwnProperty("pan")&&
(b=Number(a.pan),this.I.pan=b);a.hasOwnProperty("tilt")&&(e=Number(a.tilt),this.I.u=e);a.hasOwnProperty("fov")&&(f=Number(a.fov),this.I.fov=f);a.hasOwnProperty("projection")&&(h=Number(a.projection),this.I.vb=h);a.hasOwnProperty("timingFunction")&&(n=Number(a.timingFunction));a.hasOwnProperty("speed")&&(r=Number(a.speed));a=this.D;if(0>=r)this.th(b,e,f),this.bb(h);else{let t=new Rx;t.hb="__AutoMove";t.vf=this.wk();t.zj=a.u.m;t.Be=a.fov.m;t.yj=this.$();t.ae=b;t.De=e;t.Ch=f;t.Ce=h;t.Mg=!1;t.Pf=!1;t.Qf=
!1;0==n&&(t.Pf=!0);1==n&&(t.Mg=!0,t.Pf=!0);2==n&&(t.Qf=!0);t.speed=r;this.I.Op=this.S;this.S=this.Pq(t);this.I.Pp=(new Date).getTime();this.I.rp=!0;this.I.active=!0;this.I.aborted=!1;this.I.pan=b;this.I.u=e;this.I.fov=f;this.Ie=!1}}vs(a){const b=this.D;this.moveTo(b.pan.Wa,b.u.Wa,b.fov.Wa,a)}ws(a,b){let e={};const f=this.D;e.pan=f.pan.Wa;e.tilt=f.u.Wa;e.fov=f.fov.Wa;e.projection=this.xi();e.timingFunction=b;e.speed=a;this.Vi(e)}Kp(a,b,e,f){let h=new Tm(this);h.type="point";h.pan=b;h.u=e;h.id=a;h.j=
{};h.j.player=this;h.Rf();h.j.hotspot=h;h.j.__div=document.createElement("div");h.j.__div.appendChild(f);this.L.push(h);h.j.__div.style.position="absolute";h.j.__div.style.left="-1000px";h.j.__div.style.top="-1000px";h.j.__div.ggVisible=!0;this.ya.insertBefore(h.j.__div,this.ya.firstChild);this.Oa=!0}cu(a,b,e){for(let f=0;f<this.L.length;f++){let h=this.L[f];h.id==a&&(h.pan=b,h.u=e,h.Rf())}this.Oa=!0}Us(a){let b=-1,e;for(let f=0;f<this.L.length;f++)e=this.L[f],e.id==a&&(b=f);-1<b&&(e=this.L.splice(b,
1).pop(),e.j&&e.j.__div&&this.ya.removeChild(e.j.__div))}Zq(a){for(var b=0;b<this.L.length;b++){let e=this.L[b];if(e.id==a)return b={},b.id=a,b.pan=e.pan,b.tilt=e.u,b.pxp=e.uo,b.pyp=e.vo,b.url=e.url,b.target=e.target,b.distance=e.distance,b.title=e.title,b.description=e.description,b.skinid=e.So,e.yd&&(b.customimage=e.yd,b.customimagewidth=e.Of,b.customimageheight=e.Od,b.use3D=e.wg,b.distance3D=e.kk),e.j&&e.j.__div&&(b.div=e.j.__div),b}}ou(a,b){this.pa.start.x=a;this.pa.start.y=b;this.pa.oa.x=a;this.pa.oa.y=
b;this.ra.oa.x=a;this.ra.oa.y=b;this.zo++;a=this.D;a.pan.Zb=a.pan.m;a.u.Zb=a.u.m}mu(a,b){let e;e=this.Fa()?this.Cd():this.Gb();const f=this.D;f.pan.Zb+=a*e/this.H.height;f.u.Zb+=b*e/this.H.height;f.pan.m=f.pan.Zb;f.u.m=f.u.Zb}nu(a,b){this.pa.m.x=a;this.pa.m.y=b;this.pa.na.x=this.pa.m.x-this.pa.oa.x;this.pa.na.y=this.pa.m.y-this.pa.oa.y;this.K.uc&&(this.pa.oa.x=this.pa.m.x,this.pa.oa.y=this.pa.m.y,this.update())}sa(a){const b=this.D;this.A.active&&(this.A.active=!1,this.G("autorotatechanged",{}),b.pan.d=
0,b.u.d=0,b.fov.d=0,b.fov.hd.enabled=!1);this.I.active&&(this.I.active=!1,b.pan.d=0,b.u.d=0,b.fov.d=0,b.fov.hd.enabled=!1);this.Df=this.I.aborted=!1;this.A.cl=!1;this.fe=.02;this.Zh=0;this.A.rd&&(this.A.enabled=this.A.Dg,a&&(this.A.rd=this.A.yg));this.cg=(new Date).getTime()}xk(a,b){return this.D.xk(a,b)}Sd(a,b){return this.D.Sd(a,b)}ec(a){return a==this.control||a&&void 0!==a.ggPermeableMap&&1==a.ggPermeableMap?!0:a&&void 0!==a.ggPermeable&&0==a.ggPermeable?!1:a&&a.ggType&&("container"==a.ggType||
"cloner"==a.ggType||"timer"==a.ggType)?!0:!1}Fm(a,b){const e=this.D;let f=this.oe(),h;for(h=0;h<this.Ck();h++){var n=this.xn(h);if(n.Pa)return n}for(h=0;h<this.Ck();h++){let t=this.xn(h);if(t.Gd||t.ko)continue;let w=[],x=new Nd,y,z,ab;0<t.fov&&(z=Math.tan(t.fov/2*Math.PI/180),ab=0<t.tc?z*t.kd/t.tc:z,t.Tc&&1!=t.Tc&&(ab*=t.Tc));for(y=0;4>y;y++){switch(y){case 0:x.init(-z,-ab,0);break;case 1:x.init(z,-ab,0);break;case 2:x.init(z,ab,0);break;case 3:x.init(-z,ab,0)}x.za(t.za*Math.PI/180);x.Ea(-t.Ea*Math.PI/
180);x.Ua(t.Ua*Math.PI/180);--x.z;x.za(-t.u*Math.PI/180);x.Ea(t.pan*Math.PI/180);x.Ea(-e.pan.m*Math.PI/180);x.za(e.u.m*Math.PI/180);x.Ua(e.Y.m*Math.PI/180);w.push(x.clone())}w=this.Hm(w);if(0<w.length){for(y=0;y<w.length;y++){x=w[y];if(.1>x.z){var r=-f/x.z;n=this.H.width/2+x.x*r;r=this.H.height/2+x.y*r}else r=n=0;x.Gc=n;x.jc=r}if(vj.Lr(w,a,b))return t}}return null}Ck(){return this.V.length+this.$a.length+this.Vb.length}xn(a){return a<this.V.length?this.V[a]:a<this.V.length+this.$a.length?this.$a[a-
this.V.length]:this.Vb[a-(this.V.length+this.$a.length)]}Px(a){this.fu(a);window.focus();if(this.Pd)this.Pd.onclick();(this.me||this.Te&&this.bh)&&7>this.ed&&this.Wg();if(0==a.button&&(this.Xb=null,!this.K.wc&&!this.Dc)){a=a?a:window.event;if(a.which||0==a.which||1==a.which){let b=(new Date).getTime();if(this.lf){this.Xb=this.lf;this.U.md=!0;this.U.startTime=b;a.stopPropagation();return}if(this.ec(a.target)){let e;if((e=this.Fm(this.da.x,this.da.y))&&e.Ye&&(this.Xb=e,void 0!==e.code&&""!==e.code&&
e.dc))return;this.ou(a.pageX,a.pageY);this.U.md=!0;this.U.startTime=b;a.preventDefault();this.sa(!0);a=this.Sd(this.da.x,this.da.y,!0);this.G("playerdown",{pan:-Math.round(100*a.pan)/100,tilt:Math.round(100*a.tilt)/100})}}this.pa.na.x=0;this.pa.na.y=0}}rf(a){if("string"==typeof a)for(let b=0;b<this.L.length;b++)if(this.L[b].id==a){a=this.L[b];break}this.N=a&&null!==a&&"object"==typeof a?a:this.Xa;this.N==this.Xa&&(a=this.ck(this.da.x,this.da.y))&&(a.ob=0);this.N.Rf&&this.N.Rf();this.hotspot=this.N;
this.G("activehotspotchanged",{hotspot:this.N})}Ox(a){this.fu(a);if(!this.K.wc&&!this.Dc&&!this.lf){this.A.active&&(this.A.Vk=(new Date).getTime());0==a.buttons&&(this.U.md=!1);this.U.md&&(a.preventDefault(),(a.which||0==a.which||1==a.which)&&this.nu(a.pageX,a.pageY),this.sa(!0));let e=!1;if(this.N==this.Xa||"poly"==this.N.type){var b=this.Xa;0<this.L.length&&this.ec(a.target)&&(b=this.ck(this.da.x,this.da.y));this.ul(b);this.Ih(this.da.x,this.da.y,!1);0!=b&&b!=this.Xa&&(e=!0)}b=null;!e&&this.ec(a.target)&&
(b=this.Fm(this.da.x,this.da.y));this.A.ik&&(this.A.ik=!1);this.ya.style.cursor=this.N!=this.Xa&&this.N.af&&e||b&&b.Yg?"pointer":"default"}}ul(a){!1===a&&(a=this.Xa);this.N!=a&&(this.N!=this.Xa&&(0<this.P.mode&&(this.N.ob=0),this.la&&this.la.hotspotProxyOut&&this.la.hotspotProxyOut(this.N.id,this.N.url),this.G("hsproxyout",{id:this.N.id,url:this.N.url})),a!=this.Xa?(this.rf(a),this.la&&this.la.hotspotProxyOver&&this.la.hotspotProxyOver(this.N.id,this.N.url),this.G("hsproxyover",{id:this.N.id,url:this.N.url}),
0<this.P.mode&&(this.P.ob=1,this.N.ob=1)):(this.rf(this.Xa),0<this.P.mode&&(this.P.ob=0)))}Nx(a){this.Tk=-1;if(this.me||this.Te&&this.bh)7<=this.ed?this.Ht():this.Wg();if(0==a.button&&!this.K.wc&&!this.Dc){let b=this.Sd(this.da.x,this.da.y,!0);this.Xb&&(this.Xb.Ye(),this.lf=this.Xb.Pa?this.Xb:null);if(this.U.md){this.sa(!0);a.preventDefault();this.U.md=!1;a=(new Date).getTime();let e;e=Math.abs(this.pa.start.x-this.pa.oa.x)+Math.abs(this.pa.start.y-this.pa.oa.y);if(400>a-this.U.startTime&&0<=e&&20>
e){let f=this.ck(this.da.x,this.da.y);f&&this.Wt(f);e=Math.abs(this.pa.ve.x-this.pa.oa.x)+Math.abs(this.pa.ve.y-this.pa.oa.y);700>a-this.Ji&&0<=e&&20>e?(f?this.Xt(f):this.K.Tm&&this.Nl(),this.G("playerdblclick",{pan:-Math.round(100*b.pan)/100,tilt:Math.round(100*b.tilt)/100}),this.Ji=0):(this.G("playerclick",{pan:-Math.round(100*b.pan)/100,tilt:Math.round(100*b.tilt)/100}),this.Ji=a);this.pa.ve.x=this.pa.oa.x;this.pa.ve.y=this.pa.oa.y}this.G("playerup",{pan:-Math.round(100*b.pan)/100,tilt:Math.round(100*
b.tilt)/100})}}}us(a){if(!this.K.gf&&!this.Dc&&(a=a?a:window.event,this.ec(a.target))){var b=a.detail?-1*a.detail:a.wheelDelta/40;this.K.Rr&&(b=-b);a.axis&&(-1==this.Tk?this.Tk=a.axis:this.Tk!=a.axis&&(b=0));let e=0<b?1:-1;a.wheelDeltaX&&a.wheelDeltaY&&Math.abs(a.wheelDeltaX)>Math.abs(a.wheelDeltaY)&&(b=0);0!=b&&(this.K.Ge?(b=this.Wf(),this.cq(e*this.K.Vo,{x:a.clientX-b.x,y:a.clientY-b.y},!0)):this.bk(e*this.K.Vo,!0),this.update());a.preventDefault();this.sa(!0)}}Xz(a){const b=this.D;var e=a.touches;
this.gu(a);this.xf=this.Xb=null;window.focus();this.Fn||(this.Fn=!0,this.G("hastouch",{}),this.G("playerstatechanged",{}));!this.Nn&&(this.me||this.Te&&this.bh)&&7>this.ed&&this.Wg();if(!this.K.wc&&!this.Dc){var f=(new Date).getTime();if(this.lf)this.Xb=this.lf,this.U.Ad=!0,this.U.startTime=f,a.preventDefault(),this.U.cj=!0,e[0]&&(this.xb=e[0].target);else{if(!this.U.Ad&&e[0]){this.U.startTime=f;this.U.start.x=e[0].pageX;this.U.start.y=e[0].pageY;this.U.oa.x=e[0].pageX;this.U.oa.y=e[0].pageY;f=this.xb=
e[0].target;if(this.ec(f)){var h;(h=this.Fm(this.da.x,this.da.y))&&h.Ye&&(this.Xb=h);if(h=this.ck(this.da.x,this.da.y))this.xf=h,this.ul(h),this.Uf(a),this.Ih(this.da.x,this.da.y,!0);this.ou(e[0].pageX,e[0].pageY);this.U.Iq=e[0].identifier;this.U.Ad=!0;a.preventDefault();this.U.cj=!0;this.sa(!0);h=this.Sd(this.da.x,this.da.y,!0);this.G("playerdown",{pan:-Math.round(100*h.pan)/100,tilt:Math.round(100*h.tilt)/100})}if(f){h=!1;if(null!=this.U.Bh)for(var n=this.U.Bh;n&&n!=this.control;){if(n.onmouseout)n.onmouseout(a);
if(n.onmouseleave)n.onmouseleave(a);n=n.parentNode}n=f;let r=!0;for(;n&&n!=this.control;)f!=this.U.Bh&&(n.onmouseover&&(n.onmouseover(a),7<=this.ed&&this.ec(a)&&(h=!0)),n.onmouseenter&&(n.onmouseenter(a),7<=this.ed&&this.ec(a)&&(h=!0))),n.onmousedown&&(n.onmousedown(a),r=!1,h=!0),n.onclick&&(r=!1),n=n.parentNode;this.U.Bh=r&&7<=this.ed&&f!=this.U.Bh?f:null;h&&(a.preventDefault(),this.U.cj=!0)}}1<e.length&&(this.U.Ad=!1);!this.Cn&&2==e.length&&e[0]&&e[1]&&this.ec(this.xb)&&(a=e[0].pageX-e[1].pageX,
e=e[0].pageY-e[1].pageY,b.fov.Kt=Math.sqrt(a*a+e*e),b.fov.prev=b.fov.m);this.pa.na.x=0;this.pa.na.y=0}}}Wg(){try{this.Oj&&this.B.j&&(!this.B.Vc&&this.B.Gl&&this.B.j.play(),this.B.j.muted=!1);if(this.ha&&(this.ha.resume(),"suspended"==this.ha.state))return;if(this.Uc&&this.ha&&this.ha.createOscillator){let e=this.ha.createOscillator();var a=this.ha.createGain();e.frequency.value=30;e.type="sine";e.connect(a);a.connect(this.ha.destination);a.gain.value=.01;e.start(0);setTimeout(function(){e.stop()},
1E4)}for(a=0;a<this.X.length;a++){var b=this.X[a];(!this.isPlaying(b.id)||b.ua)&&0<=b.loop&&b.autoplay&&!this.Ec&&(b.ua&&b.Fg(),this.Yd(b.id,b.loop))}for(b=0;b<this.V.length;b++){let e=this.V[b];!this.isPlaying(e.id)&&e.autoplay&&this.Oj&&!this.Ec&&this.Yd(e.id,e.loop);this.isPlaying(e.id)&&e.autoplay&&this.Oj&&!this.Ec&&(e.Kd&&e.He(),e.j.muted=!1)}this.Te=this.me=!1}catch(e){}}Wz(a){const b=this.D;this.gu(a);let e=a.touches;if(this.K.wc||this.Dc)(this.F.be||this.F.Id||this.F.pd)&&a.preventDefault();
else{e[0]&&(this.U.oa.x=e[0].pageX,this.U.oa.y=e[0].pageY);if(this.xb){for(var f=this.xb,h=!1;f&&f!=this.control&&!h;)"scrollarea"==f.ggType&&(h=!0),"map"==f.ggType&&(h=!0),"text"==f.ggType&&(h=!0),f=f.parentNode;h||a.preventDefault()}if(this.U.Ad){a.preventDefault();for(f=0;f<e.length;f++)if(e[f].identifier==this.U.Iq){this.nu(e[f].pageX,e[f].pageY);break}this.xf&&(this.Uf(a),this.Ih(this.da.x,this.da.y,!0));this.sa(!0)}2==e.length&&e[0]&&e[1]&&(this.U.Ad=!1,!this.Cn&&this.ec(this.xb)&&(this.K.gf||
(f=e[0].pageX-e[1].pageX,h=e[0].pageY-e[1].pageY,b.fov.tq=Math.sqrt(f*f+h*h),this.ra.fov.active=!0,this.ra.fov.center.enabled=!0,this.ra.fov.center.x=(e[0].pageX+e[1].pageX)/2,this.ra.fov.center.y=(e[0].pageY+e[1].pageY)/2,this.ra.fov.sc=b.fov.prev*Math.sqrt(b.fov.Kt/b.fov.tq),4==this.$()&&!this.Fa()&&this.ra.fov.sc>b.fov.max&&(this.ra.fov.sc=b.fov.max),this.ra.fov.sc<b.fov.min&&(this.ra.fov.sc=b.fov.min)),this.sa(!0),a.preventDefault()))}}Vz(a){const b=this;b.U.cj&&(b.U.cj=!1,a.preventDefault());
let e=!1;if(b.me||b.Te&&b.bh)7<=b.ed?b.Ht():b.Wg();if(!b.K.wc&&!b.Dc){let h=this.Sd(b.U.oa.x,b.U.oa.y,!0);b.U.Ad&&(a.preventDefault(),b.sa(!0),this.G("playerup",{pan:-Math.round(100*h.pan)/100,tilt:Math.round(100*h.tilt)/100}));let n=(new Date).getTime(),r=!1;this.ec(this.xb)&&(a.preventDefault(),this.Xb&&(this.Xb.Ye(),this.lf=this.Xb.Pa?this.Xb:null));var f=Math.abs(this.U.start.x-this.U.oa.x)+Math.abs(this.U.start.y-this.U.oa.y);if(0<=f&&20>f){e=!0;if(b.xb)for(f=b.xb;f&&f!=b.control;){if(f.onclick){let t=
f,w=b.hotspot;setTimeout(()=>{let x=b.hotspot;b.N=w;b.hotspot=b.N;t.onclick(a);b.N=x;b.hotspot=b.N},0);"hotspot"!=f.fB&&(r=!0);e=!1}f=f.parentNode}f=Math.abs(b.U.ve.x-b.U.oa.x)+Math.abs(b.U.ve.y-b.U.oa.y);if(700>n-b.Ji&&0<=f&&20>f){if(b.ec(b.xb)){a.preventDefault();if(b.xf)b.Xt(b.xf);else if(b.K.Tm){let t=this;setTimeout(function(){t.Nl()},1)}this.G("playerdblclick",{pan:-Math.round(100*h.pan)/100,tilt:Math.round(100*h.tilt)/100})}if(b.xb)for(f=b.xb;f&&f!=b.control;)f.ondblclick&&(f.ondblclick(),
r=!0,e=!1),f=f.parentNode;b.Ji=0}else b.ec(b.xb)&&this.G("playerclick",{pan:-Math.round(100*h.pan)/100,tilt:Math.round(100*h.tilt)/100}),b.Ji=n;b.U.ve.x=b.U.oa.x;b.U.ve.y=b.U.oa.y}if(b.xb)for(f=b.xb;f&&f!=b.control;)b.U.Bh!=b.xb&&(f.onmouseout&&(f.onmouseout(a),7<=b.ed&&(r=!0)),f.onmouseleave&&(f.onmouseleave(a),r=!0)),f.onmouseup&&(f.onmouseup(a),7<=b.ed&&(r=!0)),f=f.parentNode;r&&a.preventDefault();b.Uf(a);b.xf&&(b.Ih(-1,-1,!0),e&&b.Wt(b.xf));b.xb=null;b.U.Ad=!1;b.ul(b.Xa);b.xf=null}}Uz(a){this.K.wc||
this.Dc||(this.U.Ad=!1);this.xf=null;this.ul(this.Xa);this.Uf(a);this.Ih(-1,-1,!0)}On(){return null!=this.xb||this.U.Ad||this.U.md}xs(a){!this.ig&&window.MSGesture&&(this.ig=new window.MSGesture,this.ig.target=this.control);this.ig&&this.ig.addPointer(a.pointerId)}Rq(a){const b=this.D;this.Cn=!0;this.el=1;this.K.wc||this.K.gf||this.Dc||(a.touches?(this.xb=a.touches.target,this.ec(a.target)&&(a.preventDefault(),b.fov.prev=b.fov.m,this.sa(!0))):(a.preventDefault(),b.fov.prev=b.fov.m,this.sa(!0)))}aw(a){const b=
this.D;if(!this.K.wc&&!this.K.gf&&!this.Dc&&this.ec(a.target)){a.preventDefault();this.ra.fov.active=!0;this.ra.fov.center.enabled=!0;let e=this.Uf(a);this.ra.fov.center.x=e.x;this.ra.fov.center.y=e.y;this.ra.fov.sc=b.fov.prev/Math.sqrt(a.scale);4==this.$()&&2!=this.nd&&this.ra.fov.sc>b.fov.max&&(this.ra.fov.sc=b.fov.max);this.update();this.sa(!0)}}Qx(a){const b=this.D;this.K.wc||this.K.gf||this.Dc||(a.preventDefault(),1!=a.scale&&(this.ra.fov.active=!0,this.el*=a.scale,this.ra.fov.center.enabled=
!0,a=this.Uf(a),this.ra.fov.center.x=a.x,this.ra.fov.center.y=a.y,this.ra.fov.sc=b.fov.prev/Math.sqrt(this.el),4==this.$()&&2!=this.nd&&this.ra.fov.sc>b.fov.max&&(this.ra.fov.sc=b.fov.max),this.update(),this.sa(!0)))}Qq(a){this.K.wc||this.K.gf||this.Dc||(this.ra.fov.active=!1,a.preventDefault(),this.sa(!0),this.ig&&this.ig.reset&&this.ig.reset())}wx(a){this.K.Oi||this.Dc||(this.vc&&a.preventDefault(),this.Rk=a.keyCode,this.sa(!0))}xx(a){this.Rk&&(this.Rk=0,a.preventDefault())}Zx(){this.Rk=0}hy(a,
b,e,f){f?(this.Ci.alpha=a,this.Ci.beta=b,this.Ci.gamma=e,this.Ci.gamma+=90):(this.rb.alpha=a,this.rb.beta=b,this.rb.gamma=e,this.rb.gamma+=90);this.rb.orientation=window.orientation?1*parseInt(""+window.orientation,10):0;e=new Ng;a=this.rb;e.ad(-a.alpha);e.ye(-a.beta);e.kc(-a.gamma);e.ye(90-a.orientation);1>e.Sb?-1<e.Sb?(b=180/Math.PI*Math.asin(-e.Sb),a=180/Math.PI*Math.atan2(e.Bc,e.Ac),e=180/Math.PI*Math.atan2(e.zc,e.yc)):(b=0,a=90,e=-180/Math.PI*Math.atan2(-e.hc,e.ic)):(b=0,a=-90,e=180/Math.PI*
Math.atan2(-e.hc,e.ic));if(this.Oh)if(this.On()||this.I.Gk||this.rb.kj)this.rb.kg=this.pe()+e,this.rb.fadeIn=0,this.rb.kj=!1;else{f=this.I.active;let h=1;10>this.rb.fadeIn&&(this.rb.fadeIn+=1,h=.1*this.rb.fadeIn);e=-e+this.rb.kg;this.Zd(h*e+(1-h)*this.pe());this.$d(h*a+(1-h)*this.Vf());this.ju?this.uh(h*b+(1-h)*this.zk()):this.uh(0);this.ke();this.I.active=f}}ri(){return Math.min(1,2*Math.tan(Math.PI*Math.min(this.D.fov.m,90)/360))}Ks(){let a=this;setTimeout(function(){a.Ks()},100);9!=a.rl||a.Jk||
window.requestAnimationFrame(function(){a.Zi()});10<a.rl&&1<a.zo&&(a.Rb("recover timer - disabling requestAnimationFrame"),a.Jk=!0,a.Zi());a.rl++}sj(a){var b=this.D;if("__VideoPano"!=this.S.hb){var e={PAN:{value:0,name:"pan"},MA:{value:1,name:"tilt"},AA:{value:2,name:"fov"}},f=0,h=0,n=0;a=Math.max(a,0);for(var r in e){var t=e[r],w=void 0,x=this.bc(this.rr(a,t.value,""),t.value,"");w=(w=this.ir(x))?this.Sq(x,w,a):x.value;switch(t.value){case 0:t=b.pan.m;if(this.Ie&&3!=x.type){if(!this.Fa()){for(;360<
w;)w-=360;for(;-360>w;)w+=360}f=w-t;this.Fa()||(180<f&&(f-=360),-180>f&&(f+=360));b.pan.m+=f*this.fe}else b.pan.m=w;this.A.Li=b.pan.m;break;case 1:t=b.u.m;this.Ie&&3!=x.type?(h=w-t,b.u.m+=h*this.fe):b.u.m=w;this.A.Mi=b.u.m;break;case 2:t=b.fov.m,this.Ie&&3!=x.type?(n=w-t,b.fov.m+=n*this.fe):b.fov.m=w,this.A.Ki=b.fov.m}}e=this.$();for(r=Math.floor(a);!this.bc(r,3)&&0<r;)r--;r=this.bc(r,3);x=a-r.time;this.Ie&&-1!=this.$h&&this.Yj+this.pm>a?(e=this.ui(this.$h),b.fov.m>e?this.Yj=a:(b=(a-this.Yj)/this.pm,
b=Math.min(1,b),this.bb(this.$(),this.$h,1-b))):(0==r.Mb||x>r.Mb-.3?this.bb(r.value):this.bb(e,r.value,1-x/r.Mb),this.A.$r=r.value);this.Ie&&(f=Math.sqrt(f*f+h*h+n*n),.3>f&&(this.Ie=!1,this.fe=.02,this.Zh=0),0<this.Zh&&f>this.Zh&&(this.fe+=.01,this.fe=Math.min(this.fe,1)),this.Zh=f)}f=Math.floor(a);h=this.bw(f);for(n=0;n<h.length;n++)if(e=h[n],3>e.Np)f!=this.Qp&&(b=e.Ld,this.mc.hasOwnProperty(b)&&(r=this.mc[b].type,0==r?this.tf(b,e.tp):1==r?this.tf(b,e.value):2==r&&this.tf(b,"true"==e.tp)));else if(b=
this.bc(this.rr(a,e.wb,e.Ld),e.wb,e.Ld),b=(r=this.ir(b))?this.Sq(b,r,a):b.value,r=e.Ld.split("|"),2==r.length)for(e=r[0],r=r[1],x=0;x<this.L.length;x++)w=this.L[x],w.id==e&&("pan"==r?w.pan=b:"tilt"==r&&(w.u=b));this.Qp=f;this.update()}Tq(){if(""!=this.A.gh){var a=this.lr(this.A.gh);if(0==a.length||1==a.length&&a[0]==this.va)return this.va}a=this.va;do if(this.A.Cs){let b=1E3;do a=this.eb[Math.floor(Math.random()*this.eb.length)];while(b--&&a==this.va)}else a=this.eb.indexOf(a),a++,a>=this.eb.length&&
(a=0),a=this.eb[a];while(""!=this.A.gh&&!this.wi(a).tags.includes(this.A.gh)&&a!=this.va);return a}sy(a){var b=this.D;var e=this.I.speed;this.I.lastTime&&(e=e*(a.getTime()-this.I.lastTime)/60);this.I.lastTime=a.getTime();var f=!0;0<this.ea.length&&(this.ea[0].ready()||(f=!1));this.A.pi&&(f||4==this.$())&&this.vi()&&(this.A.pi=!1,this.A.active=!0,this.Ha.running=!0,this.Ha.finished=!1);if(this.I.active||0!=this.I.vb&&f){if(this.I.rp&&"__AutoMove"==this.S.hb)if(e=(a.getTime()-this.I.Pp)/100,e>=this.S.length){if(this.sj(this.S.length),
this.Aa.splice(this.Aa.indexOf(this.S),1),this.I.active=!1,this.S=this.I.Op,this.I.vb=0,this.th(this.I.pan,this.I.u,this.I.fov),b.pan.Zb=this.I.pan,b.u.Zb=this.I.u,this.I.fh&&(this.I.fh=!1,this.A.cl=!0,this.A.rd=!0,this.A.active=!0,this.G("autorotatechanged",{})),this.onMoveComplete)this.onMoveComplete()}else this.sj(e);else{b.pan.d=this.I.pan-b.pan.m;if(360==b.pan.max-b.pan.min){for(;-180>b.pan.d;)b.pan.d+=360;for(;180<b.pan.d;)b.pan.d-=360}b.u.d=this.I.u-b.u.m;b.Y.d=this.I.Y-b.Y.m;b.fov.d=this.I.fov-
b.fov.m;f=e*this.ri();var h=Math.sqrt(b.pan.d*b.pan.d+b.u.d*b.u.d+b.Y.d*b.Y.d+b.fov.d*b.fov.d),n=b.pan.m-this.I.Li;let r=b.u.m-this.I.Mi,t=b.Y.m-this.I.cs,w=b.fov.m-this.I.Ki;100*Math.sqrt(n*n+r*r+t*t+w*w)<f&&0==this.I.vb&&(this.I.aborted=!0);this.I.Li=b.pan.m;this.I.Mi=b.u.m;this.I.cs=b.Y.m;this.I.Ki=b.fov.m;if(100*h<f||this.I.aborted){if(b.pan.d=0,b.u.d=0,b.Y.d=0,b.fov.d=0,b.fov.hd.enabled=!1,this.I.active&&(this.I.active=!1,b.pan.m=this.I.pan,b.u.m=this.I.u,b.Y.m=this.I.Y,b.fov.m=this.I.fov,this.onMoveComplete))this.onMoveComplete()}else h=
h>5*f?f/h:.2,b.pan.d*=h,b.u.d*=h,b.fov.d*=h;b.pan.m+=b.pan.d;b.u.m+=b.u.d;b.Y.m+=b.Y.d;this.K.Ge&&b.fov.hd.enabled?this.wl(b.fov.m+b.fov.d,b.fov.hd):b.fov.m+=b.fov.d;0!=this.I.vb&&(this.I.vb!=this.$()?(e=this.ui(this.I.vb),this.Cd()>e?(b.fov.m+=-Math.max((2.5-1.7*Math.min(Math.sqrt(b.pan.d*b.pan.d+b.u.d*b.u.d+b.Y.d*b.Y.d)/f,1))*f,b.fov.d)-b.fov.d,this.I.fov=b.fov.m):(this.bb(this.I.vb,this.$(),0),this.I.fj=0,this.ea.forEach(x=>{x.Ik()}))):1>this.I.fj?(this.I.fj=Math.min(1,this.I.fj+.05*e),this.bb(this.$(),
this.Rc(),this.I.fj)):(this.bb(this.$(),0,0),this.I.vb=0,this.ea.forEach(x=>{x.Ik()})))}this.cg=a.getTime();this.update()}else if(this.A.active&&!this.F.Id){e=a.getTime()-this.A.startTime;this.A.Vk<this.A.startTime&&(this.A.Vk=this.A.startTime);if((this.A.rd||this.Ha.running)&&0<this.Aa.length){e/=100;f=!1;if(this.Cc!=this.S.hb||""!=this.S.Ef&&this.A.ge!=this.S.Ef){for(b=0;b<this.Aa.length;b++)if(""==this.Cc&&this.Aa[b].Ef==this.A.ge||""!=this.Cc&&this.Aa[b].hb==this.Cc&&this.Aa[b].Ef==this.A.ge){f=
!0;this.S=this.Aa[b];this.Cc=this.S.hb;break}!f&&0<this.Aa.length&&this.Aa[0].Ef==this.A.ge&&(f=!0,this.S=this.Aa[0],this.Cc=this.S.hb)}else f=!0;if(f)if(b=(f=this.B.j&&this.B.Vc)&&this.A.bp&&!this.Ha.running,this.Df){h=e;if(b){if(0==this.Cf&&0!=this.B.j.duration)for(;this.Cf<this.S.length/10;)this.Cf+=this.B.j.duration;this.B.j.currentTime<this.Sp&&this.rm&&(this.qm++,this.rm=!1);h=10*(this.qm*this.B.j.duration+this.B.j.currentTime);this.Sp=this.B.j.currentTime;.05>this.B.j.duration-this.B.j.currentTime&&
(this.rm=!0);for(;h>=10*this.Cf;)h-=10*this.Cf}if(!f&&e>=this.S.length||f&&!b&&e>=this.S.length||f&&b&&(this.S.hb!=this.S.zs||this.S.ys!=this.va)&&e>=this.S.length){this.sj(this.S.length);this.A.Ud=0;this.Df=!1;if(this.Ha.running){this.jt();return}f="";if(this.A.kq){b=0;do e=this.Rp[this.S.Ef],f=Math.floor(Math.random()*Object.keys(e).length),f=e[f],this.Cc=f.cliptitle,e=f.nodeid,f=f.startview,b++;while(e==this.va&&10>b)}else this.Cc=this.S.zs,e=this.S.ys,f=this.S.Ux;this.Cc==this.S.hb&&this.va==
e?1<this.eb.length&&0<this.A.fl&&(this.A.startTime=a.getTime(),(b=this.Tq())&&b!=this.va&&(this.$c("{"+b+"}"),this.Df=!1,this.A.active=!0,this.F.Je=!0,this.F.he=!0)):(this.Dd&&e!=this.va&&(this.$c("{"+e+"}",f),this.F.enabled?(this.A.active=!1,this.F.Je=!0,this.F.he=!0):this.A.active=!0),this.A.startTime=a.getTime())}else this.sj(h),this.A.Ud=h}else if(e=this.bc(0,0),f=this.bc(0,1),h=this.bc(0,2),n=this.bc(0,3),3!=n.wb&&(n=0),this.A.cl||this.I.aborted||this.Ha.running||b){if(this.Df=!0,this.A.startTime=
0<this.A.Ud?a.getTime()-100*this.A.Ud:a.getTime(),this.Ie=b){this.Cf=this.qm=0;b=10*this.B.j.currentTime;for(e=Math.floor(b);!this.bc(e,3)&&0<e;)e--;e=this.bc(e,3);e.value==this.$()?this.$h=-1:(this.$h=e.value,this.Yj=b,this.pm=Math.max(5,e.time+e.Mb-b))}}else{b={};if(0<this.A.Ud)b.pan=this.A.Li,b.tilt=this.A.Mi,b.fov=this.A.Ki,b.projection=this.A.$r;else{b.pan=e.value;if(!this.Fa()){for(;360<b.pan;)b.pan-=360;for(;-360>b.pan;)b.pan+=360}b.tilt=f.value;b.fov=h.value;b.projection=n?n.value:4}b.timingFunction=
3;b.speed=1;this.I.fh=!0;this.Vi(b);this.A.active=!0}}else 0<this.A.fl&&this.Dd&&e>=1E3*this.A.fl?1<this.eb.length&&(this.A.startTime=a.getTime(),(b=this.Tq())&&b!=this.va&&(this.A.Ed=a.getTime(),this.A.timeout=0,this.$c("{"+b+"}"),this.A.active=!0,this.F.Je=!0)):(e=a.getTime(),h=f=1E3/60,0!=this.A.Ed&&(h=e-this.A.Ed),b.u.d=this.A.Ml*((this.A.Mr?b.u.Wa:0)-b.u.m)/100,b.fov.d=this.A.Ml*(b.fov.Wa-b.fov.m)/100,b.pan.d=.95*b.pan.d+-this.A.speed*this.ri()*.05,f=h/f,b.pan.m+=b.pan.d*f,b.u.m+=b.u.d*f,b.fov.m+=
b.fov.d*f,this.A.Ed=e,this.update());3E3<a.getTime()-this.A.Vk&&!this.A.ik&&(this.ya.style.cursor="none",this.A.ik=!0)}else!this.Ha.finished&&1E3<a.getTime()-this.cg&&(this.Aa.splice(this.Aa.indexOf(this.S),1),this.S=this.hn(!1),this.Cc=this.S.hb,this.A.active=!1,this.A.pi=!0),this.A.enabled&&!this.U.Lk()&&a.getTime()-this.cg>1E3*this.A.timeout&&!this.A.pi&&(this.A.zh&&this.vi()||!this.A.zh)&&(this.A.active=!0,this.A.startTime=a.getTime(),this.A.Ed=0,this.G("autorotatechanged",{}),b.pan.d=0,b.u.d=
0,b.fov.d=0,b.fov.hd.enabled=!1),!this.ra.enabled||this.U.Lk()||0==b.pan.d&&0==b.u.d&&0==b.fov.d||(this.I.Gk=!0,b.pan.d*=.9,b.u.d*=.9,b.fov.d*=.9,b.pan.m+=b.pan.d,b.u.m+=b.u.d,this.K.Ge&&b.fov.hd.enabled?this.cq(b.fov.d,b.fov.hd):this.bk(b.fov.d),1E-4>b.pan.d*b.pan.d+b.u.d*b.u.d+b.fov.d*b.fov.d&&(b.pan.d=0,b.u.d=0,b.fov.d=0,b.fov.hd.enabled=!1),this.update())}Yt(a){let b=this.F;b.pd=!1;if("previewtrack"==b.delay&&!this.Fa()||"videopano"==b.delay&&!this.B.j)if(0<this.D.M.levels.length)this.D.M.levels[this.D.M.levels.length-
1].loaded||(b.pd=!0);else{let e=!0;this.ea.forEach(f=>{f.Os()||(e=!1)});e||(b.pd=!0)}else"videopano"==b.delay&&this.B.j&&!this.B.dh&&(b.pd=!0);b.pd||this.Hl(a)}Hl(a){a||(a=new Date);let b=this.F;b.pd=!1;b.Id=!0;b.he=this.A.rd;b.Yo=a.getTime()+100;0==b.dd||b.Rh||this.Xo();this.G("transitionstarted",{})}Xo(){let a=this.F;4==a.dd?(this.S=this.hn(!0,a.cp,a.ep,a.Cj),this.Cc=this.S.hb,this.A.active=!0,this.Ha.running=!0):this.moveTo(a.cp,a.ep,a.Cj,a.Sh,0,a.Ce)}uy(a){var b=this.F;if(!b.uj){if(b.be){var e=
(a.getTime()-b.uu)/(1E3*b.tu);1<=e?(b.jo(1),b.be=!1,this.Gq(),this.Wo(),this.Yt(a)):0<=e&&b.jo(e)}else b.Id&&(e=(a.getTime()-b.Yo)/(1E3*b.Mf),1<=e?(b.Id=!1,this.G("transitionended",{}),this.cg=a.getTime(),this.update(),0!=b.dd&&b.Rh&&this.Xo(),4!=b.dd&&(this.xl(!1),this.A.active=b.Je,this.A.rd=b.he,this.G("autorotatechanged",{}),b.Je=!1,b.he=!1),this.A.Ed=0,this.ia&&this.Nm(),this.di=!1):0<=e&&("mesh"==b.type?this.ea[0].D.Fa()||this.ea[1].D.Fa()?b.Yo=1:b.oy(e):b.jo(e)));b=this.ky;b.jv&&(b.jk?a.getTime()-
b.Xm>=1E3*b.delay&&(b.jk=!1):(b.current+=b.Md,0>b.current&&(b.current=0,b.Md=-b.Md,b.jk=!0,b.Xm=a.getTime()),1<b.current&&(b.current=1,b.Md=-b.Md,b.jk=!0,b.Xm=a.getTime())))}}xy(){let a,b=this.P;if(0<b.lc.length){for(a=0;a<b.lc.length;a++)b.Hd[a]!=b.bd[a]&&(b.Hd[a]>b.bd[a]?(b.bd[a]+=.05,b.Hd[a]<b.bd[a]&&(b.bd[a]=b.Hd[a])):(b.bd[a]-=.05,b.Hd[a]>b.bd[a]&&(b.bd[a]=b.Hd[a],-1!=b.Cl.indexOf(b.lc[a])&&(b.Cl.splice(b.Cl.indexOf(b.lc[a]),1),b.lc.splice(a,1),b.Hd.splice(a,1),b.bd.splice(a,1)))));this.update()}if(2==
b.mode)for(a=0;a<this.L.length;a++){let e=this.L[a];"poly"==e.type&&e.ob!=e.Ja&&(e.ob>e.Ja?(e.Ja+=b.Md,e.ob<e.Ja&&(e.Ja=e.ob)):(e.Ja-=b.Md,e.ob>e.Ja&&(e.Ja=e.ob)),this.update())}3==b.mode&&b.ob!=b.Ja&&(b.ob>b.Ja?(b.Ja+=b.Md,b.ob<b.Ja&&(b.Ja=b.ob)):(b.Ja-=b.Md,b.ob>b.Ja&&(b.Ja=b.ob)),this.update())}wy(){var a=this.D;let b=this.ra;this.U.Lk()&&(this.K.uc?(b.na.x=.4*(this.pa.oa.x-b.oa.x),b.na.y=.4*(this.pa.oa.y-b.oa.y),b.oa.x+=b.na.x,b.oa.y+=b.na.y):(b.na.x=.1*-this.pa.na.x*this.K.sensitivity/8,b.na.y=
.1*-this.pa.na.y*this.K.sensitivity/8),this.mu(b.na.x,b.na.y),this.update());b.fov.active&&(this.K.Ge&&b.fov.center.enabled?this.bq(.4*(b.fov.sc-a.fov.m),b.fov.center):this.ai(.4*(b.fov.sc-a.fov.m)),.001>Math.abs(b.fov.sc-a.fov.m)/a.fov.m&&(b.fov.active=!1),this.update());!b.enabled||0==b.na.x&&0==b.na.y||this.U.Lk()||(a=.9*(1-b.Io),b.na.x*=a,b.na.y*=a,this.I.Gk=!0,.01>b.na.x*b.na.x+b.na.y*b.na.y?(b.na.x=0,b.na.y=0):(this.mu(b.na.x,b.na.y),this.update()))}vy(){if(!this.vi()&&this.se&&5<this.D.M.Vs){let a,
b=0,e=this.wd.length;if(this.Mh)e=50,this.$m<e&&this.$m++,b=this.$m;else for(a=0;a<e;a++)(this.wd[a].complete&&this.wd[a].src!=this.Sv||""==this.wd[a].src)&&b++;b==e?(this.$i=1,this.isLoaded=!0,this.ca&&this.ca.ggLoaded&&this.ca.ggLoaded(),this.G("imagesready",{}),this.A.zh&&this.A.enabled&&!this.I.active&&!this.F.be&&(this.A.active=!0,this.A.zh=!1,this.A.startTime=(new Date).getTime(),this.A.Ed=0)):this.$i=b/(1*e);this.G("downloadprogress",{percentLoaded:this.$i})}}Zi(){var a=this;a.sl||(a.Jk?setTimeout(function(){a.sl=
!1;a.Zi()},1E3/60):window.requestAnimationFrame(function(){a.sl=!1;a.Zi()}));a.sl=!0;this.zo=this.rl=0;a.I.Gk=!1;this.qa&&(this.en&&(this.bg(0),this.qd()),this.H.width!=this.ja.offsetWidth||this.H.height!=this.ja.offsetHeight)&&(this.H.width=this.ja.offsetWidth,this.H.height=this.ja.offsetHeight);var b=new Date;this.gn++;120<=this.gn&&(this.gn=0);this.qa&&this.ea.forEach(e=>{e.Pv()});this.qp&&(this.qd(),this.qp=!1);this.wy();this.vy();this.B.j&&this.B.Vc&&!this.Df&&!this.I.fh&&this.Wl&&(this.S=this.Wl,
this.sj(10*this.B.j.currentTime));this.sy(b);this.D.ty();this.uy(b);this.ea.forEach(e=>{e.iA()});(0<=this.P.mode||0<this.P.lc.length)&&this.xy();this.au();this.Oa&&(0<this.Pe?this.Pe--:(this.Oa=!1,this.Pe=0),this.F.Id||this.F.be||this.F.pd||this.zf||(this.Mj(),this.G("renderframe",{})),this.G("repaint",{}));b=this.rn();b!=this.Yr&&(b?(this.ca&&this.ca.ggReLoadedLevels&&this.ca.ggReLoadedLevels(),this.G("tilesrequested",{})):(a.ca&&a.ca.ggLoadedLevels&&a.ca.ggLoadedLevels(),this.G("tilesready",{})),
this.Yr=b)}au(){const a=this.D;this.G("timer",{});this.Tl();if(this.fg.pan!=a.pan.m||this.fg.u!=a.u.m||this.fg.fov!=a.fov.m)this.fg.pan=a.pan.m,this.fg.u=a.u.m,this.fg.fov=a.fov.m,this.G("positionchanged",{});this.Sn!=this.$()&&(this.Sn=this.$(),this.G("projectionchanged",{}))}ui(a){const b=this.D;switch(a){case 4:a=Math.min(110,b.fov.max);break;case 12:a=Math.min(270,b.fov.Xn);a=Math.min(360*this.aspect(),a);a=Math.min(360/this.aspect(),a);break;case 9:a=Math.min(270,b.fov.Yn);break;default:a=90}return a}Tl(){var a=
this.D;this.Rm.Ve(a.pan.m,a.u.m);for(a=0;a<this.X.length+this.V.length;a++){let b;if(a<this.X.length)b=this.X[a];else if(b=this.V[a-this.X.length],b.Gd)continue;b.Tl()}}zz(a,b){let e=this,f=[];let h;if(e.K.lq&&e.qa){let r=[];r.push({text:this.Ma("Rectilinear Projection"),dj:4});r.push({text:this.Ma("Stereographic Projection"),dj:9});r.push({text:this.Ma("Fisheye Projection"),dj:12});for(h=0;h<r.length;h++){let t=r[h],w={};var n="text-align: left;";n+="margin: 0;";n=e.$()==t.dj?n+"padding: 5px 20px 5px 7px;":
n+"padding: 5px 20px;";n+="vertical-align: left;";n+="cursor: pointer;";w.style=n;w.onclick=function(x){return function(){e.Dm(x,1);e.update()}}(t.dj);w.innerHTML=e.$()==t.dj?"&#10687; "+t.text:t.text;f.push(w)}(e.K.Km||e.K.Lm&&e.$g())&&f.push({hr:!0})}e.K.Km&&(n={style:"text-align: left;margin: 0;padding: 5px 20px;vertical-align: left;cursor: pointer;",onclick:function(){e.Nl()}},n.innerHTML=e.Gi()?this.Ma("Exit Fullscreen"):this.Ma("Enter Fullscreen"),f.push(n));e.K.Lm&&e.$g()&&(n={style:"text-align: left;margin: 0;padding: 5px 20px;vertical-align: left;cursor: pointer;",
onclick:function(){e.Pg()}},n.innerHTML=this.Ma("Enter VR"),f.push(n));e.Az(a,b,f)}hv(){let a=this,b;b=a.ya;a.control=b;a.control=b;setTimeout(function(){a.Zi()},10);setTimeout(function(){a.Ks()},200);setTimeout(function(){a.Fe();a.Mj()},10);b.addEventListener&&(b.addEventListener("touchstart",function(e){a.Xz(e)},!1),b.addEventListener("touchmove",function(e){a.Wz(e)},!1),b.addEventListener("touchend",function(e){a.Vz(e)},!1),b.addEventListener("touchcancel",function(e){a.Uz(e)},!1),b.addEventListener("pointerdown",
function(e){a.xs(e)},!1),b.addEventListener("MSPointerDown",function(e){a.xs(e)},!1),b.addEventListener("MSGestureStart",function(e){a.Rq(e)},!1),b.addEventListener("MSGestureEnd",function(e){a.Qq(e)},!1),b.addEventListener("MSGestureChange",function(e){a.Qx(e)},!1),b.addEventListener("gesturestart",function(e){a.Rq(e)},!1),b.addEventListener("gesturechange",function(e){a.aw(e)},!1),b.addEventListener("gestureend",function(e){a.Qq(e)},!1),b.addEventListener("mousedown",function(e){a.Px(e)},!1),b.addEventListener("mousemove",
function(e){a.Ox(e)},!1),document.addEventListener("mouseup",function(e){a.Nx(e)},!1),b.addEventListener("mousewheel",function(e){a.us(e)},!1),b.addEventListener("DOMMouseScroll",function(e){a.us(e)},!1),document.addEventListener("keydown",function(e){a.wx(e)},!1),document.addEventListener("keyup",function(e){a.xx(e)},!1),window.addEventListener("resize",function(){a.Fe()},!1),a.container.addEventListener("resize",function(){a.Fe()},!1),window.addEventListener("blur",function(){a.Zx()},!1),a.T.addEventListener("webkitfullscreenchange",
function(){a.Yi()},!1),document.addEventListener("mozfullscreenchange",function(){a.Yi()},!1),window.addEventListener("webkitfullscreenchange",function(){a.Yi()},!1),document.addEventListener("MSFullscreenChange",function(){a.Yi()},!1),document.addEventListener("fullscreenchange",function(){a.Yi()},!1));b.oncontextmenu=function(e){void 0===e&&(e=window.event);if(e.target&&!a.ec(e.target))return!0;if(!e.ctrlKey){a.Uf(e);const f=a.Wf();a.zz(e.clientX-f.x,e.clientY-f.y);return!1}return!0};window.addEventListener("deviceorientation",
function(e){a.hy(e.alpha,e.beta,e.gamma,e.absolute);null!=e.alpha&&null!=e.beta&&null!=e.gamma&&0==a.An&&(a.An=!0,a.G("gyroavailable",{available:!0}),a.G("playerstatechanged",{}))})}Lp(){for(let a=0;a<this.L.length;a++)if("point"==this.L[a].type&&(this.la&&this.la.addSkinHotspot?(this.L[a].Rf(),this.L[a].j=this.la.addSkinHotspot(this.L[a])):(this.L[a].j=new DC(this,this.L[a]),this.L[a].yd&&this.L[a].wg&&(this.L[a].j.ggUse3d=!0,this.L[a].j.gg3dDistance=this.L[a].kk)),this.L[a].j.__div.style.left="-1000px",
this.L[a].j.__div.style.top="-1000px",this.L[a].j&&this.L[a].j.__div)){let b=this.ya.firstChild;b?this.ya.insertBefore(this.L[a].j.__div,b):this.ya.appendChild(this.L[a].j.__div)}}sv(){if(!this.la||!this.la.addSkinHotspot)for(var a=0;a<this.L.length;a++)"point"==this.L[a].type&&this.L[a].j&&this.L[a].j.Vw()}tv(){for(var a=0;a<this.$a.length;a++)this.$a[a].je();for(a=0;a<this.Vb.length;a++)this.Vb[a].je();for(a=0;a<this.X.length;a++)this.X[a].je();for(a=0;a<this.V.length;a++)this.V[a].je()}am(){let a,
b=document.createElement("fakeelement"),e={OTransition:"oTransitionEnd",MSTransition:"msTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd",transition:"transitionEnd"};for(a in e)if(void 0!==b.style[a])return e[a]}Ya(a){let b=[];a="*"==a?"^.*$":"#"==a.substring(0,1)?a.substring(1):"^"+a+"$";a=new RegExp(a,"");for(var e=0;e<this.X.length;e++)a.test(this.X[e].id)&&b.push(this.X[e]);for(e=0;e<this.V.length;e++)a.test(this.V[e].id)&&b.push(this.V[e]);for(e=0;e<this.$a.length;e++)a.test(this.$a[e].id)&&
b.push(this.$a[e]);for(e=0;e<this.Vb.length;e++)a.test(this.Vb[e].id)&&b.push(this.Vb[e]);return b}gr(a){if("_videopanorama"==a)return this.B.j;a=this.Ya(a);return 0<a.length?a[0].j:null}fr(a){a=this.Ya(a);return 0<a.length&&a[0].ua?a[0]:null}Ss(a,b){let e=this;b.addEventListener("ended",function(n){e.G("videoended",{video:n.target})});b.addEventListener("pause",function(n){e.G("videopaused",{video:n.target})});b.addEventListener("play",function(n){e.G("videostarted",{video:n.target})});let f=null;
for(var h=0;h<this.V.length;h++)this.V[h].id==a&&(this.V[h].j=b,f=this.V[h]);f||(f=new Sm(this),f.registerElement(a,b));e.Ec&&f.Oo(1);return f}isPlaying(a){if("_main"===a)return!0;a=this.Ya(a);return 0<a.length?a[0].ua?a[0].jh:!a[0].j.ended&&!a[0].j.paused:!1}Yd(a,b){let e=null;if(!this.Ec)try{let h=this.Ya(a);for(var f=0;f<h.length;f++){let n=h[f];n instanceof wg&&(n.jb=b&&!isNaN(Number(b))?Number(b)-1:n.loop-1,-1>=n.jb&&(n.jb=1E7),this.isPlaying(a)&&this.Bj(a),n.ua?n.ie():(e=n.j.play(),void 0!==
e&&e.then(()=>{this.vh(!0)}).catch(()=>{this.vh(!1)}),n.Kd&&n.He()),this.pj(n.id,!1))}}catch(h){}return e}no(a,b){a=this.Ya(a);for(var e=0;e<a.length;e++){let f=a[e];this.isPlaying(f.id)?this.ih(f.id):this.Yd(f.id,b)}}Ns(a,b){a=this.Ya(a);for(var e=0;e<a.length;e++){let f=a[e];f instanceof wg&&(this.isPlaying(f.id)?this.Bj(f.id):this.Yd(f.id,b))}}ih(a){try{let b;if("_main"==a){this.pj(a,!0);for(b=0;b<this.X.length;b++)this.X[b].ua?this.X[b].ym():this.X[b].j.pause();for(b=0;b<this.V.length;b++)this.V[b].j.pause()}else{let e=
this.Ya(a);for(b=0;b<e.length;b++){let f=e[b];f instanceof wg&&(this.pj(f.id,!0),f.ua?f.ym():f.j.pause())}}}catch(b){}}Ip(a,b){a=this.Ya(a);for(var e=0;e<a.length;e++){let f=a[e];0==b||1==b?f.Xf&&f.Xf(1==b):2==b&&f.Ye&&f.Ye();!f.Pa||-1==this.$a.indexOf(f)&&-1==this.V.indexOf(f)&&-1==this.Vb.indexOf(f)||(this.Xb=this.lf=f)}}Bj(a){let b;try{if("_main"===a){this.pj(a,!0);for(b=0;b<this.X.length;b++)this.X[b].ua?this.X[b].Fg():(this.X[b].j.pause(),this.X[b].j.currentTime=0);for(b=0;b<this.V.length;b++)this.V[b].j.pause(),
this.V[b].j.currentTime=0}else{let e=this.Ya(a);for(b=0;b<e.length;b++){let f=e[b];f instanceof wg&&(this.pj(f.id,!0),f.ua?f.Fg():f.j&&f.j.pause&&(f.j.pause(),f.j.currentTime=0))}}}catch(e){}}pj(a,b){a=this.Ya("_main"===a?".*":a);for(let e=0;e<a.length;e++){let f=a[e];f.stopped=b;f.$o=!1}}Ct(a){a=this.Ya(a);return 0<a.length?(a=a[0],a instanceof wg?a.ua?a.mv():a.j?a.j.currentTime:0:0):0}Et(a,b){a=this.Ya(a);for(let e=0;e<a.length;e++){let f=a[e];f instanceof wg&&(f.ua?(0>b&&(b=0),b>f.audioBuffer.duration&&
(b=f.audioBuffer.duration-.1),f.nv(b)):f.j&&(0>b&&(b=0),b>f.j.duration&&(b=f.j.duration-.1),f.j.currentTime=b))}}Dt(a,b){a=this.Ya(a);0<a.length&&(a=a[0],a.j&&(a.j.playbackRate=b))}setVolume(a,b){try{let e,f=Number(b);1<f&&(f=1);0>f&&(f=0);"_videopanorama"===a&&this.B.j&&(this.B.j.volume=f,this.B.level=f);if("_main"===a){this.ga=f;for(e=0;e<this.X.length;e++)this.X[e].j.volume=this.X[e].level*this.ga;for(e=0;e<this.V.length;e++)this.V[e].j.volume=this.V[e].level*this.ga;this.B.j&&(this.B.j.volume=
this.ga*this.B.level)}else{let h=this.Ya(a);for(e=0;e<h.length;e++){let n=h[e];n.j&&null!=n.j.volume&&(n.j.volume=f*this.ga);n.level=f}}}catch(e){}this.G("elementvolume",{id:a,type:"set",volume:b})}hq(a,b){try{let e,f;"_videopanorama"===a&&this.B.j&&(this.B.j.volume+=Number(b));if("_main"===a){e=this.ga;e+=Number(b);1<e&&(e=1);0>e&&(e=0);this.ga=e;for(f=0;f<this.X.length;f++)this.X[f].j.volume=this.X[f].level*this.ga;for(f=0;f<this.V.length;f++)this.V[f].j.volume=this.V[f].level*this.ga;this.B.j&&
(this.B.j.volume=this.ga*this.B.level)}else{let h=this.Ya(a);for(f=0;f<h.length;f++){let n=h[f];n instanceof wg&&(e=n.level,e+=Number(b),1<e&&(e=1),0>e&&(e=0),n.level=e,n.j&&null!=n.j.volume&&(n.j.volume=e*this.ga))}}}catch(e){}this.G("elementvolume",{id:a,type:"change",volume:b})}Al(a,b){if("_main"===a||"_all"===a||"_videopanorama"===a)"_all"===a&&(b=(this.Ec=1==b||-1==b&&!this.Ec?!0:!1)?1:0),this.B.j&&(this.B.j.muted=-1==b?!this.B.j.muted:1==b);let e=this.Ya("_main"===a||"_all"===a?".*":a);for(let f=
0;f<e.length;f++){let h=e[f];h.Oo&&h.Oo(b)}this.G("elementmuted",{id:a,state:b})}It(){this.Wg();this.me&&setTimeout(()=>{this.Wg()},500)}yl(a,b,e){a.j.style.opacity=0==b?1:0;a.j.style[this.Pc]="opacity "+e+"ms";a.j.style.opacity=0==b?0:1}zl(a,b,e){let f=this.Ya(a);for(var h=0;h<f.length;h++){let n=f[h];n.j&&(this.df()?this.ka.zl(a,b,e):0==b?(this.yl(n,b,e),setTimeout(function(){0==n.j.style.opacity&&n.pg(!1)},e+10),n.dc=!1):1==b?(this.yl(n,b,e),n.pg(!0),n.dc=!0):2==b&&("visible"==n.j.style.visibility?
(this.yl(n,0,e),setTimeout(function(){0==n.j.style.opacity&&n.pg(!1)},e+10),n.dc=!1):(this.yl(n,1,e),n.pg(!0),n.dc=!0)))}}Wo(){try{let a=this,b=!1,e=!1;for(let f=0;f<this.X.length;f++){let h=this.X[f];if(-1==h.loop||this.isPlaying(h.id))continue;if(h.stopped)continue;let n;this.ha&&this.cb.enabled&&4!=h.mode&&6!=h.mode&&!this.Ec?this.cb.sq?(h.ua?h.ie():(n=h.j.play(),h.Kd&&h.He(),h.j.currentTime=0),h.wa=0,e=!0):b=!0:4==h.mode||6==h.mode||"_background"==h.id&&this.isPlaying(h.id)||this.Ec||!(0==h.loop||
0<h.jb)||(h.ua?h.ie():(n=h.j.play(),h.j.currentTime&&(h.j.currentTime=0)));void 0!==n&&n.then(()=>{this.vh(!0)}).catch(()=>{this.vh(!1)})}b&&setTimeout(function(){a.cb.Jz()},1E3*this.cb.Mb);e&&(this.cb.Ez=this.ha.currentTime,this.cb.Dz=setInterval(function(){a.cb.Yv()},10))}catch(a){}}Gq(){for(let a=0;a<this.cb.Kj.length;a++)this.cb.Fq(this.cb.Kj[a])}Eo(){if(this.N&&this.N!=this.Xa&&this.N.div&&this.N.div.onmouseout)this.N.div.onmouseout();let a;for(;0<this.L.length;)a=this.L.pop(),a.j&&(this.ya.removeChild(a.j.__div),
delete a.j),a.j=null;this.P.Ja=0;this.P.ob=0;this.G("hotspotsremoved",{})}wh(a){this.Cg=a;this.T.style.zIndex=0!=a?a.toString():"auto";this.ya.style.zIndex=(a+4).toString();this.te.style.zIndex=(a+5).toString();for(let b=0;b<this.Ck();b++){let e;e=b<this.V.length?this.V[b]:this.$a[b-this.V.length];e.j&&(e.j.style.zIndex=(a+(e.Pa?8E4:0)).toString())}}lj(a){let b=this.vc!==a;this.vc!==a&&(this.vc=a,this.update(100));if(this.vc){if(this.Nh)try{this.T.webkitRequestFullScreen?this.T.webkitRequestFullScreen():
this.T.mozRequestFullScreen?this.T.mozRequestFullScreen():this.T.msRequestFullscreen?this.T.msRequestFullscreen():this.T.requestFullScreen?this.T.requestFullScreen():this.T.requestFullscreen&&this.T.requestFullscreen()}catch(e){}this.T.style.position="absolute";a=this.Wf();this.T.style.left=window.pageXOffset-a.x+this.margin.left.ba+"px";this.T.style.top=window.pageYOffset-a.y+this.margin.top.ba+"px";this.wh(10);document.body.style.overflow="hidden";b&&(this.ca&&this.ca.ggEnterFullscreen&&this.ca.ggEnterFullscreen(),
this.G("fullscreenenter",{}),this.G("playerstatechanged",{}))}else{if(this.Nh)try{document.webkitIsFullScreen?document.webkitCancelFullScreen():document.mozFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.fullScreen&&(document.cancelFullScreen?document.cancelFullScreen():document.exitFullscreen&&document.exitFullscreen())}catch(e){}this.T.style.position="relative";this.T.style.left="0px";this.T.style.top="0px";this.wh(0);document.body.style.overflow=
"";b&&(this.ca&&this.ca.ggExitFullscreen&&this.ca.ggExitFullscreen(),this.G("fullscreenexit",{}),this.G("playerstatechanged",{}))}this.Fe()}Pg(a){this.ka.Jv();this.Pk||this.Ok||this.Xs();this.ka.Pg(a);this.ka.jy();return!0}Nw(){return"N/A"}Mw(){if(this.ka)return this.ka.df()?this.ka.Yl:this.ka.camera}Ow(){if(this.ka)return this.ka.Bb}iz(a,b){this.ka.ht(a,b)}Pw(){return this.ka.Lc}jz(a){this.ka&&(this.ka.Ue=a)}Qg(){this.ka&&(this.ka.Qg(),this.ka.og(),this.ka.Im());return!0}St(){this.ka&&(this.ka.df()?
this.Qg():this.Pg());return!0}df(){return this.ka&&this.ka.df()?!0:!1}$g(){return this.ka&&this.ka.$g()?!0:!1}tt(a){return this.ka?(2==a?this.ka.ze():this.ka.ze(0!=a),!0):!1}Ak(){return this.ka?this.ka.Ak():!1}lz(a){this.ka&&this.ka.ez(a)}kz(a){this.ka&&this.ka.Sy(a)}Jt(a,b,e){this.A.ge=this.A.Zj;this.A.rd=this.A.yg;this.A.enabled=!0;this.A.Dg=this.A.enabled;this.A.active=!0;this.A.Ed=0;let f=new Date;this.A.Ud=0;this.A.startTime=f.getTime();void 0!==a&&0!=a&&(this.A.speed=a);void 0!==b&&(this.A.timeout=
b);void 0!==e&&(this.A.Ml=e);this.G("autorotatechanged",{})}Mt(){this.A.active=!1;this.A.enabled=!1;this.A.Dg=this.A.enabled;this.Df=this.A.cl=!1;this.I.active&&this.I.fh&&(this.I.active=!1,this.I.fh=!1,this.I.vb=0);this.G("autorotatechanged",{})}Rt(){this.A.enabled=!this.A.active;this.A.Dg=this.A.enabled;this.A.active=this.A.enabled;this.A.Ed=0;if(this.A.enabled){let a=new Date;this.A.Ud=0;this.A.startTime=a.getTime();this.A.ge=this.A.Zj;this.A.rd=this.A.yg}this.G("autorotatechanged",{})}Ls(){this.sa(!1)}Zs(){this.A.enabled&&
(this.A.active=!0,this.A.Ed=0)}gt(a){this.A.gh=a;this.A.Bs=!0}Ft(a){this.Ha.running&&this.jt();this.Cc="";a&&""!=a&&(this.A.ge=a);this.A.Dg=this.A.enabled;this.A.rd=!0;this.A.enabled=!0;this.A.active=!0;this.A.Ed=0;this.F.Id&&(this.F.he=!0,this.F.Je=!0);a=new Date;this.A.Ud=0;this.A.startTime=a.getTime();this.G("autorotatechanged",{})}Iy(a){a&&""!=a&&this.A.ge!=a||0==this.A.Ud?this.Ft(a):(this.A.rd=!0,this.A.enabled=!0,this.A.active=!0,this.G("autorotatechanged",{}))}jt(){this.Ha.running=!1;this.Ha.finished=
!0;this.A.active=this.F.Je;this.A.rd=this.F.he;this.Aa.splice(this.Aa.indexOf(this.S),1);0<this.Aa.length&&(this.S=this.Aa[0]);this.Cc="";this.xl(!1);this.F.Je=!1;this.F.he=!1;this.cg=(new Date).getTime()}iq(a){if(this.container=document.getElementById(a))return this.container.innerHTML="",!0;alert("container not found!");return!1}it(a){let b=this;b.container.removeEventListener("resize",function(){b.Fe()});b.iq(a)&&(b.container.appendChild(b.T),b.container.addEventListener("resize",function(){b.Fe()},
!1))}Om(a){this.iq(a)&&(this.T=document.createElement("div"),this.T.onselectstart=function(){return!1},this.T.setAttribute("id","viewport"),this.T.setAttribute("role","application"),a="top: 0px;left: 0px;position: relative;perspective: none;-ms-touch-action: none;touch-action: none;-webkit-user-select: none;user-select: none;text-align: left;"+(this.Yb+"user-select: none;"),this.T.setAttribute("style",a),this.container.appendChild(this.T),this.ja=document.createElement("div"),a="top:\t0px;left: 0px;width:  100px;height: 100px;overflow: hidden;position:absolute;-ms-touch-action: none;touch-action: none;"+
(this.Yb+"user-select: none;"),this.ja.setAttribute("id","viewer"),this.ja.setAttribute("style",a),this.T.appendChild(this.ja),this.ya=document.createElement("div"),this.ya.setAttribute("id","hotspots"),a="top:\t0px;left: 0px;width:  100px;height: 100px;overflow: hidden;position:absolute;",this.Ln&&(a+="background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);"),this.Pb&&!this.qa&&(a+=this.Yb+"transform: translateZ(9999999px);"),a+=this.Yb+"user-select: none;",
this.ya.setAttribute("style",a),this.T.appendChild(this.ya),this.te=document.createElement("div"),this.te.setAttribute("id","hotspottext"),this.te.setAttribute("style","top:\t0px;left: 0px;position:absolute;padding: 3px;visibility: hidden;"),this.te.classList.add("ggskin"),this.te.classList.add("ggdefaulthotspot"),this.te.innerHTML=" Hotspot text!",this.T.appendChild(this.te),this.divSkin=this.ca=this.ya,this.wh(0))}og(){var a;this.ra.na.x=0;this.ra.na.y=0;this.ea.forEach(f=>{f.og()});let b=[];for(a=
0;a<this.V.length;a++){var e=this.V[a];e.Gd?b.push(e):e.nf()}for(a=0;a<this.$a.length;a++)this.$a[a].nf();for(a=0;a<this.Vb.length;a++)this.Vb[a].nf();this.P.Rn=-1;this.nd=0;this.sg=[];this.cb.Kj=[];for(a=0;a<this.X.length;a++)e=this.X[a],e.As||7>this.ed&&0==e.mode||this.sg.push(e);this.V=b;this.$a=[];this.Vb=[];this.B.j&&(this.T.removeChild(this.B.j),this.B.j=null,a=this.Ya("_videopanorama"),0<a.length&&(a[0].j=null));this.B.Vc=!1;this.B.dh=!1}rv(a){a="{"==a.charAt(0)?a.slice(1,a.length-1):a;let b=
this.Ne[a];b&&(a=b);this.G("beforechangenodeid",{oldNodeId:this.va,nodeId:a});this.yn?this.yn=!1:this.bo.push(this.va);""!=this.va&&-1==this.Xl.indexOf(this.va)&&(this.Xl.push(this.va),this.G("changevisitednodes",{}));this.Zr=this.va;this.va=a;this.la&&this.la.changeActiveNode&&this.la.changeActiveNode("{"+a+"}");this.Te=!0}Bd(){return this.va}jr(a){return 0<this.eb.length?(a||(a=this.va),a=this.eb.indexOf(a),a++,a>=this.eb.length&&(a=0),this.eb[a]):""}sr(a){return 0<this.eb.length?(a||(a=this.va),
a=this.eb.indexOf(a),a--,0>a&&(a=this.eb.length-1),this.eb[a]):""}qw(){return this.Zr}Jw(){return this.cd}Vx(a){return-1!=this.Xl.indexOf(a)}yv(){this.Xl=[];this.G("changevisitednodes",{})}yo(a,b){a=a.firstChild;this.yf=[];this.eb=[];this.Ne=[];this.Zg=!1;var e;(e=a.getAttributeNode("appversion"))&&e.nodeValue.toString().match(/(\d+)\.(\d+)\.?(\d+)?/);for(var f=a.firstChild;f;){if("map"==f.nodeName){var h={};(e=f.getAttributeNode("index"))&&(h.index=Number(e.nodeValue));(e=f.getAttributeNode("title"))&&
(h.title=e.nodeValue.toString());e=f.getAttributeNode("type");h.type=e.nodeValue.toString();"web"==h.type?(e=f.getAttributeNode("mapprovider"),h.mapprovider=e.nodeValue.toString(),(e=f.getAttributeNode("mapstyle"))&&(h.mapstyle=e.nodeValue.toString()),(e=f.getAttributeNode("googlecustomstylecode"))&&(h.googlecustomstylecode=e.nodeValue.toString()),(e=f.getAttributeNode("mapurltemplate"))&&(h.mapurltemplate=e.nodeValue.toString()),(e=f.getAttributeNode("mapmaxzoom"))&&(h.mapmaxzoom=Number(e.nodeValue)),
(e=f.getAttributeNode("customlayernames"))&&(h.customlayernames=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("customlayerurltemplates"))&&(h.customlayerurltemplates=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("customlayermaxzooms"))&&(h.customlayermaxzooms=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("mapkey"))&&(h.mapkey=e.nodeValue.toString()),(e=f.getAttributeNode("styleurl"))&&(h.styleurl=e.nodeValue.toString()),(e=f.getAttributeNode("mapboxlayernames"))&&
(h.mapboxlayernames=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("mapboxlayerstyleurls"))&&(h.mapboxlayerstyleurls=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("googlelayernames"))&&(h.googlelayernames=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("googlelayerstyles"))&&(h.googlelayerstyles=e.nodeValue.toString().split("|")),(e=f.getAttributeNode("maplimits"))&&(h.maplimits=e.nodeValue.toString().split("|"))):(e=f.getAttributeNode("width"),h.width=Number(e.nodeValue),
e=f.getAttributeNode("height"),h.height=Number(e.nodeValue),e=f.getAttributeNode("zoomlevels"),h.zoomlevels=Number(e.nodeValue),e=f.getAttributeNode("tileformat"),h.tileformat=e.nodeValue.toString(),e=f.getAttributeNode("bgcolor"),h.bgcolor=e.nodeValue.toString(),e=f.getAttributeNode("crispedges"),h.crispedges=1==e.nodeValue,e=f.getAttributeNode("transparent"),h.transparent=1==e.nodeValue,e=f.getAttributeNode("floorplannorth"),h.floorplannorth=Number(e.nodeValue));e=f.getAttributeNode("id");this.xc[e.nodeValue.toString()]=
h}f=f.nextSibling}if("tour"==a.nodeName){this.Dd=!0;if(e=a.getAttributeNode("start"))this.cd=e.nodeValue.toString();if(e=a.getAttributeNode("hassounds"))this.Zg=1==e.nodeValue;this.hasOwnProperty("startNode")&&this.startNode&&(this.cd=String(this.startNode),this.startNode="");this.hasOwnProperty("startView")&&this.startView&&("object"===typeof this.startView&&null!==this.startView?b=this.startView:""!=this.startView&&(b=String(this.startView)),this.startView="");f=a.firstChild;for(a=h="";f;){if("panorama"==
f.nodeName){if(e=f.getAttributeNode("id"))h=e.nodeValue.toString(),""==this.cd&&(this.cd=h),""==a&&(a=h),this.yf[h]=f,this.eb.push(h);for(e=f.firstChild;e;){if("userdata"==e.nodeName){var n=this.Rg(e);this.Af[h]=n;h==this.cd&&(this.Af._first=n);n.customnodeid&&(this.Ne[n.customnodeid]=h);this.Xc[h]=this.Cq(e);this.eh[h]=this.Dq(e);this.Ag[h]=this.Eq(e)}if("hotspots"==e.nodeName)for(n=e.firstChild;n;)"hotspot"!=n.nodeName&&"polyhotspot"!=n.nodeName||this.an(h,e),n=n.nextSibling;e=e.nextSibling}}if("masternode"==
f.nodeName)for(e=f.firstChild;e;){"userdata"==e.nodeName&&(n=this.Rg(e),this.Af._master=n);"animationsequences"==e.nodeName&&this.Wv(e);if("translations"==e.nodeName){(n=e.getAttributeNode("json"))&&this.Yh(n.nodeValue.toString());let r=e.firstChild;for(;r;){"json"==r.nodeName&&this.Yh(r.textContent);if("projecttranslation"==r.nodeName){let t={};if(n=r.getAttributeNode("langcode"))t.langCode=n.nodeValue;if(n=r.getAttributeNode("langname"))t.langName=n.nodeValue;this.to.push(t)}r=r.nextSibling}this.Qn||
this.No(window.navigator.language)}e=e.nextSibling}"customproperty"==f.nodeName&&this.Bq(f);f=f.nextSibling}!this.yf.hasOwnProperty(this.cd)&&(f=this.Ne[this.cd])&&(this.cd=f);this.yf.hasOwnProperty(this.cd)||(this.Rb("Start node "+this.cd+" not found!"),this.cd=a);this.wo(this.yf[this.cd],b,this.ea[0].D)}else{this.Dd=!1;this.wo(a,b);if(e=a.getAttributeNode("hassounds"))this.Zg=1==e.nodeValue;this.eb.push("")}this.zf&&this.ka.Wj();this.Zg&&(this.ix(),this.Gt());this.G("configloaded",{});this.G("changenode",
{});this.G("playerstatechanged",{})}wo(a,b,e){e||(e=this.D);this.rf(this.Xa);this.Eo();this.Wc&&this.Wc.Fy();this.og();this.Wl=0;var f;let h="";(f=a.getAttributeNode("id"))&&(h=f.nodeValue.toString());let n={oldNodeId:this.va,nodeId:h};var r,t=0,w=e.M;let x=a.firstChild;for(;x;){if("view"==x.nodeName){if(f=x.getAttributeNode("fovmode"))e.fov.mode=Number(f.nodeValue);f=x.getAttributeNode("pannorth");e.pan.eo=1*(f?f.nodeValue:0);for(var y=x.firstChild;y;){"start"==y.nodeName&&(f=y.getAttributeNode("pan"),
e.pan.m=Number(f?f.nodeValue:0),e.pan.Wa=e.pan.m,f=y.getAttributeNode("tilt"),e.u.m=Number(f?f.nodeValue:0),e.u.Wa=e.u.m,f=y.getAttributeNode("roll"),e.Y.m=Number(f?f.nodeValue:0),e.Y.Wa=e.Y.m,f=y.getAttributeNode("fov"),e.fov.m=Number(f?f.nodeValue:70),e.fov.Wa=e.fov.m,f=y.getAttributeNode("projection"),e.Is=Number(f?f.nodeValue:4),this.bb(this.xi()));"min"==y.nodeName&&(f=y.getAttributeNode("pan"),e.pan.min=1*(f?f.nodeValue:0),f=y.getAttributeNode("tilt"),e.u.min=1*(f?f.nodeValue:-90),f=y.getAttributeNode("fov"),
e.fov.min=1*(f?f.nodeValue:5),1E-20>e.fov.min&&(e.fov.min=1E-20),f=y.getAttributeNode("fovpixel"),e.fov.Ti=1*(f?f.nodeValue:0));if("max"==y.nodeName){f=y.getAttributeNode("pan");e.pan.max=1*(f?f.nodeValue:0);f=y.getAttributeNode("tilt");e.u.max=1*(f?f.nodeValue:90);f=y.getAttributeNode("fov");e.fov.max=1*(f?f.nodeValue:120);180<=e.fov.max&&(e.fov.max=179.9);if(f=y.getAttributeNode("fovstereographic"))e.fov.Yn=1*f.nodeValue;if(f=y.getAttributeNode("fovfisheye"))e.fov.Xn=1*f.nodeValue;if(f=y.getAttributeNode("scaletofit"))this.K.et=
1==f.nodeValue}if("flyin"==y.nodeName){if(f=y.getAttributeNode("projection"))e.jd.vb=Number(f.nodeValue);if(f=y.getAttributeNode("pan"))e.jd.pan=parseFloat(f.nodeValue);if(f=y.getAttributeNode("tilt"))e.jd.u=parseFloat(f.nodeValue);if(f=y.getAttributeNode("fov"))e.jd.fov=parseFloat(f.nodeValue)}y=y.nextSibling}}if("autorotate"==x.nodeName){if(f=x.getAttributeNode("speed"))this.A.speed=1*f.nodeValue;if(f=x.getAttributeNode("delay"))this.A.timeout=1*f.nodeValue;if(f=x.getAttributeNode("returntohorizon"))this.A.Ml=
1*f.nodeValue;if(f=x.getAttributeNode("horizonfromdefview"))this.A.Mr=1==f.nodeValue;if(f=x.getAttributeNode("nodedelay"))this.A.fl=1*f.nodeValue;if(f=x.getAttributeNode("noderandom"))this.A.Cs=1==f.nodeValue;(f=x.getAttributeNode("nodefilter"))&&!this.A.Bs&&(this.A.gh=f.nodeValue);this.Rd&&(this.A.enabled=!0,this.A.Dg=!0,this.A.active=!1);(f=x.getAttributeNode("startloaded"))&&this.Rd&&(this.A.zh=1==f.nodeValue,this.A.zh&&(this.A.active=!1));if(f=x.getAttributeNode("useanimation"))this.A.yg=1==f.nodeValue,
this.A.rd=this.A.yg;if(f=x.getAttributeNode("syncanimationwithvideo"))this.A.bp=1==f.nodeValue}if("animation"==x.nodeName){if(f=x.getAttributeNode("syncanimationwithvideo"))this.A.bp=1==f.nodeValue;if(f=x.getAttributeNode("useinautorotation"))this.A.yg=1==f.nodeValue;if(f=x.getAttributeNode("animsequence"))this.A.Zj=f.nodeValue,this.Rd&&(this.A.ge=this.A.Zj);if(f=x.getAttributeNode("clipsrandom"))this.A.kq=1==f.nodeValue;this.Aa=[];for(y=x.firstChild;y;){if("clip"==y.nodeName){this.S=new Qx;if(f=
y.getAttributeNode("animtitle"))this.S.Ef=f.nodeValue.toString();if(f=y.getAttributeNode("cliptitle"))this.S.hb=f.nodeValue.toString();if(f=y.getAttributeNode("nodeid"))this.S.iB=f.nodeValue.toString();if(f=y.getAttributeNode("length"))this.S.length=Number(f.nodeValue);if(f=y.getAttributeNode("animtype"))this.S.ev=Number(f.nodeValue);if(f=y.getAttributeNode("nextcliptitle"))this.S.zs=f.nodeValue.toString();if(f=y.getAttributeNode("nextclipnodeid"))this.S.ys=f.nodeValue.toString();if(f=y.getAttributeNode("nextclipstartview"))this.S.Ux=
f.nodeValue.toString();if(f=y.getAttributeNode("transitiontype"))this.S.$z=Number(f.nodeValue);var z=y.firstChild;for(this.S.La=[];z;){if("keyframe"==z.nodeName){let eb=new bg;if(f=z.getAttributeNode("time"))eb.time=Number(f.nodeValue);if(f=z.getAttributeNode("value"))eb.value=Number(f.nodeValue);if(f=z.getAttributeNode("valuestring"))eb.tp=f.nodeValue.toString();if(f=z.getAttributeNode("transitiontime"))eb.Mb=Number(f.nodeValue);f=z.getAttributeNode("type");let cb=0;f&&(eb.type=Number(f.nodeValue),
cb=Number(f.nodeValue));if(f=z.getAttributeNode("property"))eb.wb=Number(f.nodeValue);if(f=z.getAttributeNode("additionaltrackid"))eb.Ld=f.nodeValue.toString();if(f=z.getAttributeNode("additionaltracktype"))eb.Np=Number(f.nodeValue);if(1==cb||2==cb){if(f=z.getAttributeNode("bezierintime"))eb.Hf=Number(f.nodeValue);if(f=z.getAttributeNode("bezierinvalue"))eb.If=Number(f.nodeValue);if(f=z.getAttributeNode("bezierouttime"))eb.Jf=Number(f.nodeValue);if(f=z.getAttributeNode("bezieroutvalue"))eb.Kf=Number(f.nodeValue)}this.S.La.push(eb)}z=
z.nextSibling}this.Aa.push(this.S);"__VideoPano"==this.S.hb&&(this.Wl=this.S)}y=y.nextSibling}}"input"==x.nodeName&&(r||(r=x));if(r)for(y=0;6>y;y++)f=r.getAttributeNode("prev"+y+"url"),this.hi[y]=f?String(f.nodeValue):"";"altinput"==x.nodeName&&(y=0,(f=x.getAttributeNode("screensize"))&&(y=1*f.nodeValue),0<y&&y<=this.er()&&y>t&&(t=y,r=x));if("control"==x.nodeName&&this.Rd){if(f=x.getAttributeNode("simulatemass"))this.ra.enabled=1==f.nodeValue;if(f=x.getAttributeNode("rubberband"))this.K.ct=1==f.nodeValue;
if(f=x.getAttributeNode("zoomcentercursor"))this.K.Ge=1==f.nodeValue;if(f=x.getAttributeNode("locked"))this.K.wc=1==f.nodeValue;f&&(this.K.Oi=1==f.nodeValue);if(f=x.getAttributeNode("lockedmouse"))this.K.wc=1==f.nodeValue;if(f=x.getAttributeNode("lockedkeyboard"))this.K.Oi=1==f.nodeValue;if(f=x.getAttributeNode("lockedkeyboardzoom"))this.K.Ix=1==f.nodeValue;if(f=x.getAttributeNode("lockedwheel"))this.K.gf=1==f.nodeValue;if(f=x.getAttributeNode("invertwheel"))this.K.Rr=1==f.nodeValue;if(f=x.getAttributeNode("speedwheel"))this.K.Vo=
1*f.nodeValue;if(f=x.getAttributeNode("invertcontrol"))this.K.uc=1==f.nodeValue;if(f=x.getAttributeNode("sensitivity"))this.K.sensitivity=1*f.nodeValue,1>this.K.sensitivity&&(this.K.sensitivity=1);if(f=x.getAttributeNode("dblclickfullscreen"))this.K.Tm=1==f.nodeValue;if(f=x.getAttributeNode("contextfullscreen"))this.K.Km=1==f.nodeValue;if(f=x.getAttributeNode("contextvr"))this.K.Lm=1==f.nodeValue;if(f=x.getAttributeNode("contextprojections"))this.K.lq=1==f.nodeValue;if(f=x.getAttributeNode("hideabout"))this.K.Dk=
1==f.nodeValue;for(y=x.firstChild;y;)"menulink"==y.nodeName&&(z={text:"",url:""},f=y.getAttributeNode("text"),z.text=f.nodeValue,f=y.getAttributeNode("url"),z.url=f.nodeValue,this.$k.push(z)),y=y.nextSibling}if("vr"==x.nodeName&&this.Rd){if(f=x.getAttributeNode("toggleskinbutton"))this.ka.zq=1==f.nodeValue;if(f=x.getAttributeNode("skinbuttonposition"))this.ka.Dl=f.nodeValue;if(f=x.getAttributeNode("defaulthsscale"))this.ka.Vm=1*f.nodeValue/100}if("transition"==x.nodeName&&this.Rd){if(f=x.getAttributeNode("enabled"))this.F.enabled=
1==f.nodeValue;if(f=x.getAttributeNode("blendtime"))this.F.Mf=1*f.nodeValue;if(f=x.getAttributeNode("blendcolor"))this.F.Eg=f.nodeValue.toString();if(f=x.getAttributeNode("type"))this.F.type=f.nodeValue.toString();if(f=x.getAttributeNode("delay"))this.F.delay=f.nodeValue.toString();if(f=x.getAttributeNode("softedge"))this.F.od=1*f.nodeValue;if(f=x.getAttributeNode("zoomin"))this.F.fa=1*f.nodeValue;if(f=x.getAttributeNode("zoomout"))this.F.dd=1*f.nodeValue;if(f=x.getAttributeNode("zoomfov"))this.F.em=
1*f.nodeValue;if(f=x.getAttributeNode("zoomafterinfov"))this.F.cm=1*f.nodeValue;if(f=x.getAttributeNode("zoomafteroutfov"))this.F.dm=1*f.nodeValue;if(f=x.getAttributeNode("zoomspeed"))this.F.Sh=1*f.nodeValue;if(f=x.getAttributeNode("zoomoutpause"))this.F.Rh=1==f.nodeValue;"cut"==this.F.type&&(this.F.Mf=0);"mesh"==this.F.type&&(this.F.dd=0)}if("soundstransition"==x.nodeName){if(f=x.getAttributeNode("enabled"))this.cb.enabled=1==f.nodeValue;if(f=x.getAttributeNode("transitiontime"))this.cb.Mb=1*f.nodeValue;
if(f=x.getAttributeNode("crossfade"))this.cb.sq=1==f.nodeValue}if("flyintransition"==x.nodeName){if(f=x.getAttributeNode("enabled"))this.Ha.enabled=1==f.nodeValue&&this.qa;if(f=x.getAttributeNode("speed"))this.Ha.speed=1*f.nodeValue}"userdata"==x.nodeName&&(this.userdata=this.zg=this.Rg(x),this.Af.hasOwnProperty(h)||(this.Af[h]=this.zg),this.Xc[a.id]||(this.Xc[a.id]=this.Cq(x),this.eh[a.id]=this.Dq(x),this.Ag[a.id]=this.Eq(x)));"projectuserdata"==x.nodeName&&(this.Af._master=this.Rg(x));"customproperty"==
x.nodeName&&this.Bq(x);if("translations"==x.nodeName)for((f=x.getAttributeNode("json"))&&this.Yh(f.nodeValue.toString()),this.Qn||this.No(window.navigator.language),y=x.firstChild;y;){"json"==y.nodeName&&this.Yh(y.textContent);if("projecttranslation"==y.nodeName){z={};if(f=y.getAttributeNode("langcode"))z.langCode=f.nodeValue;if(f=y.getAttributeNode("langname"))z.langName=f.nodeValue;this.to.push(z)}y=y.nextSibling}if("hotspots"==x.nodeName){if(f=x.getAttributeNode("smoothmovement"))this.At=1==f.nodeValue;
y=x.firstChild;for(this.P.count=0;y;){if("label"==y.nodeName&&this.Rd){z=this.P.Kl;if(f=y.getAttributeNode("enabled"))z.enabled=1==f.nodeValue;if(f=y.getAttributeNode("width"))z.width=1*f.nodeValue;if(f=y.getAttributeNode("height"))z.height=1*f.nodeValue;if(f=y.getAttributeNode("textcolor"))z.Ll=1*f.nodeValue;if(f=y.getAttributeNode("textalpha"))z.Jl=1*f.nodeValue;if(f=y.getAttributeNode("background"))z.background=1==f.nodeValue;if(f=y.getAttributeNode("backgroundalpha"))z.nc=1*f.nodeValue;if(f=y.getAttributeNode("backgroundcolor"))z.oc=
1*f.nodeValue;if(f=y.getAttributeNode("border"))z.ak=1*f.nodeValue;if(f=y.getAttributeNode("bordercolor"))z.qc=1*f.nodeValue;if(f=y.getAttributeNode("borderalpha"))z.pc=1*f.nodeValue;if(f=y.getAttributeNode("borderradius"))z.xm=1*f.nodeValue;if(f=y.getAttributeNode("wordwrap"))z.Sj=1==f.nodeValue}if("polystyle"==y.nodeName&&this.Rd){if(f=y.getAttributeNode("mode"))this.P.mode=1*f.nodeValue;if(f=y.getAttributeNode("bordercolor"))this.P.qc=1*f.nodeValue;if(f=y.getAttributeNode("backgroundcolor"))this.P.oc=
1*f.nodeValue;if(f=y.getAttributeNode("borderalpha"))this.P.pc=1*f.nodeValue;if(f=y.getAttributeNode("backgroundalpha"))this.P.nc=1*f.nodeValue;if(f=y.getAttributeNode("handcursor"))this.P.af=1==f.nodeValue}"hotspot"==y.nodeName&&(f=new Tm(this),f.type="point",f.Ab(y),this.L.push(f),this.an(a.id,y));"polyhotspot"==y.nodeName&&(f=new Tm(this),f.type="poly",f.Ab(y),this.L.push(f),this.P.count++,this.an(a.id,y));y=y.nextSibling}}if("sounds"==x.nodeName||"media"==x.nodeName)for(f=x.firstChild;f;){if("sound"==
f.nodeName&&!this.$n)for(y=new wg(this),y.Ab(f),y.addElement(),z=0;z<this.sg.length;z++)y.id==this.sg[z].id&&(this.sg.splice(z,1),z--);"video"==f.nodeName&&(y=new Sm(this),y.Ab(f),y.addElement());"image"==f.nodeName&&(y=new NB(this),y.Ab(f),y.addElement());"webelement"==f.nodeName&&(y=new OB(this),y.Ab(f),y.addElement());"lensflare"==f.nodeName&&this.Wc&&(y=new PB(this),y.Ab(f),this.Wc.Ni.push(y));f=f.nextSibling}x=x.nextSibling}this.A.Ud=0;for(a=0;a<this.sg.length;a++){t=this.sg[a];if(this.ha&&this.cb.enabled&&
this.isPlaying(t.id))this.cb.Kj.push(t);else{try{t.ua?t.Fg():t.j.pause()}catch(eb){}t.nf()}this.X.splice(this.X.indexOf(t),1)}(1!=this.F.fa&&2!=this.F.fa&&6!=this.F.fa&&7!=this.F.fa||"mesh"==this.F.type)&&this.Gq();this.zf||(this.rb.kj=!0);b&&("object"===typeof b&&null!==b?(b.hasOwnProperty("pan")&&this.Zd(Number(b.pan)),b.hasOwnProperty("tilt")&&this.$d(Number(b.tilt)),b.hasOwnProperty("projection")&&this.bb(Number(b.projection)),b.hasOwnProperty("fov")&&this.Lb(Number(b.fov))):""!=b&&(b=b.toString().split("/"),
4<b.length&&this.bb(Number(b[4])),0<b.length&&(f=String(b[0]),"N"==f.charAt(0)?this.nj(Number(f.substring(1))):"S"==f.charAt(0)?this.nj(-180+Number(f.substring(1))):this.Zd(Number(f))),1<b.length&&this.$d(Number(b[1])),2<b.length&&this.Lb(Number(b[2]))),e.pan.open=e.pan.m,this.Ha.Qd.pan=e.pan.m,this.Ha.Qd.u=e.u.m,this.Ha.Qd.fov=e.fov.m,this.Ha.Qd.vb=this.$(),this.Ha.Qd.iu=!0);if(r){f=r.getAttributeNode("stereo");this.Qb=!1;f&&1==f.nodeValue&&(this.Qb=!0);f=r.getAttributeNode("fliplr");this.tg=!1;
f&&1==f.nodeValue&&(this.tg=!0);for(b=0;b<(this.Qb?12:6);b++)(f=r.getAttributeNode("tile"+b+"url"))&&(this.gi[b]=String(f.nodeValue));for(b=0;6>b;b++)(f=r.getAttributeNode("prev"+b+"url"))&&(this.hi[b]=String(f.nodeValue));if(f=r.getAttributeNode("tilevrurl"))this.Qm=String(f.nodeValue);if(f=r.getAttributeNode("tilesize"))this.wf=1*f.nodeValue;f=r.getAttributeNode("canvassize");if(f=r.getAttributeNode("tilescale"))this.Fh=1*f.nodeValue;if(f=r.getAttributeNode("leveltileurl"))w.Vn=f.nodeValue;if(f=
r.getAttributeNode("leveltilesize"))w.W=Number(f.nodeValue);if(f=r.getAttributeNode("levelbias"))w.fs=Number(f.nodeValue);if(f=r.getAttributeNode("levelbiashidpi"))w.gs=Number(f.nodeValue);f=r.getAttributeNode("overlap");e.ub.Y=0;e.ub.pitch=0;f&&(w.lb=Number(f.nodeValue));if(f=r.getAttributeNode("levelingroll"))e.ub.Y=Number(f.nodeValue);if(f=r.getAttributeNode("levelingpitch"))e.ub.pitch=Number(f.nodeValue);this.nd=0;(f=r.getAttributeNode("flat"))&&1==f.nodeValue&&(this.nd=2);e.nd=this.nd;f=r.getAttributeNode("width");
w.width=1*(f?f.nodeValue:1);f=r.getAttributeNode("height");w.height=1*(f?f.nodeValue:w.width);this.B.src=[];w.levels=[];for(r=r.firstChild;r;){if("preview"==r.nodeName){if(f=r.getAttributeNode("color"))w.ml=f.nodeValue;if(f=r.getAttributeNode("strip"))w.Ps=1==f.nodeValue}if("video"==r.nodeName){this.B.format=1;if(f=r.getAttributeNode("format"))"3x2"==f.nodeValue&&(this.B.format=14,this.Qb=!1),"video3x2"==f.nodeValue&&(this.B.format=14,this.Qb=!1),"equirectangular"==f.nodeValue&&(this.B.format=1),
"vr180"==f.nodeValue&&(this.B.format=15,this.Qb=!1),"vr180stereo"==f.nodeValue&&(this.B.format=15,this.Qb=!0);if(f=r.getAttributeNode("flipy"))this.B.flipY=Number(f.nodeValue);if(f=r.getAttributeNode("startonload"))this.B.Gl=1==f.nodeValue;if(f=r.getAttributeNode("startmutedmobile"))this.B.Fl=1==f.nodeValue;if(f=r.getAttributeNode("level"))this.B.level=Number(f.nodeValue);if(f=r.getAttributeNode("bleed"))this.B.Lf=Number(f.nodeValue);if(f=r.getAttributeNode("endaction"))this.B.Re=String(f.nodeValue);
if(f=r.getAttributeNode("targetview"))this.B.Il=String(f.nodeValue);if(f=r.getAttributeNode("width"))this.B.width=Number(f.nodeValue);if(f=r.getAttributeNode("height"))this.B.height=Number(f.nodeValue);for(b=r.firstChild;b;)"source"==b.nodeName&&(f=b.getAttributeNode("url"))&&this.B.src.push(f.nodeValue.toString()),b=b.nextSibling}if("level"==r.nodeName){b=new Sx;f=r.getAttributeNode("width");b.width=1*(f?f.nodeValue:1);f=r.getAttributeNode("height");b.height=1*(f?f.nodeValue:b.width);if(f=r.getAttributeNode("preload"))b.cache=
1==f.nodeValue;if(f=r.getAttributeNode("preview"))b.lh=1==f.nodeValue;b.aa=Math.floor((b.width+w.W-1)/w.W);b.ta=Math.floor((b.height+w.W-1)/w.W);w.levels.push(b)}r=r.nextSibling}w.Un=w.levels.length}this.se=!0;this.Mh&&(this.qa=this.Lh=!1,this.Oc||(this.Oc=document.createElement("canvas"),this.Oc.width=100,this.Oc.height=100,this.Oc.id="dummycanvas",this.ja.appendChild(this.Oc)),this.qd());this.qa&&this.O&&this.ea.forEach(eb=>{eb.Or(this.Fh);eb.Qr()});let ab=this;0<w.levels.length&&w.Ps&&0==this.nd&&
(r=new Image,b=new Sx,b.lh=!0,b.cache=!0,b.aa=b.ta=0,b.height=b.width=0,w.levels.push(b),r.crossOrigin=this.crossOrigin,r.onload=e.hh.Sx(r),r.setAttribute("src",e.Eh(6,w.Un-1,0,0)));0<this.B.src.length&&this.qa&&(this.Oj?(w=this.B.j=document.createElement("video"),w.crossOrigin=this.crossOrigin,w.setAttribute("style","display:none; max-width:none;"),w.setAttribute("playsinline","playsinline"),w.preload="metadata",w.volume=this.ga*this.B.level,this.T.appendChild(w),this.B.Vc=!1,this.B.gp=!1,this.B.j.oncanplay=
function(){if(!ab.B.Vc){ab.B.dh=!0;let eb,cb,db,bb,gb,kb,qb=[],ob=new Nd,pb=ab.O,ub=ab.B.j.videoWidth/3;ab.B.width=ab.B.j.videoWidth;ab.B.height=ab.B.j.videoHeight;for(eb=0;6>eb;eb++)for(db=eb%3*ub+ab.B.Lf,gb=db+ub-2*ab.B.Lf,kb=4,3>eb&&(kb+=ub),bb=kb+ub-2*ab.B.Lf,cb=0;4>cb;cb++){ob.x=-1;ob.y=-1;ob.z=1;for(let rb=0;rb<cb;rb++)ob.bt();qb.push((0<ob.x?db:gb)/(3*ub),(0<ob.y?bb:kb)/(2*ub))}pb.bindBuffer(pb.ARRAY_BUFFER,ab.B.Fj);pb.bufferData(pb.ARRAY_BUFFER,new Float32Array(qb),pb.STATIC_DRAW);ab.F.pd&&
"videopano"==ab.F.delay&&ab.Hl(null)}},this.B.jb=function(){let eb=ab.Ya("_videopanorama");return 0<eb.length&&eb[0].jb?eb[0].jb:0},this.B.Jo=function(eb){let cb=ab.Ya("_videopanorama");0<cb.length&&(cb[0].jb=eb)},this.B.loop=function(){return 0<ab.B.jb()?(ab.B.Jo(ab.B.jb()-1),ab.B.j.play(),!0):!1},"exit"==this.B.Re?this.B.j.onended=function(){ab.B.dh=!1;ab.B.Vc=!1;ab.T.removeChild(ab.B.j);ab.B.j=null;ab.update()}:"stop"==this.B.Re?ab.B.j.onended=function(){ab.B.loop()||ab.update()}:"{"==this.B.Re.charAt(0)?
this.B.j.onended=function(){ab.$c(ab.B.Re,ab.B.Il)}:this.B.j.loop=!0,this.Mp(w,this.B.src),w=this.Ya("_videopanorama"),0<w.length?w[0].j=this.B.j:this.Ss("_videopanorama",this.B.j),this.B.Gl&&(w=!1,this.Ec&&(this.B.Fl?this.B.j.muted=!0:w=!0),w||(w=this.B.j.play(),void 0!==w&&w.then(()=>{}).catch(()=>{this.B.Fl&&(this.B.j.muted=!0,this.B.j.play())})))):"{"==this.B.Re.charAt(0)&&ab.$c(ab.B.Re,ab.B.Il));this.rv(h);this.Lp();this.F.be||this.Wo();this.update();this.Rd&&(this.Rd=!1,this.G("viewerinit",
{}),this.ca&&this.ca.ggViewerInit&&this.ca.ggViewerInit(),this.Ha.enabled&&0==this.nd&&this.qa&&(this.bb(9),e.pan.m=e.jd.pan,e.u.m=e.jd.u,e.fov.m=e.jd.fov,this.bb(e.jd.vb),this.S=this.hn(!1),this.F.he=this.A.yg,e.pan.m=this.bc(0,0).value,e.u.m=this.bc(0,1).value,e.fov.m=this.bc(0,2).value,e=this.bc(0,3).value,3==e&&this.bb(e),this.Cc=this.S.hb,this.xl(!0),this.A.active=!1,this.A.pi=!0));this.qd();this.G("changenodeid",n)}Ir(){return Um()&&Um().hasOwnProperty("isSupported")}Mp(a,b,e){if(1<=b.length){var f=
this.Ka(this.Ma(b[0]));if(this.Ir()&&0<f.indexOf(".m3u8")&&!a.canPlayType("application/vnd.apple.mpegurl")&&Um().isSupported())b=new (Um()),b.attachMedia(a),b.loadSource(f),e&&e.Nj.push(f);else for(f=0;f<b.length;f++){let h=this.Ka(this.Ma(b[f])),n=document.createElement("source");n.setAttribute("src",h);a.appendChild(n);e&&e.Nj.push(h)}}}il(a,b){0<a.length&&(".xml"==a.slice(-4)||".swf"==a.slice(-4)||"{"==a.charAt(0)?this.$c(this.Ka(a),b):window.open(this.Ka(a),b))}Iz(){this.se=this.isLoaded=!1;this.checkLoaded=
this.wd=[];this.$i=0;this.ca&&this.ca.ggReLoaded&&this.ca.ggReLoaded();this.G("beforechangenode",{})}Ww(a){let b="";0<this.bo.length&&(b=this.bo.pop());""!=b&&(this.yn=!0);this.$c("{"+b+"}",a)}$c(a,b){var e=this.D;if(""!=a&&"{}"!=a){this.Iz();this.en&&!this.Mh&&(this.bg(0),this.qd());this.la&&this.la.hotspotProxyOut&&this.la.hotspotProxyOut(this.N.id,this.N.url);this.G("hsproxyout",{id:this.N.id,url:this.N.url});".swf"==a.substring(a.length-4)&&(a=a.substring(0,a.length-4)+".xml");var f="",h=null;
"object"===typeof b&&null!==b?h=b:b&&(f=b.toString());b="/"+e.u.m+"/"+e.fov.m+"//"+e.$();f=f.replace("$cur",e.pan.m+b);f=f.replace("$(cur)",e.pan.m+b);f=f.replace("$fwd","N"+e.qe()+b);f=f.replace("$(fwd)","N"+e.qe()+b);f=f.replace("$bwd","S"+e.qe()+b);f=f.replace("$(bwd)","S"+e.qe()+b);f=f.replace("$ap",String(e.pan.m));f=f.replace("$(ap)",String(e.pan.m));f=f.replace("$an",String(e.qe()));f=f.replace("$(an)",String(e.qe()));f=f.replace("$at",String(e.u.m));f=f.replace("$(at)",String(e.u.m));f=f.replace("$af",
String(e.fov.m));f=f.replace("$(af)",String(e.fov.m));f=f.replace("$ar",String(e.$()));f=f.replace("$(ar)",String(e.$()));""!=f&&(e=f.split("/"),3<e.length&&""!=e[3]&&(this.startNode=e[3]));f=null!==h?h:f;this.sa(!1);if("{"==a.charAt(0)){h=a.substring(1,a.length-1);if(this.va==h&&this.di){this.se=this.isLoaded=!0;return}(a=this.Ne[h])&&(h=a);a=this.F;if(this.yf[h]){this.di=!0;this.F.enabled&&this.qa&&(a.uj=!0,"mesh"==a.type?(e=this.ea[0],this.ea[0]=this.ea[1],this.ea[1]=e,this.D=this.ea[0].D):this.F.Ub&&
a.setup());e=new Gk;e.pan=this.pe();a.Id&&1<this.ea.length&&this.ea[1]&&this.ea[1].D&&(e.pan=this.ea[1].D.pan.m);let n=b=!0;7==this.F.fa&&(n=!1);6==this.F.fa&&(n=b=!1);if(this.N){"point"==this.N.type&&(b&&(e.pan=this.N.pan),n&&(e.u=this.N.u));if("poly"==this.N.type){let r=this.Sd();b&&(e.pan=-r.pan);n&&(e.u=r.tilt)}if(b=this.Tf(this.Bd(),this.N.id,"__mesh_pan"))e.pan=parseFloat(b);if(b=this.Tf(this.Bd(),this.N.id,"__mesh_tilt"))e.u=parseFloat(b)}this.wo(this.yf[h],f);a.enabled&&this.qa&&(a.Ay(),"mesh"==
a.type&&(f=this.ea[0].D,h=this.ea[1].D,a.yh.pan=f.pan.m,a.yh.u=h.u.m,a.yh.fov=h.fov.m,a.Og.pan=f.pan.m,a.Og.u=f.u.m,a.Og.fov=f.fov.m,f.fov.m=h.fov.m,f.u.m=h.u.m,h.bb(f.$()),a.offset=h.pan.m-f.pan.m,a.rz(e)));a.uj=!1;this.zf&&this.ka.Wj();this.F.be||this.F.Id||this.F.pd||(this.ia&&this.Nm(),this.di=!1)}else{this.Rb("invalid node id: "+h);return}}else this.Rs(a,null,f);this.G("changenode",{});this.update(5)}}kr(){if(this.se){if(this.Dd)return this.eb.slice(0);let a=[];a.push(this.va);return a}return[]}Rg(a){var b;
let e;e={title:"",description:"",author:"",datetime:"",copyright:"",source:"",information:"",comment:"",latitude:0,longitude:0,altitude:-1E4,heading:0,customnodeid:"",streetviewlink:"",tags:[]};if(a&&((b=a.getAttributeNode("title"))&&(e.title=b.nodeValue.toString()),(b=a.getAttributeNode("description"))&&(e.description=b.nodeValue.toString()),(b=a.getAttributeNode("author"))&&(e.author=b.nodeValue.toString()),(b=a.getAttributeNode("datetime"))&&(e.datetime=b.nodeValue.toString()),(b=a.getAttributeNode("copyright"))&&
(e.copyright=b.nodeValue.toString()),(b=a.getAttributeNode("source"))&&(e.source=b.nodeValue.toString()),(b=a.getAttributeNode("info"))&&(e.information=b.nodeValue.toString()),(b=a.getAttributeNode("comment"))&&(e.comment=b.nodeValue.toString()),(b=a.getAttributeNode("latitude"))&&(e.latitude=Number(b.nodeValue)),(b=a.getAttributeNode("longitude"))&&(e.longitude=Number(b.nodeValue)),(b=a.getAttributeNode("nodeid"))&&(e.nodeid=b.nodeValue.toString()),(b=a.getAttributeNode("altitude"))&&(e.altitude=
Number(b.nodeValue)),(b=a.getAttributeNode("heading"))&&(e.heading=Number(b.nodeValue)),(b=a.getAttributeNode("customnodeid"))&&(e.customnodeid=b.nodeValue.toString()),(b=a.getAttributeNode("streetviewlink"))&&(e.streetviewlink=b.nodeValue.toString()),b=a.getAttributeNode("tags"))){a=b.nodeValue.toString().split("|");for(b=0;b<a.length;b++)""==a[b]&&(a.splice(b,1),b--);e.tags=a}return e}Wv(a){let b="",e=a.firstChild;for(;e;){if("sequence"==e.nodeName){if(a=e.getAttributeNode("title"))b=a.nodeValue;
let f=[],h=e.firstChild;for(;h;){if("sequenceelement"==h.nodeName){let n={};if(a=h.getAttributeNode("index"))n.index=a.nodeValue;if(a=h.getAttributeNode("nodeid"))n.nodeid=a.nodeValue;if(a=h.getAttributeNode("cliptitle"))n.cliptitle=a.nodeValue;if(a=h.getAttributeNode("startview"))n.startview=a.nodeValue;f.push(n)}h=h.nextSibling}this.Rp[b]=f}e=e.nextSibling}}Cq(a){let b={},e=a.firstChild;for(;e;){if("mapcoords"==e.nodeName){let f={x:0,y:0};a=e.getAttributeNode("x");f.x=Number(a.nodeValue);a=e.getAttributeNode("y");
f.y=Number(a.nodeValue);a=e.getAttributeNode("mapid");b[a.nodeValue.toString()]=f}e=e.nextSibling}return b}Dq(a){let b={},e=a.firstChild;for(;e;){if("mapcoords"==e.nodeName){let f={x:0,y:0};a=e.getAttributeNode("x_floorplan_percent");f.x=Number(a.nodeValue);a=e.getAttributeNode("y_floorplan_percent");f.y=Number(a.nodeValue);a=e.getAttributeNode("mapid");b[a.nodeValue.toString()]=f}e=e.nextSibling}return b}wi(a){return a?this.Af[a]?this.Af[a]:this.Rg():this.zg}Aw(a,b){""!==a||this.Dd||(a="node1");
a||(a=this.va);return this.yr(a,b)}Wy(a,b,e){""!==a||this.Dd||(a="node1");a||(a=this.va);this.rt(a,b,e)}tn(a){a=this.wi(a);let b=[];""!=a.latitude&&0!=a.latitude&&0!=a.longitude&&(b.push(a.latitude),b.push(a.longitude));return b}lr(a){let b=[];for(let e=0;e<this.eb.length;e++){let f=this.eb[e],h=this.wi(f);h&&h.tags.includes(a)&&b.push(f)}return b}zw(a){return this.wi(a).title}ww(a,b){var e=-1;a=this.tn(a);b=this.tn(b);if(2==a.length&&2==b.length){e=Math.PI/180*(b[0]-a[0]);let f=Math.PI/180*(b[1]-
a[1]);a=Math.sin(e/2)*Math.sin(e/2)+Math.sin(f/2)*Math.sin(f/2)*Math.cos(Math.PI/180*a[0])*Math.cos(Math.PI/180*b[0]);e=12742E3*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}return e}bc(a,b,e){let f;for(f=0;f<this.S.La.length;f++){let h=this.S.La[f];if(h.time==a&&h.wb==b&&(!e||h.Ld==e))return h}return!1}vk(a,b){let e;for(e=0;e<b.La.length;e++)if(0==b.La[e].time&&b.La[e].wb==a)return b.La[e];return!1}rr(a,b,e){for(a=Math.floor(a);!this.bc(a,b,e)&&0<a;)a--;return a}ir(a){let b,e=1E5,f=a,h=!1;for(b=0;b<this.S.La.length;b++){let n=
this.S.La[b];n.wb==a.wb&&n.Ld==a.Ld&&n.time>a.time&&n.time<e&&(f=this.S.La[b],e=f.time,h=!0)}return h?f:!1}bw(a){let b=[];for(let e=0;e<this.S.La.length;e++){let f=this.S.La[e];if(f.time<=a&&4==f.wb){let h=!1;for(let n=0;n<b.length;n++)if(b[n].Ld==this.S.La[e].Ld){b[n].time<f.time?b.splice(n,1):h=!0;break}h||b.push(f)}}return b}Sq(a,b,e){var f=new gf(a.time,a.value);let h=new gf(b.time,b.value);var n=(e-a.time)/(b.time-a.time);if(0!=a.type||0!=b.type&&3!=b.type)if(3==a.type)f=a.value;else{n=new gf;
let r=new gf,t=b.time-a.time;0==a.type?r.init(a.time+.3*t,a.value):r.init(a.Jf,a.Kf);0==b.type||3==b.type?n.init(b.time-.3*t,b.value):n.init(b.Hf,b.If);a=new gf;a.wm(f,h,r,n,e);f=a.y}else e=new gf,e.ue(f,h,n),f=e.y;return f}hn(a,b,e,f){const h=this.D;for(var n=0;n<this.Aa.length;n++)if(this.Aa[n].hb&&0==this.Aa[n].hb.indexOf("__FlyIn"))return this.Aa[n];n=new Rx;n.hb="__FlyIn";n.vf=h.pan.m;n.zj=h.u.m;n.Be=h.fov.m;n.yj=this.$();n.Ce=this.xi();a?(n.Mg=!1,n.Pf=!1,n.speed=this.F.Sh,n.ae=b,n.De=e,n.Ch=
f):(n.Mg=!0,n.Pf=!0,n.speed=this.Ha.speed,this.Ha.Qd.iu?(n.ae=this.Ha.Qd.pan,n.De=this.Ha.Qd.u,n.Ch=this.Ha.Qd.fov,n.Ce=this.Ha.Qd.vb):(n.ae=h.pan.Wa,n.De=h.u.Wa,n.Ch=h.fov.Wa));return this.Pq(n)}Pq(a){var b=this.D;let e=new Qx;e.hb=a.hb;e.Ef="";e.La=[];let f=a.yj!=a.Ce&&-1!=a.Ce;for(;-180>a.ae;)a.ae+=360;for(;180<a.ae;)a.ae-=360;let h=a.ae-a.vf;if(360==b.pan.max-b.pan.min&&!this.Fa()){for(;-180>h;)h+=360;for(;180<h;)h-=360}b=a.De-a.zj;let n=a.Ch-a.Be,r=Math.round(Math.sqrt(h*h+b*b+n*n)/a.speed*.33);
f&&(r=Math.max(10,r));e.length=r;let t,w;a.Qf&&(t=Math.ceil(.7*r),t=Math.min(15,t),t=Math.max(5,t),e.length=r+t,w=.33*t);let x=a.Ch,y=r,z=0,ab=r-1;if(f){var eb=a.Be;var cb=4==a.Ce?120:this.ui(a.Ce);n=x-a.Be;var db=new gf(0,a.Be);let bb=new gf(r,x),gb=new gf,kb=new gf;kb.init(r/3,a.Be+n/3);gb.init(2*r/3,x-n/3);if(eb>cb)for(;z<=r&&eb>cb;)eb=new gf,eb.wm(db,bb,kb,gb,z),eb=eb.y,z++;else z=1;z>=.8*r&&(y=z=Math.round(.8*r));0==z&&(z=1);cb=4==a.yj?120:this.ui(a.yj);eb=a.Ch;if(eb>cb)for(;ab>z&&eb>cb;)eb=
new gf,eb.wm(db,bb,kb,gb,ab),eb=eb.y,ab--}db=new bg;db.time=0;db.wb=0;db.value=a.vf;db.type=1;db.Jf=r/3;db.Kf=a.Mg?a.vf:a.vf+h/3;e.La.push(db);db=new bg;db.time=0;db.wb=1;db.value=a.zj;db.type=1;db.Jf=r/3;db.Kf=a.Mg?a.zj:a.zj+b/3;e.La.push(db);db=new bg;db.time=0;db.wb=2;db.value=a.Be;db.type=1;db.Jf=r/3;db.Kf=a.Mg?a.Be:a.Be+n/3;e.La.push(db);db=new bg;db.time=0;db.wb=3;db.value=a.yj;db.type=0;db.Mb=0;e.La.push(db);f&&(db=new bg,db.time=z,db.wb=3,db.value=a.Ce,db.type=0,db.Mb=ab-z,e.La.push(db));
db=new bg;db.time=r;db.wb=0;db.value=a.vf+h;db.type=1;db.Hf=2*r/3;db.If=a.Pf&&!a.Qf?db.value:db.value-h/3;a.Qf&&(db.Jf=r+w,db.Kf=db.value+w/r*h);e.La.push(db);db=new bg;db.time=r;db.wb=1;db.value=a.De;db.type=1;db.Hf=2*r/3;db.If=a.Pf&&!a.Qf?a.De:a.De-b/3;a.Qf&&(db.Jf=r+w,db.Kf=db.value+w/r*b);e.La.push(db);db=new bg;db.time=y;db.wb=2;db.value=x;db.type=1;db.Hf=2*y/3;db.If=a.Pf?x:x-n/3;e.La.push(db);a.Qf&&(db=new bg,db.time=r+t,db.wb=0,db.value=a.vf+h,db.type=1,db.Hf=r+t-w,db.If=a.vf+h,e.La.push(db),
db=new bg,db.time=r+t,db.wb=1,db.value=a.De,db.type=1,db.Hf=r+t-w,db.If=a.De,e.La.push(db));this.Aa.push(e);return e}qA(){this.B.j&&this.B.j.play()}rA(){this.B.j&&(this.B.j.pause(),this.B.j.currentTime=0)}pA(){this.B.j&&this.B.j.pause()}oz(a){this.B.j&&(0>a&&(a=0),a>this.B.j.duration&&(a=this.B.j.duration-.1),this.B.j.currentTime=a,this.update())}Rw(){return this.B.j?this.B.j.currentTime:0}Qw(){if(this.B.j)return this.B.j}nz(a){const b=this.B.j;if(b){let e=!this.B.j.paused&&!this.B.j.ended,f=this.B.j.currentTime;
b.pause();b.src=isNaN(parseInt(a,10))?String(a):this.B.src[parseInt(a,10)];e&&(this.B.j.onloadedmetadata=function(){b.currentTime=f;b.play();b.onloadedmetadata=null});this.B.j.currentTime=f}}xq(){this.$n=!0}Tf(a,b,e){""!==a||this.Dd||(a="node1");a||(a=this.va);return super.Tf(a,b,e)}mj(a,b,e,f){""!==a||this.Dd||(a="node1");a||(a=this.va);return super.mj(a,b,e,f)}nr(){let a={};var b=this.D;a.currentNode=this.Bd();a.position={pan:b.pan.m,tilt:b.u.m,fov:b.fov.m,projection:this.$()};b=a.variables={};
for(var e of Object.keys(this.mc))this.mc[e].Nr||"undefined"!==this.vn(e)&&((b[e]={}).value=this.vn(e));e=a.hsprops={};for(var f of Object.keys(this.sb)){b=e[f]={};for(var h of Object.keys(this.sb[f])){let r=b[h]={};for(var n of Object.keys(this.sb[f][h]))r[n]=this.Tf(f,h,n)}}f=a.polyhotspots=[];for(h=0;h<this.L.length;h++)"poly"==this.L[h].type&&(n=this.L[h],e={},e.id=n.id,e.bordercolor=n.qc,e.borderalpha=n.pc,e.backgroundcolor=n.oc,e.backgroundalpha=n.nc,f.push(e));return a}qt(a){var b=this.D;if(a.hasOwnProperty("position")){var e=
a.position;b.pan.m=e.pan;b.u.m=e.tilt;b.fov.m=e.fov;this.bb(e.projection)}for(const r of Object.keys(a.variables))this.tf(r,a.variables[r].value);for(var f of Object.keys(a.hsprops)){b=a.hsprops[f];for(var h of Object.keys(b)){e=b[h];for(var n of Object.keys(e))this.mj(f,h,n,e[n])}}for(f=0;f<a.polyhotspots.length;f++)for(n=a.polyhotspots[f],h=0;h<this.L.length;h++)"poly"==this.L[h].type&&this.L[h].id==n.id&&(this.L[h].qc=n.bordercolor,this.L[h].pc=n.borderalpha,this.L[h].nc=n.backgroundalpha,this.L[h].oc=
n.backgroundcolor);return this.Oa=!0}}window.ggHasHtml5Css3D=Jv;window.ggHasWebGL=Kv;window.THREE=lg;window.pano2vrPlayer=vj;let fb=vj.prototype;fb._=fb.Ma;fb.setContainer=fb.it;fb.setLanguage=fb.No;fb.getLanguage=fb.ow;fb.addTranslations=fb.Yh;fb.getProjectTranslations=fb.Gw;fb.getVersion=fb.wn;fb.readConfigString=fb.xo;fb.readConfigUrl=fb.Rs;fb.readConfigUrlAsync=fb.Dy;fb.readConfigXml=fb.yo;fb.openUrl=fb.il;fb.openNext=fb.$c;fb.goBack=fb.Ww;fb.setMargins=fb.Vy;fb.addListener=fb.addListener;fb.on=
fb.addListener;fb.removeEventListener=fb.removeEventListener;fb.off=fb.removeEventListener;fb.detectBrowser=fb.wq;fb.initWebGL=fb.bg;fb.getPercentLoaded=fb.Dw;fb.setBasePath=fb.Py;fb.getBasePath=fb.Uq;fb.setViewerSize=fb.tj;fb.getViewerSize=fb.Tw;fb.updateViewerSizeNow=fb.qd;fb.setSkinObject=fb.fz;fb.changeViewMode=fb.fq;fb.getViewMode=fb.Ar;fb.changePolygonMode=fb.eq;fb.setPolygonMode=fb.eq;fb.getPolygonMode=fb.qr;fb.showOnePolyHotspot=fb.xt;fb.hideOnePolyHotspot=fb.Kr;fb.changePolyHotspotColor=
fb.wv;fb.setPolyHotspotHandcursor=fb.Zy;fb.toggleOnePolyHotspot=fb.Tz;fb.changeViewState=fb.gq;fb.getViewState=fb.Br;fb.setRenderFlags=fb.az;fb.getRenderFlags=fb.Hw;fb.setMaxTileCount=fb.pt;fb.updatePanorama=fb.Mj;fb.isTouching=fb.On;fb.getIsMobile=fb.qn;fb.setIsMobile=fb.Uy;fb.getHasTouch=fb.Yq;fb.getIsTour=fb.nw;fb.getNodesCount=fb.Bw;fb.getIsAutorotating=fb.lw;fb.getIsLoading=fb.ar;fb.getIsLoaded=fb.vi;fb.getIsTileLoading=fb.rn;fb.getLastActivity=fb.pw;fb.getPan=fb.pe;fb.getPanNorth=fb.qe;fb.getPanDest=
fb.mr;fb.getPanN=fb.wk;fb.setPan=fb.Zd;fb.setPanNorth=fb.nj;fb.changePan=fb.bi;fb.changePanLog=fb.Cm;fb.getTilt=fb.Vf;fb.getTiltDest=fb.zr;fb.setTilt=fb.$d;fb.changeTilt=fb.ci;fb.changeTiltLog=fb.Em;fb.getFov=fb.Cd;fb.getFovDest=fb.hw;fb.setFov=fb.Lb;fb.setFovMode=fb.Lo;fb.changeFov=fb.ai;fb.changeFovLog=fb.bk;fb.getVFov=fb.Gb;fb.setVFov=fb.rj;fb.getHFov=fb.nn;fb.setHFov=fb.Mo;fb.getDFov=fb.ln;fb.setDFov=fb.Ko;fb.getRoll=fb.zk;fb.setRoll=fb.uh;fb.setPanTilt=fb.Bl;fb.setPanTiltFov=fb.th;fb.setDefaultView=
fb.vl;fb.getViewerLimits=fb.Sw;fb.setViewerLimits=fb.pz;fb.setLocked=fb.setLocked;fb.setLockedMouse=fb.mt;fb.setLockedKeyboard=fb.lt;fb.getLockedKeyboard=fb.rw;fb.setLockedWheel=fb.nt;fb.moveTo=fb.moveTo;fb.moveToEx=fb.Vi;fb.moveToDefaultView=fb.vs;fb.moveToDefaultViewEx=fb.ws;fb.addHotspotElements=fb.Lp;fb.playSound=fb.Yd;fb.playPauseSound=fb.no;fb.playStopSound=fb.Ns;fb.pauseSound=fb.ih;fb.activateSound=fb.Ip;fb.soundGetTime=fb.Ct;fb.soundSetTime=fb.Et;fb.soundSetPlaybackRate=fb.Dt;fb.setMediaVisibility=
fb.zl;fb.isPlaying=fb.isPlaying;fb.stopSound=fb.Bj;fb.setVolume=fb.setVolume;fb.changeVolume=fb.hq;fb.mute=fb.Tx;fb.unmute=fb.dA;fb.toggleMuted=fb.Sz;fb.getPlayerMuted=fb.Ew;fb.getHasSounds=fb.jw;fb.getSoundsPermitted=fb.Iw;fb.startAutoplayMedia=fb.It;fb.removeHotspots=fb.Eo;fb.getHotspotsVisible=fb.pn;fb.getHotspotPropValue=fb.Tf;fb.setHotspotPropValue=fb.mj;fb.getCustomPropertyDefaultValue=fb.fw;fb.getCurrentPerspective=fb.oe;fb.addHotspot=fb.Kp;fb.updateHotspot=fb.cu;fb.removeHotspot=fb.Us;fb.setActiveHotspot=
fb.rf;fb.getPointHotspotIds=fb.Fw;fb.getHotspot=fb.Zq;fb.setFullscreen=fb.lj;fb.toggleFullscreen=fb.Nl;fb.enterFullscreen=fb.Tv;fb.exitFullscreen=fb.exitFullscreen;fb.getIsFullscreen=fb.mw;fb.startAutorotate=fb.Jt;fb.stopAutorotate=fb.Mt;fb.toggleAutorotate=fb.Rt;fb.pauseAutorotate=fb.Ls;fb.resumeAutorotate=fb.Zs;fb.setAutorotateNodeFilter=fb.gt;fb.startAnimation=fb.Ft;fb.resumeAnimation=fb.Iy;fb.createLayers=fb.Om;fb.removePanorama=fb.og;fb.getScreenResolution=fb.vr;fb.getMaxScreenResolution=fb.er;
fb.getNodeIds=fb.kr;fb.getNodeUserdata=fb.wi;fb.getNodeUserdataPropValue=fb.Aw;fb.setNodeUserdataPropValue=fb.Wy;fb.getNodeLatLng=fb.tn;fb.getNodeTitle=fb.zw;fb.getNodeDistance=fb.ww;fb.getCurrentNode=fb.Bd;fb.getNextNode=fb.jr;fb.getPrevNode=fb.sr;fb.getLastVisitedNode=fb.qw;fb.getStartNode=fb.Jw;fb.getNodesWithTag=fb.lr;fb.getCurrentPointHotspots=fb.Vq;fb.getPositionAngles=fb.Sd;fb.getPositionRawAngles=fb.xk;fb.nodeVisited=fb.Vx;fb.clearVisitedNodes=fb.yv;fb.setElementIdPrefix=fb.Qy;fb.videoPanoPlay=
fb.qA;fb.videoPanoStop=fb.rA;fb.videoPanoPause=fb.pA;fb.getVideoPanoTime=fb.Rw;fb.setVideoPanoTime=fb.oz;fb.getVideoPanoObject=fb.Qw;fb.setVideoPanoSource=fb.nz;fb.getMediaObject=fb.gr;fb.getMediaBufferSourceObject=fb.fr;fb.registerVideoElement=fb.Ss;fb.disableSoundLoading=fb.xq;fb.setCrossOrigin=fb.setCrossOrigin;fb.setProjection=fb.bb;fb.getProjection=fb.$;fb.changeProjection=fb.Dm;fb.changeProjectionEx=fb.Dm;fb.changeLensflares=fb.vv;fb.setTransition=fb.hz;fb.getMapType=fb.uw;fb.getMapDetails=
fb.tw;fb.getNodeMapCoords=fb.xw;fb.getNodeMapCoordsInPercent=fb.yw;fb.getMapContainingNode=fb.sw;fb.getMapsContainingNode=fb.dr;fb.getMapIDs=fb.cr;fb.getFloorplanIDs=fb.gw;fb.getFirstMap=fb.Xq;fb.getFirstFloorplan=fb.uk;fb.hasMap=fb.ex;fb.hasFloorplan=fb.bx;fb.addVariable=fb.av;fb.setVariableOptions=fb.ut;fb.setVariableValue=fb.tf;fb.getVariableValue=fb.vn;fb.setSuperCookie=fb.gz;fb.getGyroAvailable=fb.iw;fb.setUseGyro=fb.st;fb.getUseGyro=fb.Lw;fb.getOS=fb.Cw;fb.getBrowser=fb.dw;fb.getBrowserTheme=
fb.ew;fb.triggerEvent=fb.G;fb.requestRedraw=fb.Gy;fb.getWebGlContext=fb.Uw;fb.getHasTouch=fb.Yq;fb.updateViewerSizeNow=fb.qd;fb.getApiVersion=fb.cw;fb.setApiVersion=fb.Oy;fb.getInertia=fb.kw;fb.setInertia=fb.Ty;fb.getZoomCenterCursor=fb.Cr;fb.setZoomCenterCursor=fb.vt;fb.getPlayerState=fb.nr;fb.setPlayerState=fb.qt;fb.getQueryParameter=fb.getQueryParameter;fb.setQueryParameter=fb.$y;fb.enterVR=fb.Pg;fb.exitVR=fb.Qg;fb.toggleVR=fb.St;fb.isInVR=fb.df;fb.hasVR=fb.$g;fb.getVRDisplayName=fb.Nw;fb.getVRCamera=
fb.Mw;fb.getVRRenderer=fb.Ow;fb.setVRFrameBufferScaleFactor=fb.jz;fb.getSkinGroup=fb.Ak;fb.setVRShowSkinButton=fb.lz;fb.setVRHideSkinButton=fb.kz;fb.setVRSkinVisibility=fb.tt;fb.setVRColorSpace=fb.iz;fb.getVRTextureColorSpace=fb.Pw})()})();
