From 2b565c0e15192af43da57643a92daf9b72295e56 Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Wed, 14 Dec 2022 11:24:44 +0000 Subject: [PATCH 1/5] Add handling of broken DAE objects with materials The ColladaLoader fails for some DAE files that contain textures for some geometries but not for others. This workaround (currently deactivated) would remove all textures if this were to be the case. This prevents "non-loading" of geometries and falls back to loading them without textures --- src/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/index.js b/src/index.js index 7bbaade..ec34545 100644 --- a/src/index.js +++ b/src/index.js @@ -73,7 +73,26 @@ function merge_geometries(object, preserve_materials = false) { result.material = materials[0]; } } else if (geometries.length > 1) { + // There is a known issue where mergeBufferGeometries fails when some of the geometries do not have UV textures. + // A workaround is to delete all UV textures. Rather than failing silently (failing to load by returning null), + // we will remove textures when needed. + let uses_uv = new Array(geometries.length).fill(false); + for (let i = 0; i < geometries.length; ++i) { + uses_uv[i] = geometries[i].attributes.hasOwnProperty('uv'); + } + let all_true = uses_uv.every(v => v === true); + let all_false = uses_uv.every(v => v === false); + let broken_dae = (all_true === all_false); + if (broken_dae) { + console.warn("Broken DAE: Either all geometries need to contain uv tags or none. To circumvent failure in mergeBufferGeometries, removing all textures"); + for (let i = 0; i < geometries.length; ++i) { + geometries[i].deleteAttribute("uv"); + } + } result = mergeBufferGeometries(geometries, true); + if (result == null) { + console.error("Merging buffer geometries failed:", geometries); + } if (preserve_materials) { result.material = materials; } From 309f958fa625b0e85d1eb92b69380624316ba2bd Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Wed, 14 Dec 2022 11:25:18 +0000 Subject: [PATCH 2/5] Add try catch to DAE and STL loader to catch and output parsing exceptions --- src/index.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/index.js b/src/index.js index ec34545..bc653d7 100644 --- a/src/index.js +++ b/src/index.js @@ -152,16 +152,26 @@ function handle_special_geometry(geom) { loaded_geom.uuid = geom.uuid; return loaded_geom; } else if (geom.format == "dae") { - let loader = new ColladaLoader(); - let obj = loader.parse(geom.data); - let result = merge_geometries(obj.scene); - result.uuid = geom.uuid; - return result; + try { + let loader = new ColladaLoader(); + let obj = loader.parse(geom.data); + let result = merge_geometries(obj.scene); + result.uuid = geom.uuid; + return result; + } catch(e) { + console.error("Failure parsing DAE:", e); + return null; + } } else if (geom.format == "stl") { - let loader = new STLLoader(); - let loaded_geom = loader.parse(geom.data.buffer); - loaded_geom.uuid = geom.uuid; - return loaded_geom; + try { + let loader = new STLLoader(); + let loaded_geom = loader.parse(geom.data.buffer); + loaded_geom.uuid = geom.uuid; + return loaded_geom; + } catch (e) { + console.error("Failure parsing STL:", e, geom); + return null; + } } else { console.error("Unsupported mesh type:", geom); return null; From d3e0fee259f627f32bdac3ad36ad65b034ac8448 Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Wed, 14 Dec 2022 13:37:43 +0000 Subject: [PATCH 3/5] Add Uint8Array decoding, fixes loading of binary STLs from meshcat-python Unclear why we need to specialise this type since the switch from msgpack-lite to msgpack - but without it the geometries do not get decoded. --- src/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index bc653d7..8e8b303 100644 --- a/src/index.js +++ b/src/index.js @@ -12,6 +12,24 @@ require('ccapture.js'); // We must implement extension types 0x16 and 0x17. The trick to // decoding them is they must be converted from littleEndian. const extensionCodec = new msgpack.ExtensionCodec(); + +// Uint8Array +extensionCodec.register({ + type: 0x12, + encode: (obj) => { + console.error("Uint8Array encode not implemented") + return null; + }, + decode: (data) => { + const to_return = new Uint8Array(data.byteLength); + let dataview = new DataView(data.buffer, data.byteOffset, data.byteLength); + for (let i = 0; i < to_return.length; i++) { + to_return[i] = dataview.getUint8(i, true); // true b.c. littleEndian + } + return to_return + }, +}); + // Uint32Array extensionCodec.register({ type: 0x16, @@ -28,7 +46,7 @@ extensionCodec.register({ return to_return }, }); - + + // Float32Array extensionCodec.register({ type: 0x17, From bd9738f8a7184330518843e67ded3a31d795bd2d Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Wed, 14 Dec 2022 13:38:10 +0000 Subject: [PATCH 4/5] Update main.min.js --- dist/main.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/main.min.js b/dist/main.min.js index 2512746..ed7665a 100644 --- a/dist/main.min.js +++ b/dist/main.min.js @@ -1,2 +1,2 @@ /*! For license information please see main.min.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MeshCat=t():e.MeshCat=t()}(self,(function(){return(()=>{var __webpack_modules__={583:(e,t,n)=>{var i;e=n.nmd(e),function(){if(void 0!==e.exports)var r=n(617),s=n(549),o=n(468);var a={function:!0,object:!0};function l(e){return e&&e.Object===Object?e:null}parseFloat,parseInt;var c=a[typeof t]&&t&&!t.nodeType?t:void 0,h=a.object&&e&&!e.nodeType?e:void 0,u=(h&&h.exports,l(c&&h&&"object"==typeof n.g&&n.g)),d=l(a[typeof self]&&self),p=l(a[typeof window]&&window),f=l(a[typeof this]&&this);function m(e){return String("0000000"+e).slice(-7)}u||p!==(f&&f.window)&&p||d||f||Function("return this")(),"gc"in window||(window.gc=function(){}),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),r=i.length,s=new Uint8Array(r),o=0;o=c.frameLimit||c.timeLimit&&e>=c.timeLimit)&&(H(),W());var t=new Date(null);t.setSeconds(e),c.motionBlurFrames>2?_.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+t.toISOString().substr(11,8):_.textContent="CCapture "+c.format+" | "+d+" frames | "+t.toISOString().substr(11,8)}(),j("Frame: "+d+" "+p);for(var s=0;s=h[s].triggerTime&&(G(h[s].callback),h.splice(s,1));for(s=0;s=u[s].triggerTime&&(G(u[s].callback),u[s].triggerTime+=u[s].time);f.forEach((function(e){G(e,n-g)})),f=[]}function W(e){e||(e=function(e){return s(e,l.filename+l.extension,l.mimeType),!1}),l.save(e)}function j(e){t&&console.log(e)}return{start:function(){!function(){function e(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),z.push(this)),this._hookedTime+c.startTime}j("Capturer start"),i=window.Date.now(),n=i+c.startTime,o=window.performance.now(),r=o+c.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(e,t){var i={callback:e,time:t,triggerTime:n+t};return h.push(i),j("Timeout set to "+i.time),i},window.clearTimeout=function(e){for(var t=0;t2?(function(e){A.width===e.width&&A.height===e.height||(A.width=e.width,A.height=e.height,E=new Uint16Array(A.height*A.width*4),C.fillStyle="#0",C.fillRect(0,0,A.width,A.height))}(e),function(e){C.drawImage(e,0,0),T=C.getImageData(0,0,A.width,A.height);for(var t=0;t=.5*c.motionBlurFrames?function(){for(var e=T.data,t=0;t0&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(e){this.filename=this.baseFilename+"-part-"+m(this.part),s(e,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+m(this.part),this.step()}.bind(this)):this.step()},b.prototype.save=function(e){this.videoWriter.complete().then(e)},b.prototype.dispose=function(e){this.frames=[]},w.prototype=Object.create(y.prototype),w.prototype.start=function(){this.encoder.start(this.settings)},w.prototype.add=function(e){this.encoder.add(e)},w.prototype.save=function(e){this.callback=e,this.encoder.end()},w.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},M.prototype=Object.create(y.prototype),M.prototype.add=function(e){this.stream||(this.stream=e.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(e){this.chunks.push(e.data)}.bind(this)),this.step()},M.prototype.save=function(e){this.mediaRecorder.onstop=function(t){var n=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],e(n)}.bind(this),this.mediaRecorder.stop()},S.prototype=Object.create(y.prototype),S.prototype.add=function(e){this.sizeSet||(this.encoder.setOption("width",e.width),this.encoder.setOption("height",e.height),this.sizeSet=!0),this.canvas.width=e.width,this.canvas.height=e.height,this.ctx.drawImage(e,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},S.prototype.save=function(e){this.callback=e,this.encoder.render()},(p||d||{}).CCapture=E,void 0===(i=function(){return E}.call(t,n,t,e))||(e.exports=i)}()},549:e=>{void 0!==e.exports&&(e.exports=function(e,t,n){var i,r,s,o=window,a="application/octet-stream",l=n||a,c=e,h=document,u=h.createElement("a"),d=function(e){return String(e)},p=o.Blob||o.MozBlob||o.WebKitBlob||d,f=o.MSBlobBuilder||o.WebKitBlobBuilder||o.BlobBuilder,m=t||"download";if("true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(e){for(var t=e.split(/[:;,]/),n=t[1],i=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=i.length,s=0,o=new Uint8Array(r);s{e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=void 0,o=0;o0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,o,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){var i=e("./TypedNeuQuant.js"),r=e("./LZWEncoder.js");function s(){this.page=-1,this.pages=[],this.newPage()}s.pageSize=4096,s.charMap={};for(var o=0;o<256;o++)s.charMap[o]=String.fromCharCode(o);function a(e,t){this.width=~~e,this.height=~~t,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new s}s.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(s.pageSize),this.cursor=0},s.prototype.getData=function(){for(var e="",t=0;t=s.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=e},s.prototype.writeUTFBytes=function(e){for(var t=e.length,n=0;n=0&&(this.dispose=e)},a.prototype.setRepeat=function(e){this.repeat=e},a.prototype.setTransparent=function(e){this.transparent=e},a.prototype.addFrame=function(e){this.image=e,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},a.prototype.finish=function(){this.out.writeByte(59)},a.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},a.prototype.setDither=function(e){!0===e&&(e="FloydSteinberg"),this.dither=e},a.prototype.setGlobalPalette=function(e){this.globalPalette=e},a.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},a.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},a.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new i(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},a.prototype.indexPixels=function(e){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var n=0,i=0;i=0&&b+h=0&&w+c>16,(65280&e)>>8,255&e,t)},a.prototype.findClosestRGB=function(e,t,n,i){if(null===this.colorTab)return-1;if(this.neuQuant&&!i)return this.neuQuant.lookupRGB(e,t,n);for(var r=0,s=16777216,o=this.colorTab.length,a=0,l=0;a=0&&(t=7&this.dispose),t<<=2,this.out.writeByte(0|t|e),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},a.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},a.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},a.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},a.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},a.prototype.writePixels=function(){new r(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},a.prototype.stream=function(){return this.out},t.exports=a},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(e,t,n){var i=5003,r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var o,a,l,c,h,u,d=Math.max(2,s),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,y=0,_=!1;function v(e,t){p[a++]=e,a>=254&&w(t)}function x(e){b(i),y=h+2,_=!0,E(h,e)}function b(e){for(var t=0;t0&&(e.writeByte(a),e.writeBytes(p,0,a),a=0)}function M(e){return(1<0?o|=e<=8;)v(255&o,t),o>>=8,g-=8;if((y>l||_)&&(_?(l=M(n_bits=c),_=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),e==u){for(;g>0;)v(255&o,t),o>>=8,g-=8;w(t)}}this.encode=function(n){n.writeByte(d),remaining=e*t,curPixel=0,function(e,t){var n,r,s,o,d,p;for(c=e,_=!1,n_bits=c,l=M(n_bits),u=1+(h=1<=0){d=5003-s,0===s&&(d=1);do{if((s-=d)<0&&(s+=5003),f[s]===n){o=m[s];continue e}}while(f[s]>=0)}E(o,t),o=r,y<4096?(m[s]=y++,f[s]=n):x(t)}else o=m[s];E(o,t),E(u,t)}(d+1,n),n.writeByte(0)}}},{}],4:[function(e,t,n){var i=256,r=1024,s=1<<18;t.exports=function(e,t){var n,o,a,l,c;function h(e,t,i,s,o){n[t][0]-=e*(n[t][0]-i)/r,n[t][1]-=e*(n[t][1]-s)/r,n[t][2]-=e*(n[t][2]-o)/r}function u(e,t,r,o,a){for(var l,h,u=Math.abs(t-e),d=Math.min(t+e,i),p=t+1,f=t-1,m=1;pu;)h=c[m++],pu&&((l=n[f--])[0]-=h*(l[0]-r)/s,l[1]-=h*(l[1]-o)/s,l[2]-=h*(l[2]-a)/s)}function d(e,t,r){var s,o,c,h,u,d=~(1<<31),p=d,f=-1,m=f;for(s=0;s>12))>10,l[s]-=u,a[s]+=u<<10;return l[f]+=64,a[f]-=65536,m}this.buildColormap=function(){(function(){var e,t;for(n=[],o=new Int32Array(256),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),e=0;e>6;for(v<=1&&(v=0),n=0;n=p&&(x-=p),0===g&&(g=1),++n%g==0)for(y-=y/f,(v=(_-=_/30)>>6)<=1&&(v=0),l=0;l>=4,n[e][1]>>=4,n[e][2]>>=4,n[e][3]=e}(),function(){var e,t,r,s,a,l,c=0,h=0;for(e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)o[t]=255}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)u=c?u=i:(u++,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)=0&&((l=t-(a=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)t;0<=t?++e:--e)n.push(null);return n}.call(this),t=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(e=0,n=t;0<=n?en;0<=n?++e:--e)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},i.prototype.abort=function(){for(var e;null!=(e=this.activeWorkers.shift());)this.log("killing active worker"),e.terminate();return this.running=!1,this.emit("abort")},i.prototype.spawnWorkers=function(){var e,t,n,i;return e=Math.min(this.options.workers,this.frames.length),function(){n=[];for(var i=t=this.freeWorkers.length;t<=e?ie;t<=e?i++:i--)n.push(i);return n}.apply(this).forEach((i=this,function(e){var t;return i.log("spawning worker "+e),(t=new Worker(i.options.workerScript)).onmessage=function(e){return i.activeWorkers.splice(i.activeWorkers.indexOf(t),1),i.freeWorkers.push(t),i.frameFinished(e.data)},i.freeWorkers.push(t)})),e},i.prototype.frameFinished=function(e){var t,n;if(this.log("frame "+e.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[e.index]=e,!0===this.options.globalPalette&&(this.options.globalPalette=e.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(t=1,n=this.freeWorkers.length;1<=n?tn;1<=n?++t:--t)this.renderNextFrame();return o.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m;for(a=0,r=0,l=(p=this.imageParts).length;r=this.frames.length))return e=this.frames[this.nextFrame++],n=this.freeWorkers.shift(),t=this.getTask(e),this.log("starting frame "+(t.index+1)+" of "+this.frames.length),this.activeWorkers.push(n),n.postMessage(t)},i.prototype.getContextData=function(e){return e.getImageData(0,0,this.options.width,this.options.height).data},i.prototype.getImageData=function(e){var t;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(t=this._canvas.getContext("2d")).setFill=this.options.background,t.fillRect(0,0,this.options.width,this.options.height),t.drawImage(e,0,0),this.getContextData(t)},i.prototype.getTask=function(e){var t,n;if(n={index:t=this.frames.indexOf(e),last:t===this.frames.length-1,delay:e.delay,dispose:e.dispose,transparent:e.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===r.name},null!=e.data)n.data=e.data;else if(null!=e.context)n.data=this.getContextData(e.context);else{if(null==e.image)throw new Error("Invalid frame");n.data=this.getImageData(e.image)}return n},i.prototype.log=function(){var e;if(e=1<=arguments.length?a.call(arguments,0):[],this.options.debug)return console.log.apply(console,e)},i}(i)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(e,t,n){var i,r;i=e("./GIFEncoder.js"),r=function(e){var t,n,r,s;return t=new i(e.width,e.height),0===e.index?t.writeHeader():t.firstFrame=!1,t.setTransparent(e.transparent),t.setDispose(e.dispose),t.setRepeat(e.repeat),t.setDelay(e.delay),t.setQuality(e.quality),t.setDither(e.dither),t.setGlobalPalette(e.globalPalette),t.addFrame(e.data),e.last&&t.finish(),!0===e.globalPalette&&(e.globalPalette=t.getGlobalPalette()),r=t.stream(),e.data=r.pages,e.cursor=r.cursor,e.pageSize=r.constructor.pageSize,e.canTransfer?(s=function(){var t,i,r,s;for(s=[],t=0,i=(r=e.data).length;t{!function(){"use strict";var e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];function t(e){var t,n=new Uint8Array(e);for(t=0;t>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];switch(a.length%4){case 1:a+="=";break;case 2:a+="=="}return a}}(),function(){"use strict";var e,t=window.utils;e=[{field:"fileName",length:100},{field:"fileMode",length:8},{field:"uid",length:8},{field:"gid",length:8},{field:"fileSize",length:12},{field:"mtime",length:12},{field:"checksum",length:8},{field:"type",length:1},{field:"linkName",length:100},{field:"ustar",length:8},{field:"owner",length:32},{field:"group",length:32},{field:"majorNumber",length:8},{field:"minorNumber",length:8},{field:"filenamePrefix",length:155},{field:"padding",length:12}],window.header={},window.header.structure=e,window.header.format=function(n,i){var r=t.clean(512),s=0;return e.forEach((function(e){var t,i,o=n[e.field]||"";for(t=0,i=o.length;ti&&(t.push({blocks:r,length:n}),r=[],n=0),r.push(e),n+=e.headerLength+e.inputLength})),t.push({blocks:r,length:n}),t.forEach((function(t){var n=new Uint8Array(t.length),i=0;t.blocks.forEach((function(e){n.set(e.header,i),i+=e.headerLength,n.set(e.input,i),i+=e.inputLength})),e.push(n)})),e.push(new Uint8Array(1024)),new Blob(e,{type:"octet/stream"})},s.prototype.clear=function(){this.written=0,this.out=i.clean(t)},void 0!==e.exports?e.exports=s:window.Tar=s}()},376:(e,t,n)=>{"use strict";function i(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),s=Math.round(e.b),o=e.a,a=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+s+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+s+","+o+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+s+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+s+","+o+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+",a:"+o+"}":"unknown format"}n.d(t,{ZP:()=>he});var r=Array.prototype.forEach,s=Array.prototype.slice,o={BREAK:{},extend:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=s.call(arguments);return function(){for(var t=s.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(r&&e.forEach&&e.forEach===r)e.forEach(t,n);else if(e.length===e.length+0){var i,s=void 0;for(s=0,i=e.length;s1?o.toArray(arguments):arguments[0];return o.each(a,(function(t){if(t.litmus(e))return o.each(t.conversions,(function(t,n){if(l=t.read(e),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=t,o.BREAK})),o.BREAK})),c},u=void 0,d={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),s=n*(1-t),o=n*(1-r*t),a=n*(1-(1-r)*t),l=[[n,a,s],[o,n,s],[s,n,a],[s,o,n],[a,s,n],[n,s,o]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),s=r-i,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=e===r?(t-n)/s:t===r?2+(n-e)/s:4+(e-t)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(u=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var P=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=i||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,o.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=R(r.__impliedStep),r}return y(t,e),m(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=R(e),this}}]),t}(w),D=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function h(){T.unbind(window,"mousemove",c),T.unbind(window,"mouseup",h),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"change",(function(){var e=parseFloat(s.__input.value);o.isNaN(e)||s.setValue(e)})),T.bind(r.__input,"blur",(function(){l()})),T.bind(r.__input,"mousedown",(function(e){T.bind(window,"mousemove",c),T.bind(window,"mouseup",h),a=e.clientY})),T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P);function I(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var O=function(e){function t(e,n,i,r,s){f(this,t);var o=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:s})),a=o;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(I(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function c(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(I(t,n.left,n.right,a.__min,a.__max))}function u(){T.unbind(window,"touchmove",h),T.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),T.bind(o.__background,"mousedown",(function(e){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(e)})),T.bind(o.__background,"touchstart",(function(e){1===e.touches.length&&(T.bind(window,"touchmove",h),T.bind(window,"touchend",u),h(e))})),T.addClass(o.__background,"slider"),T.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P),k=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,T.bind(r.__button,"click",(function(e){return e.preventDefault(),s.fire(),!1})),T.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return y(t,e),m(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(w),N=function(e){function t(e,n){f(this,t);var i=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new v(i.getValue()),i.__temp=new v(0);var r=i;i.domElement=document.createElement("div"),T.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",T.bind(i.__input,"keydown",(function(e){13===e.keyCode&&p.call(this)})),T.bind(i.__input,"blur",p),T.bind(i.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(r.__selector,"drag")}))})),T.bind(i.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(r.__selector,"drag")}))}));var s,a=document.createElement("div");function l(e){g(e),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",u),T.bind(window,"touchend",u)}function c(e){y(e),T.bind(window,"mousemove",y),T.bind(window,"touchmove",y),T.bind(window,"mouseup",d),T.bind(window,"touchend",d)}function u(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",u),T.unbind(window,"touchend",u),m()}function d(){T.unbind(window,"mousemove",y),T.unbind(window,"touchmove",y),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var e=h(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function m(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function g(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,s=n.clientY,o=(i-t.left)/(t.right-t.left),a=1-(s-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function y(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return o.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),o.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),o.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),o.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),o.extend(a.style,{width:"100%",height:"100%",background:"none"}),U(a,"top","rgba(0,0,0,0)","#000"),o.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=i.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(i.__saturation_field,"mousedown",l),T.bind(i.__saturation_field,"touchstart",l),T.bind(i.__field_knob,"mousedown",l),T.bind(i.__field_knob,"touchstart",l),T.bind(i.__hue_field,"mousedown",c),T.bind(i.__hue_field,"touchstart",c),i.__saturation_field.appendChild(a),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=h(this.getValue());if(!1!==e){var t=!1;o.each(v.COMPONENTS,(function(n){if(!o.isUndefined(e[n])&&!o.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&o.extend(this.__color.__state,e)}o.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;o.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,U(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),o.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(w),B=["-moz-","-o-","-webkit-","-ms-",""];function U(e,t,n,i){e.style.background="",o.each(B,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var F='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',z=function(e,t){var n=e[t];return o.isArray(arguments[2])||o.isObject(arguments[2])?new C(e,t,arguments[2]):o.isNumber(n)?o.isNumber(arguments[2])&&o.isNumber(arguments[3])?o.isNumber(arguments[4])?new O(e,t,arguments[2],arguments[3],arguments[4]):new O(e,t,arguments[2],arguments[3]):o.isNumber(arguments[4])?new D(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new D(e,t,{min:arguments[2],max:arguments[3]}):o.isString(n)?new L(e,t):o.isFunction(n)?new k(e,t,""):o.isBoolean(n)?new A(e,t):null},H=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},G=function(){function e(){f(this,e),this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;T.bind(this.backgroundElement,"click",(function(){t.hide()}))}return m(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",T.unbind(e.domElement,"webkitTransitionEnd",t),T.unbind(e.domElement,"transitionend",t),T.unbind(e.domElement,"oTransitionEnd",t)};T.bind(this.domElement,"webkitTransitionEnd",t),T.bind(this.domElement,"transitionend",t),T.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if("undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var V="Default",W=function(){try{return!!window.localStorage}catch(e){return!1}}(),j=void 0,q=!0,X=void 0,J=!1,Y=[],Z=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=o.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=o.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),o.isUndefined(i.load)?i.load={preset:V}:i.preset&&(i.load.preset=i.preset),o.isUndefined(i.parent)&&i.hideable&&Y.push(this),i.resizable=o.isUndefined(i.parent)&&i.resizable,i.autoPlace&&o.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,s=W&&"true"===localStorage.getItem(ne(0,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:i,factoryArgs:[o.toArray(arguments)]})}if(o.isArray(t)||o.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof O){var i=new D(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});o.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),T.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof D){var r=function(t){if(o.isNumber(n.__min)&&o.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=te(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(i),r&&s.listen(),s}return t};n.min=o.compose(r,n.min),n.max=o.compose(r,n.max)}else n instanceof A?(T.bind(t,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof k?(T.bind(t,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(t,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(t,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof N&&(T.addClass(t,"color"),n.updateDisplay=o.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=o.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&$(e.getRoot(),!0),t}),n.setValue)}(e,c,r),e.__controllers.push(r),r}function ne(e,t){return document.location.href+"."+t}function ie(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function re(e,t){t.style.display=e.useLocalStorage?"block":"none"}function se(e){var t=e.__save_row=document.createElement("li");T.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),T.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",T.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",T.addClass(i,"button"),T.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",T.addClass(r,"button"),T.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",T.addClass(s,"button"),T.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?o.each(e.load.remembered,(function(t,n){ie(e,n,n===e.preset)})):ie(e,V,!1),T.bind(a,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=le(this)),e.folders={},o.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=le(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=le(this,!0)),this.load.remembered[e]=le(this),this.preset=e,ie(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){o.each(this.__controllers,(function(t){this.getRoot().load.remembered?ee(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),o.each(this.__folders,(function(e){e.revert(e)})),e||$(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&ce(this.__listening)},updateDisplay:function(){o.each(this.__controllers,(function(e){e.updateDisplay()})),o.each(this.__folders,(function(e){e.updateDisplay()}))}});const he={color:{Color:v,math:d,interpret:h},controllers:{Controller:w,BooleanController:A,OptionController:C,StringController:L,NumberController:P,NumberControllerBox:D,NumberControllerSlider:O,FunctionController:k,ColorController:N},dom:{dom:T},gui:{GUI:Z},GUI:Z}},973:(e,t,n)=>{"use strict";n.d(t,{eW:()=>S,oe:()=>x});var i=n(477);class r{static addMaterial(e,t,n,i,r){let s;t.name=n,i?(e[n]=t,r&&console.info('Material with name "'+n+'" was forcefully overridden.')):(s=e[n],s?s.uuid!=s.uuid&&r&&console.log('Same material name "'+s.name+'" different uuid ['+s.uuid+"|"+t.uuid+"]"):(e[n]=t,r&&console.info('Material with name "'+n+'" was added.')))}static getMaterialsJSON(e){const t={};let n;for(const i in e)n=e[i],"function"==typeof n.toJSON&&(t[i]=n.toJSON());return t}static cloneMaterial(e,t,n){let i;if(t){let s=t.materialNameOrg;s=null!=s?s:"";const o=e[s];o?(i=o.clone(),Object.assign(i,t.materialProperties),r.addMaterial(e,i,t.materialProperties.name,!0)):n&&console.info('Requested material "'+s+'" is not available!')}return i}}class s{static buildThreeConst(){return"const EventDispatcher = THREE.EventDispatcher;\nconst BufferGeometry = THREE.BufferGeometry;\nconst BufferAttribute = THREE.BufferAttribute;\nconst Box3 = THREE.Box3;\nconst Sphere = THREE.Sphere;\nconst Texture = THREE.Texture;\nconst MaterialLoader = THREE.MaterialLoader;\n"}static buildUglifiedThreeMapping(){return s.buildUglifiedNameAssignment((function(){return i.BufferGeometry}),"BufferGeometry",/_BufferGeometry/,!1)+s.buildUglifiedNameAssignment((function(){return i.BufferAttribute}),"BufferAttribute",/_BufferAttribute/,!1)+s.buildUglifiedNameAssignment((function(){return i.Box3}),"Box3",/_Box3/,!1)+s.buildUglifiedNameAssignment((function(){return i.Sphere}),"Sphere",/_Sphere/,!1)+s.buildUglifiedNameAssignment((function(){return i.Texture}),"Texture",/_Texture/,!1)+s.buildUglifiedNameAssignment((function(){return i.MaterialLoader}),"MaterialLoader",/_MaterialLoader/,!1)}static buildUglifiedThreeWtmMapping(){return s.buildUglifiedNameAssignment((function(){return o}),"DataTransport",/_DataTransport/,!0)+s.buildUglifiedNameAssignment((function(){return l}),"GeometryTransport",/_GeometryTransport/,!0)+s.buildUglifiedNameAssignment((function(){return c}),"MeshTransport",/_MeshTransport/,!0)+s.buildUglifiedNameAssignment((function(){return a}),"MaterialsTransport",/_MaterialsTransport/,!0)+s.buildUglifiedNameAssignment((function(){return r}),"MaterialUtils",/_MaterialUtils/,!0)}static buildUglifiedNameAssignment(e,t,n,i){let r=e.toString();r=r.replace(n,"").replace(/[\r\n]+/gm,""),r=r.replace(/.*return/,"").replace(/\}/,"").replace(/;/gm,"");const s=r.trim();let o="";return s!==t&&(o="const "+(i?t:s)+" = "+(i?s:t)+";\n"),o}}class o{constructor(e,t){this.main={cmd:void 0!==e?e:"unknown",id:void 0!==t?t:0,type:"DataTransport",progress:0,buffers:{},params:{}},this.transferables=[]}loadData(e){return this.main.cmd=e.cmd,this.main.id=e.id,this.main.type="DataTransport",this.setProgress(e.progress),this.setParams(e.params),e.buffers&&Object.entries(e.buffers).forEach((([e,t])=>{this.main.buffers[e]=t})),this}getCmd(){return this.main.cmd}getId(){return this.main.id}setParams(e){return null!=e&&(this.main.params=e),this}getParams(){return this.main.params}setProgress(e){return this.main.progress=e,this}addBuffer(e,t){return this.main.buffers[e]=t,this}getBuffer(e){return this.main.buffers[e]}package(e){for(let t of Object.values(this.main.buffers))if(null!=t){const n=e?t.slice(0):t;this.transferables.push(n)}return this}getMain(){return this.main}getTransferables(){return this.transferables}postMessage(e){return e.postMessage(this.main,this.transferables),this}}class a extends o{constructor(e,t){super(e,t),this.main.type="MaterialsTransport",this.main.materials={},this.main.multiMaterialNames={},this.main.cloneInstructions=[]}loadData(e){super.loadData(e),this.main.type="MaterialsTransport",Object.assign(this.main,e);const t=new i.MaterialLoader;return Object.entries(this.main.materials).forEach((([e,n])=>{this.main.materials[e]=t.parse(n)})),this}_cleanMaterial(e){return Object.entries(e).forEach((([t,n])=>{(n instanceof i.Texture||null===n)&&(e[t]=void 0)})),e}addBuffer(e,t){return super.addBuffer(e,t),this}setParams(e){return super.setParams(e),this}setMaterials(e){return null!=e&&Object.keys(e).length>0&&(this.main.materials=e),this}getMaterials(){return this.main.materials}cleanMaterials(){let e,t={};for(let n of Object.values(this.main.materials))"function"==typeof n.clone&&(e=n.clone(),t[e.name]=this._cleanMaterial(e));return this.setMaterials(t),this}package(e){return super.package(e),this.main.materials=r.getMaterialsJSON(this.main.materials),this}hasMultiMaterial(){return Object.keys(this.main.multiMaterialNames).length>0}getSingleMaterial(){return Object.keys(this.main.materials).length>0?Object.entries(this.main.materials)[0][1]:null}processMaterialTransport(e,t){for(let n=0;n{n[t]=e[i]}));else{const t=this.getSingleMaterial();null!==t&&(n=e[t.name],n||(n=t))}return n}}class l extends o{constructor(e,t){super(e,t),this.main.type="GeometryTransport",this.main.geometryType=0,this.main.geometry={},this.main.bufferGeometry=null}loadData(e){return super.loadData(e),this.main.type="GeometryTransport",this.setGeometry(e.geometry,e.geometryType)}getGeometryType(){return this.main.geometryType}setParams(e){return super.setParams(e),this}setGeometry(e,t){return this.main.geometry=e,this.main.geometryType=t,e instanceof i.BufferGeometry&&(this.main.bufferGeometry=e),this}package(e){super.package(e);const t=this.main.geometry.getAttribute("position"),n=this.main.geometry.getAttribute("normal"),i=this.main.geometry.getAttribute("uv"),r=this.main.geometry.getAttribute("color"),s=this.main.geometry.getAttribute("skinIndex"),o=this.main.geometry.getAttribute("skinWeight"),a=this.main.geometry.getIndex();return this._addBufferAttributeToTransferable(t,e),this._addBufferAttributeToTransferable(n,e),this._addBufferAttributeToTransferable(i,e),this._addBufferAttributeToTransferable(r,e),this._addBufferAttributeToTransferable(s,e),this._addBufferAttributeToTransferable(o,e),this._addBufferAttributeToTransferable(a,e),this}reconstruct(e){if(this.main.bufferGeometry instanceof i.BufferGeometry)return this;this.main.bufferGeometry=new i.BufferGeometry;const t=this.main.geometry;this._assignAttribute(t.attributes.position,"position",e),this._assignAttribute(t.attributes.normal,"normal",e),this._assignAttribute(t.attributes.uv,"uv",e),this._assignAttribute(t.attributes.color,"color",e),this._assignAttribute(t.attributes.skinIndex,"skinIndex",e),this._assignAttribute(t.attributes.skinWeight,"skinWeight",e);const n=t.index;if(null!=n){const t=e?n.array.slice(0):n.array;this.main.bufferGeometry.setIndex(new i.BufferAttribute(t,n.itemSize,n.normalized))}const r=t.boundingBox;null!==r&&(this.main.bufferGeometry.boundingBox=Object.assign(new i.Box3,r));const s=t.boundingSphere;return null!==s&&(this.main.bufferGeometry.boundingSphere=Object.assign(new i.Sphere,s)),this.main.bufferGeometry.uuid=t.uuid,this.main.bufferGeometry.name=t.name,this.main.bufferGeometry.type=t.type,this.main.bufferGeometry.groups=t.groups,this.main.bufferGeometry.drawRange=t.drawRange,this.main.bufferGeometry.userData=t.userData,this}getBufferGeometry(){return this.main.bufferGeometry}_addBufferAttributeToTransferable(e,t){if(null!=e){const n=t?e.array.slice(0):e.array;this.transferables.push(n.buffer)}return this}_assignAttribute(e,t,n){if(e){const r=n?e.array.slice(0):e.array;this.main.bufferGeometry.setAttribute(t,new i.BufferAttribute(r,e.itemSize,e.normalized))}return this}}class c extends l{constructor(e,t){super(e,t),this.main.type="MeshTransport",this.main.materialsTransport=new a}loadData(e){return super.loadData(e),this.main.type="MeshTransport",this.main.meshName=e.meshName,this.main.materialsTransport=(new a).loadData(e.materialsTransport.main),this}setParams(e){return super.setParams(e),this}setMaterialsTransport(e){return e instanceof a&&(this.main.materialsTransport=e),this}getMaterialsTransport(){return this.main.materialsTransport}setMesh(e,t){return this.main.meshName=e.name,super.setGeometry(e.geometry,t),this}package(e){return super.package(e),null!==this.main.materialsTransport&&this.main.materialsTransport.package(e),this}reconstruct(e){return super.reconstruct(e),this}}class h{static serializePrototype(e,t,n,i){let r,s=[],o="";i?(o=e.toString()+"\n\n",r=t):r=e;for(let e in r){let t=r[e],n=t.toString();"function"==typeof t&&s.push("\t"+e+": "+n+",\n\n")}o+=n+(i?".prototype":"")+" = {\n\n";for(let e=0;e0){let n;for(const i in e)n=e[i],r.addMaterial(this.materials,n,i,!0===t)}}getMaterials(){return this.materials}getMaterial(e){return this.materials[e]}clearMaterials(){this.materials={}}}class p{static comRouting(e,t,n,i,r){let s=t.data;"init"===s.cmd?null!=n?n[i](e,s.workerId,s.config):i(e,s.workerId,s.config):"execute"===s.cmd&&(null!=n?n[r](e,s.workerId,s.config):r(e,s.workerId,s.config))}}class f{constructor(e){this.taskTypes=new Map,this.verbose=!1,this.maxParallelExecutions=e||4,this.actualExecutionCount=0,this.storedExecutions=[],this.teardown=!1}setVerbose(e){return this.verbose=e,this}setMaxParallelExecutions(e){return this.maxParallelExecutions=e,this}getMaxParallelExecutions(){return this.maxParallelExecutions}supportsTaskType(e){return this.taskTypes.has(e)}registerTaskType(e,t,n,i,r,s){let o=!this.supportsTaskType(e);if(o){let o=new m(e,this.maxParallelExecutions,r,this.verbose);o.setFunctions(t,n,i),o.setDependencyDescriptions(s),this.taskTypes.set(e,o)}return o}registerTaskTypeModule(e,t){let n=!this.supportsTaskType(e);if(n){let n=new m(e,this.maxParallelExecutions,!1,this.verbose);n.setWorkerModule(t),this.taskTypes.set(e,n)}return n}async initTaskType(e,t,n){let i=this.taskTypes.get(e);if(i)if(i.status.initStarted)for(;!i.status.initComplete;)await this._wait(10);else i.status.initStarted=!0,i.isWorkerModule()?await i.createWorkerModules().then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e))):await i.loadDependencies().then((()=>i.createWorkers())).then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e)))}async _wait(e){return new Promise((t=>{setTimeout(t,e)}))}async enqueueForExecution(e,t,n,i){return new Promise(((r,s)=>{this.storedExecutions.push(new g(e,t,n,r,s,i)),this._depleteExecutions()}))}_depleteExecutions(){let e=0;for(;this.actualExecutionCount{i.onmessage=n=>{"assetAvailable"===n.data.cmd?t.assetAvailableFunction instanceof Function&&t.assetAvailableFunction(n.data):e(n)},i.onerror=n,i.postMessage({cmd:"execute",workerId:i.getId(),config:t.config},t.transferables)})).then((e=>{n.returnAvailableTask(i),t.resolve(e.data),this.actualExecutionCount--,this._depleteExecutions()})).catch((e=>{t.reject("Execution error: "+e)}))):e++}}dispose(){this.teardown=!0;for(let e of this.taskTypes.values())e.dispose();return this}}class m{constructor(e,t,n,i){this.taskType=e,this.fallback=n,this.verbose=!0===i,this.initialised=!1,this.functions={init:null,execute:null,comRouting:null,dependencies:{descriptions:[],code:[]},workerModuleUrl:null},this.workers={code:[],instances:new Array(t),available:[]},this.status={initStarted:!1,initComplete:!1}}getTaskType(){return this.taskType}setFunctions(e,t,n){this.functions.init=e,this.functions.execute=t,this.functions.comRouting=n,void 0!==this.functions.comRouting&&null!==this.functions.comRouting||(this.functions.comRouting=p.comRouting),this._addWorkerCode("init",this.functions.init.toString()),this._addWorkerCode("execute",this.functions.execute.toString()),this._addWorkerCode("comRouting",this.functions.comRouting.toString()),this.workers.code.push('self.addEventListener( "message", message => comRouting( self, message, null, init, execute ), false );')}_addWorkerCode(e,t){t.startsWith("function")?this.workers.code.push("const "+e+" = "+t+";\n\n"):this.workers.code.push("function "+t+";\n\n")}setDependencyDescriptions(e){e&&e.forEach((e=>{this.functions.dependencies.descriptions.push(e)}))}setWorkerModule(e){this.functions.workerModuleUrl=new URL(e,window.location.href)}isWorkerModule(){return null!==this.functions.workerModuleUrl}async loadDependencies(){let e=[],t=new i.FileLoader;t.setResponseType("arraybuffer");for(let n of this.functions.dependencies.descriptions){if(n.url){let i=new URL(n.url,window.location.href);e.push(t.loadAsync(i.href,(e=>{this.verbose&&console.log(e)})))}n.code&&e.push(new Promise((e=>e(n.code))))}this.verbose&&console.log("Task: "+this.getTaskType()+": Waiting for completion of loading of all dependencies."),this.functions.dependencies.code=await Promise.all(e)}async createWorkers(){let e;if(this.fallback)for(let t=0;t{let s;if(i.onmessage=e=>{this.verbose&&console.log("Init Complete: "+e.data.id),n(e)},i.onerror=r,t){s=[];for(let e=0;e0}returnAvailableTask(e){this.workers.available.push(e)}dispose(){for(let e of this.workers.instances)e.terminate()}}class g{constructor(e,t,n,i,r,s){this.taskType=e,this.config=t,this.assetAvailableFunction=n,this.resolve=i,this.reject=r,this.transferables=s}}class y extends Worker{constructor(e,t,n){super(t,n),this.id=e}getId(){return this.id}}class _{constructor(e,t,n){this.id=e,this.functions={init:t,execute:n}}getId(){return this.id}postMessage(e,t){let n=this,i={postMessage:function(e){n.onmessage({data:e})}};p.comRouting(i,{data:e},null,n.functions.init,n.functions.execute)}terminate(){}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class x extends i.Loader{constructor(e){super(e),this.parser=new b,this.materialStore=new d(!0),this.parser.materials=this.materialStore.getMaterials()}setLogging(e,t){return this.parser.logging.enabled=!0===e,this.parser.logging.debug=!0===t,this}setMaterialPerSmoothingGroup(e){return this.parser.aterialPerSmoothingGroup=!0===e,this}setUseOAsMesh(e){return this.parser.useOAsMesh=!0===e,this}setUseIndices(e){return this.parser.useIndices=!0===e,this}setDisregardNormals(e){return this.parser.disregardNormals=!0===e,this}setModelName(e){return e&&(this.parser.modelName=e),this}getModelName(){return this.parser.modelName}setBaseObject3d(e){return this.parser.baseObject3d=null==e?this.parser.baseObject3d:e,this}setMaterials(e){return this.materialStore.addMaterials(e,!1),this.parser.materials=this.materialStore.getMaterials(),this}setCallbackOnProgress(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onProgress=e),this}setCallbackOnError(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onError=e),this}setCallbackOnLoad(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onLoad=e),this}setCallbackOnMeshAlter(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onMeshAlter=e),this}load(e,t,n,r,s){if(!(null!=t&&t instanceof Function)){const e="onLoad is not a function! Aborting...";throw this.parser._onError(e),e}this.setCallbackOnLoad(t);const o=this;null!=r&&r instanceof Function||(r=function(e){let t=e;e.currentTarget&&null!==e.currentTarget.statusText&&(t="Error occurred while downloading!\nurl: "+e.currentTarget.responseURL+"\nstatus: "+e.currentTarget.statusText),o.parser._onError(t)}),e||r("An invalid url was provided. Unable to continue!");const a=new URL(e,window.location.href).href;let l=a;const c=a.split("/");if(c.length>2){l=c[c.length-1];let e=c.slice(0,c.length-1).join("/")+"/";void 0!==e&&(this.path=e)}if(null==n||!(n instanceof Function)){let t=0,i=0;n=function(n){if(n.lengthComputable&&(i=n.loaded/n.total,i>t)){t=i;const n='Download of "'+e+'": '+(100*i).toFixed(2)+"%";o.parser._onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(s);const h=new i.FileLoader(this.manager);h.setPath(this.path||this.resourcePath),h.setResponseType("arraybuffer"),h.load(l,(function(e){o.parse(e)}),n,r)}parse(e){if(this.parser.logging.enabled&&console.info("Using OBJLoader2 version: "+x.OBJLOADER2_VERSION),null==e)throw"Provided content is not a valid ArrayBuffer or String. Unable to continue parsing";return this.parser.logging.enabled&&console.time("OBJLoader parse: "+this.modelName),e instanceof ArrayBuffer||e instanceof Uint8Array?(this.parser.logging.enabled&&console.info("Parsing arrayBuffer..."),this.parser._execute(e)):"string"==typeof e||e instanceof String?(this.parser.logging.enabled&&console.info("Parsing text..."),this.parser._executeLegacy(e)):this.parser._onError("Provided content was neither of type String nor Uint8Array! Aborting..."),this.parser.logging.enabled&&console.timeEnd("OBJLoader parse: "+this.modelName),this.parser.baseObject3d}}v(x,"OBJLOADER2_VERSION","4.0.0-dev");class b{constructor(){this.logging={enabled:!1,debug:!1},this.usedBefore=!1,this._init(),this.callbacks={onLoad:null,onError:null,onProgress:null,onMeshAlter:null}}_init(){this.contentRef=null,this.legacyMode=!1,this.materials={},this.baseObject3d=new i.Object3D,this.modelName="noname",this.materialPerSmoothingGroup=!1,this.useOAsMesh=!1,this.useIndices=!1,this.disregardNormals=!1,this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],this.objectId=0,this.rawMesh={objectName:"",groupName:"",activeMtlName:"",mtllibName:"",faceType:-1,subGroups:[],subGroupInUse:null,smoothingGroup:{splitMaterials:!1,normalized:-1,real:-1},counts:{doubleIndicesCount:0,faceCount:0,mtlCount:0,smoothingGroupCount:0}},this.inputObjectCount=1,this.outputObjectCount=1,this.globalCounts={vertices:0,faces:0,doubleIndicesCount:0,lineByte:0,currentByte:0,totalBytes:0}}_resetRawMesh(){this.rawMesh.subGroups=[],this.rawMesh.subGroupInUse=null,this.rawMesh.smoothingGroup.normalized=-1,this.rawMesh.smoothingGroup.real=-1,this._pushSmoothingGroup(1),this.rawMesh.counts.doubleIndicesCount=0,this.rawMesh.counts.faceCount=0,this.rawMesh.counts.mtlCount=0,this.rawMesh.counts.smoothingGroupCount=0}_configure(){if(this.usedBefore=!0,this._pushSmoothingGroup(1),this.logging.enabled){const e=Object.keys(this.materials);let t="OBJLoader2 Parser configuration:"+(e.length>0?"\n\tmaterialNames:\n\t\t- "+e.join("\n\t\t- "):"\n\tmaterialNames: None")+"\n\tmaterialPerSmoothingGroup: "+this.materialPerSmoothingGroup+"\n\tuseOAsMesh: "+this.useOAsMesh+"\n\tuseIndices: "+this.useIndices+"\n\tdisregardNormals: "+this.disregardNormals;null!==this.callbacks.onProgress&&(t+="\n\tcallbacks.onProgress: "+this.callbacks.onProgress.name),null!==this.callbacks.onError&&(t+="\n\tcallbacks.onError: "+this.callbacks.onError.name),null!==this.callbacks.onMeshAlter&&(t+="\n\tcallbacks.onMeshAlter: "+this.callbacks.onMeshAlter.name),null!==this.callbacks.onLoad&&(t+="\n\tcallbacks.onLoad: "+this.callbacks.onLoad.name),console.info(t)}}_execute(e){this.logging.enabled&&console.time("OBJLoader2Parser.execute"),this._configure();const t=new Uint8Array(e);this.contentRef=t;const n=t.byteLength;this.globalCounts.totalBytes=n;const i=new Array(128);let r,s=0,o=0,a="",l=0;for(;l0&&(i[s++]=a),a="";break;case 47:a.length>0&&(i[s++]=a),o++,a="";break;case 10:this._processLine(i,s,o,a,l),a="",s=0,o=0;break;case 13:break;default:a+=String.fromCharCode(r)}this._processLine(i,s,o,a,l),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.execute")}_executeLegacy(e){this.logging.enabled&&console.time("OBJLoader2Parser.executeLegacy"),this._configure(),this.legacyMode=!0,this.contentRef=e;const t=e.length;this.globalCounts.totalBytes=t;const n=new Array(128);let i,r=0,s=0,o="",a=0;for(;a0&&(n[r++]=o),o="";break;case"/":o.length>0&&(n[r++]=o),s++,o="";break;case"\n":this._processLine(n,r,s,o,a),o="",r=0,s=0;break;case"\r":break;default:o+=i}this._processLine(n,r,o,s),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.executeLegacy")}_processLine(e,t,n,i,r){if(this.globalCounts.lineByte=this.globalCounts.currentByte,this.globalCounts.currentByte=r,t<1)return;i.length>0&&(e[t++]=i);const s=function(e,t,n,i){let r="";if(i>n){let s;if(t)for(s=n;s4&&(this.colors.push(parseFloat(e[4])),this.colors.push(parseFloat(e[5])),this.colors.push(parseFloat(e[6])));break;case"vt":this.uvs.push(parseFloat(e[1])),this.uvs.push(parseFloat(e[2]));break;case"vn":this.normals.push(parseFloat(e[1])),this.normals.push(parseFloat(e[2])),this.normals.push(parseFloat(e[3]));break;case"f":if(o=t-1,0===n)for(this._checkFaceType(0),l=2,a=o;l0?s-1:s+r.vertices.length/3),a=r.colors.length>0?o:null;const l=i.vertices;if(l.push(r.vertices[o++]),l.push(r.vertices[o++]),l.push(r.vertices[o]),null!==a){const e=i.colors;e.push(r.colors[a++]),e.push(r.colors[a++]),e.push(r.colors[a])}if(t){const e=parseInt(t);let n=2*(e>0?e-1:e+r.uvs.length/2);const s=i.uvs;s.push(r.uvs[n++]),s.push(r.uvs[n])}if(n&&!r.disregardNormals){const e=parseInt(n);let t=3*(e>0?e-1:e+r.normals.length/3);const s=i.normals;s.push(r.normals[t++]),s.push(r.normals[t++]),s.push(r.normals[t])}};if(this.useIndices){this.disregardNormals&&(n=void 0);const r=e+(t?"_"+t:"_n")+(n?"_"+n:"_n");let o=i.indexMappings[r];null==o?(o=this.rawMesh.subGroupInUse.vertices.length/3,s(),i.indexMappings[r]=o,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(o)}else s();this.rawMesh.counts.faceCount++}_createRawMeshReport(e){return"Input Object number: "+e+"\n\tObject name: "+this.rawMesh.objectName+"\n\tGroup name: "+this.rawMesh.groupName+"\n\tMtllib name: "+this.rawMesh.mtllibName+"\n\tVertex count: "+this.vertices.length/3+"\n\tNormal count: "+this.normals.length/3+"\n\tUV count: "+this.uvs.length/2+"\n\tSmoothingGroup count: "+this.rawMesh.counts.smoothingGroupCount+"\n\tMaterial count: "+this.rawMesh.counts.mtlCount+"\n\tReal MeshOutputGroup count: "+this.rawMesh.subGroups.length}_finalizeRawMesh(){const e=[];let t,n,i=0,r=0,s=0,o=0,a=0,l=0;for(const c in this.rawMesh.subGroups)if(t=this.rawMesh.subGroups[c],t.vertices.length>0){if(n=t.indices,n.length>0&&r>0)for(let e=0;e0&&(c={name:""!==this.rawMesh.groupName?this.rawMesh.groupName:this.rawMesh.objectName,subGroups:e,absoluteVertexCount:i,absoluteIndexCount:s,absoluteColorCount:o,absoluteNormalCount:a,absoluteUvCount:l,faceCount:this.rawMesh.counts.faceCount,doubleIndicesCount:this.rawMesh.counts.doubleIndicesCount}),c}_processCompletedMesh(){const e=this._finalizeRawMesh(),t=null!==e;if(t){this.colors.length>0&&this.colors.length!==this.vertices.length&&this._onError("Vertex Colors were detected, but vertex count and color count do not match!"),this.logging.enabled&&this.logging.debug&&console.debug(this._createRawMeshReport(this.inputObjectCount)),this.inputObjectCount++,this._buildMesh(e);const t=this.globalCounts.currentByte/this.globalCounts.totalBytes;this._onProgress("Completed [o: "+this.rawMesh.objectName+" g:"+this.rawMesh.groupName+"] Total progress: "+(100*t).toFixed(2)+"%"),this._resetRawMesh()}return t}_buildMesh(e){const t=e.subGroups;this.globalCounts.vertices+=e.absoluteVertexCount/3,this.globalCounts.faces+=e.faceCount,this.globalCounts.doubleIndicesCount+=e.doubleIndicesCount;const n=new i.BufferGeometry,s=new Float32Array(e.absoluteVertexCount),o=e.absoluteIndexCount>0?new Uint32Array(e.absoluteIndexCount):null,a=e.absoluteColorCount>0?new Float32Array(e.absoluteColorCount):null,l=e.absoluteNormalCount>0?new Float32Array(e.absoluteNormalCount):null,c=e.absoluteUvCount>0?new Float32Array(e.absoluteUvCount):null;let h;n.setAttribute("position",new i.BufferAttribute(s,3,!1)),null!=l&&n.setAttribute("normal",new i.BufferAttribute(l,3,!1)),null!=c&&n.setAttribute("uv",new i.BufferAttribute(c,2,!1)),null!=a&&n.setAttribute("color",new i.BufferAttribute(a,3,!1)),null!==o&&n.setIndex(new i.BufferAttribute(o,1,!1));let u=0,d=0,p=0,f=0,m=0,g=0,y=0;const _=t.length>1,v=[],x=null!==a;let b,w,M,S,E,T=0;const A={cloneInstructions:[],multiMaterialNames:{},modelName:this.modelName,progress:this.globalCounts.currentByte/this.globalCounts.totalBytes,geometryType:this.rawMesh.faceType<4?0:6===this.rawMesh.faceType?2:1,objectId:this.objectId};for(const e in t)if(t.hasOwnProperty(e)){if(h=t[e],E=h.materialName,b=0===h.smoothingGroup,this.rawMesh.faceType<4?(S=E,x&&(S+="_vertexColor"),b&&(S+="_flat")):S=6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",w=this.materials[E],M=this.materials[S],null==w&&null==M&&(S=x?"defaultVertexColorMaterial":"defaultMaterial",M=this.materials[S],this.logging.enabled&&console.info('object_group "'+h.objectName+"_"+h.groupName+'" was defined with unresolvable material "'+E+'"! Assigning "'+S+'".')),null==M){const e={materialNameOrg:E,materialProperties:{name:S,vertexColors:x?2:0,flatShading:b}};M=r.cloneMaterial(this.materials,e,this.logging.enabled&&this.logging.debug),A.cloneInstructions.push(e)}if(_&&(y=this.useIndices?h.indices.length:h.vertices.length/3,n.addGroup(g,y,T),M=this.materials[S],v[T]=M,A.multiMaterialNames[T]=M.name,g+=y,T++),s.set(h.vertices,u),u+=h.vertices.length,null!==o&&(o.set(h.indices,d),d+=h.indices.length),null!==a&&(a.set(h.colors,p),p+=h.colors.length),null!==l&&(l.set(h.normals,f),f+=h.normals.length),null!==c&&(c.set(h.uvs,m),m+=h.uvs.length),this.logging.enabled&&this.logging.debug){let e="";T>0&&(e="\n\t\tmaterialIndex: "+T);const t="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+h.groupName+"\n\t\tIndex: "+h.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+h.materialName+"\n\t\tsmoothingGroup: "+h.smoothingGroup+e+"\n\t\tobjectName: "+h.objectName+"\n\t\t#vertices: "+h.vertices.length/3+"\n\t\t#indices: "+h.indices.length+"\n\t\t#colors: "+h.colors.length/3+"\n\t\t#uvs: "+h.uvs.length/2+"\n\t\t#normals: "+h.normals.length/3;console.debug(t)}}let C;this.outputObjectCount++,null==n.getAttribute("normal")&&n.computeVertexNormals();const L=_?v:M;C=0===A.geometryType?new i.Mesh(n,L):1===A.geometryType?new i.LineSegments(n,L):new i.Points(n,L),C.name=e.name,this._onAssetAvailable(C,A)}_finalizeParsing(){if(this.logging.enabled&&console.info("Global output object count: "+this.outputObjectCount),this._processCompletedMesh()&&this.logging.enabled){const e="Overall counts: \n\tVertices: "+this.globalCounts.vertices+"\n\tFaces: "+this.globalCounts.faces+"\n\tMultiple definitions: "+this.globalCounts.doubleIndicesCount;console.info(e)}this._onLoad()}_onProgress(e){if(null!==this.callbacks.onProgress)this.callbacks.onProgress(e);else{const t=e||"";this.logging.enabled&&this.logging.debug&&console.log(t)}}_onError(e){null!==this.callbacks.onError?this.callbacks.onError(e):this.logging.enabled&&this.logging.debug&&console.error(e)}_onAssetAvailable(e,t){this._onMeshAlter(e,t),this.baseObject3d.add(e)}_onMeshAlter(e){null!==this.callbacks.onMeshAlter&&this.callbacks.onMeshAlter(e,this.baseObject3d)}_onLoad(){null!==this.callbacks.onLoad&&this.callbacks.onLoad(this.baseObject3d,this.objectId)}static buildUglifiedMapping(){return s.buildUglifiedNameAssignment((function(){return b}),"OBJLoader2Parser",/_OBJLoader2Parser/,!0)}}class w{static buildStandardWorkerDependencies(e){return[{url:e},{code:s.buildThreeConst()},{code:w.buildThreeExtraConst()},{code:"\n\n"},{code:s.buildUglifiedThreeMapping()},{code:w.buildUglifiedThreeExtraMapping()},{code:"\n\n"},{code:h.serializeClass(o)},{code:h.serializeClass(l)},{code:h.serializeClass(c)},{code:h.serializeClass(a)},{code:h.serializeClass(r)},{code:h.serializeClass(b)},{code:h.serializeClass(u)},{code:s.buildUglifiedThreeWtmMapping()},{code:"\n\n"},{code:b.buildUglifiedMapping()},{code:"\n\n"}]}static buildThreeExtraConst(){return"const MathUtils = THREE.MathUtils;\nconst Material = THREE.Material;\nconst Object3D = THREE.Object3D;\nconst Mesh = THREE.Mesh;\n"}static buildUglifiedThreeExtraMapping(){return s.buildUglifiedNameAssignment((function(){return i.MathUtils}),"MathUtils",/_MathUtils/,!1)+s.buildUglifiedNameAssignment((function(){return i.Material}),"Material",/_Material/,!1)+s.buildUglifiedNameAssignment((function(){return i.Object3D}),"Object3D",/_Object3D/,!1)+s.buildUglifiedNameAssignment((function(){return i.Mesh}),"Mesh",/_Mesh/,!1)}static init(e,t,n){const i=(new a).loadData(n);e.obj2={parser:new b,buffer:null,materials:i.getMaterials()},e.obj2.parser._onMeshAlter=(t,n)=>{const i=new a;if(i.main.multiMaterialNames=n.multiMaterialNames,0===Object.keys(i.main.multiMaterialNames).length){const e=t.material;r.addMaterial(i.main.materials,e,e.name,!1,!1)}i.main.cloneInstructions=n.cloneInstructions,i.cleanMaterials(),new c("assetAvailable",n.objectId).setProgress(n.progress).setParams({modelName:n.modelName}).setMesh(t,n.geometryType).setMaterialsTransport(i).postMessage(e)},e.obj2.parser.callbacks.onLoad=()=>{new o("execComplete",e.obj2.parser.objectId).postMessage(e)},e.obj2.parser.callbacks.onProgress=t=>{e.obj2.parser.logging.debug&&console.debug("WorkerRunner: progress: "+t)},u.applyProperties(e.obj2.parser,i.getParams(),!1);const s=i.getBuffer("modelData");null!=s&&(e.obj2.buffer=s),new o("init",t).postMessage(e)}static execute(e,t,n){e.obj2.parser.usedBefore&&e.obj2.parser._init(),e.obj2.parser.materials=e.obj2.materials;const i=(new o).loadData(n);u.applyProperties(e.obj2.parser,i.getParams(),!1);const r=i.getBuffer("modelData");null!=r&&(e.obj2.buffer=r),e.obj2.buffer&&(e.obj2.parser.objectId=i.getId(),e.obj2.parser._execute(e.obj2.buffer))}}class M extends x{constructor(e){super(e),this.preferJsmWorker=!1,this.urls={jsmWorker:new URL(M.DEFAULT_JSM_WORKER_PATH,window.location.href),threejs:new URL(M.DEFAULT_JSM_THREEJS_PATH,window.location.href)},this.workerTaskManager=null,this.taskName="tmOBJLoader2"}setWorkerTaskManager(e,t){return this.workerTaskManager=e,t&&(this.taskName=t),this}setJsmWorker(e,t){if(this.preferJsmWorker=!0===e,!(null!=t&&t instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.jsmWorker=t,this}setThreejsLocation(e){if(!(null!=e&&e instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.threejs=e,this}setTerminateWorkerOnLoad(e){return this.terminateWorkerOnLoad=!0===e,this}async _buildWorkerCode(e){null!==this.workerTaskManager&&this.workerTaskManager instanceof f||(this.parser.logging.debug&&console.log("Needed to create new WorkerTaskManager"),this.workerTaskManager=new f(1),this.workerTaskManager.setVerbose(this.parser.logging.enabled&&this.parser.logging.debug)),this.workerTaskManager.supportsTaskType(this.taskName)||(this.preferJsmWorker?this.workerTaskManager.registerTaskTypeModule(this.taskName,this.urls.jsmWorker):this.workerTaskManager.registerTaskType(this.taskName,w.init,w.execute,null,!1,w.buildStandardWorkerDependencies(this.urls.threejs)),await this.workerTaskManager.initTaskType(this.taskName,e.getMain()))}load(e,t,n,i,r){const s=this;x.prototype.load.call(this,e,(function(e,n){"OBJLoader2ParallelDummy"===e.name?s.parser.logging.enabled&&s.parser.logging.debug&&console.debug("Received dummy answer from OBJLoader2Parallel#parse"):t(e,n)}),n,i,r)}parse(e){this.parser.logging.enabled&&console.info("Using OBJLoader2Parallel version: "+M.OBJLOADER2_PARALLEL_VERSION);const t=(new o).setParams({logging:{enabled:this.parser.logging.enabled,debug:this.parser.logging.debug}});this._buildWorkerCode(t).then((()=>{this.parser.logging.debug&&console.log("OBJLoader2Parallel init was performed"),this._executeWorkerParse(e)})).catch((e=>console.error(e)));let n=new i.Object3D;return n.name="OBJLoader2ParallelDummy",n}_executeWorkerParse(e){const t=new o("execute",Math.floor(Math.random()*Math.floor(65536)));t.setParams({modelName:this.parser.modelName,useIndices:this.parser.useIndices,disregardNormals:this.parser.disregardNormals,materialPerSmoothingGroup:this.parser.materialPerSmoothingGroup,useOAsMesh:this.parser.useOAsMesh,materials:r.getMaterialsJSON(this.materialStore.getMaterials())}).addBuffer("modelData",e).package(!1),this.workerTaskManager.enqueueForExecution(this.taskName,t.getMain(),(e=>this._onLoad(e)),t.getTransferables()).then((e=>{this._onLoad(e),this.terminateWorkerOnLoad&&this.workerTaskManager.dispose()})).catch((e=>console.error(e)))}_onLoad(e){let t=e.cmd;if("assetAvailable"===t){let t;if("MeshTransport"===e.type?t=(new c).loadData(e).reconstruct(!1):console.error("Received unknown asset.type: "+e.type),t){let e,n=t.getMaterialsTransport().processMaterialTransport(this.materialStore.getMaterials(),this.parser.logging.enabled);null===n&&(n=new i.MeshStandardMaterial({color:16711680})),e=0===t.getGeometryType()?new i.Mesh(t.getBufferGeometry(),n):1===t.getGeometryType()?new i.LineSegments(t.getBufferGeometry(),n):new i.Points(t.getBufferGeometry(),n),this.parser._onMeshAlter(e),this.parser.baseObject3d.add(e)}}else if("execComplete"===t){let t;"DataTransport"===e.type?(t=(new o).loadData(e),t instanceof o&&null!==this.parser.callbacks.onLoad&&this.parser.callbacks.onLoad(this.parser.baseObject3d,t.getId())):console.error("Received unknown asset.type: "+e.type)}else console.error("Received unknown command: "+t)}}v(M,"OBJLOADER2_PARALLEL_VERSION",x.OBJLOADER2_VERSION),v(M,"DEFAULT_JSM_WORKER_PATH","/src/loaders/tmOBJLoader2.js"),v(M,"DEFAULT_JSM_THREEJS_PATH","/node_modules/three/build/three.min.js");class S{static link(e,t){"function"==typeof t.setMaterials&&t.setMaterials(S.addMaterialsFromMtlLoader(e),!0)}static addMaterialsFromMtlLoader(e){let t={};return void 0!==e.preload&&e.preload instanceof Function&&(e.preload(),t=e.materials),t}}},676:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DataViewIndexOutOfBoundsError:()=>H,DecodeError:()=>x,Decoder:()=>W,EXT_TIMESTAMP:()=>b,Encoder:()=>R,ExtData:()=>_,ExtensionCodec:()=>C,decode:()=>q,decodeArrayStream:()=>ee,decodeAsync:()=>$,decodeMulti:()=>X,decodeMultiStream:()=>te,decodeStream:()=>ne,decodeTimestampExtension:()=>T,decodeTimestampToTimeSpec:()=>E,encode:()=>D,encodeDateToTimeSpec:()=>M,encodeTimeSpecToTimestamp:()=>w,encodeTimestampExtension:()=>S});var i,r,s,o=4294967295;function a(e,t,n){var i=Math.floor(n/4294967296),r=n;e.setUint32(t,i),e.setUint32(t+4,r)}function l(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var c=("undefined"==typeof process||"never"!==(null===(i=null===process||void 0===process?void 0:process.env)||void 0===i?void 0:i.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function h(e){for(var t=e.length,n=0,i=0;i=55296&&r<=56319&&i65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var m,g=c?new TextDecoder:null,y=c?"undefined"!=typeof process&&"force"!==(null===(s=null===process||void 0===process?void 0:process.env)||void 0===s?void 0:s.TEXT_DECODER)?200:0:o,_=function(e,t){this.type=e,this.data=t},v=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e){function t(n){var i=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(i,r),Object.defineProperty(i,"name",{configurable:!0,enumerable:!1,value:t.name}),i}return v(t,e),t}(Error),b=-1;function w(e){var t,n=e.sec,i=e.nsec;if(n>=0&&i>=0&&n<=17179869183){if(0===i&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var s=n/4294967296,o=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,i<<2|3&s),t.setUint32(4,o),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,i),a(t,4,n),r}function M(e){var t=e.getTime(),n=Math.floor(t/1e3),i=1e6*(t-1e3*n),r=Math.floor(i/1e9);return{sec:n+r,nsec:i-1e9*r}}function S(e){return e instanceof Date?w(M(e)):null}function E(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:l(t,4),nsec:t.getUint32(0)};default:throw new x("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}function T(e){var t=E(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:S,decode:T},C=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,i=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=i;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=i}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>d){var t=h(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),p(e,this.bytes,this.pos),this.pos+=t}else t=h(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var i=e.length,r=n,s=0;s>6&31|192;else{if(o>=55296&&o<=56319&&s>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=63&o|128}else t[r++]=o}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=L(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var i=0,r=e;i0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var i=0,r=this.caches[n-1];i=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)},e.prototype.decode=function(e,t,n){var i=this.find(e,t,n);if(null!=i)return this.hit++,i;this.miss++;var r=f(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,r),r},e}(),k=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof B?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},F=new DataView(new ArrayBuffer(0)),z=new Uint8Array(F.buffer),H=function(){try{F.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),G=new H("Insufficient data"),V=new O,W=function(){function e(e,t,n,i,r,s,a,l){void 0===e&&(e=C.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=o),void 0===i&&(i=o),void 0===r&&(r=o),void 0===s&&(s=o),void 0===a&&(a=o),void 0===l&&(l=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=r,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=l,this.totalPos=0,this.pos=0,this.view=F,this.bytes=z,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=L(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=L(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=L(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return k(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,i,r,s,o,a,l;return s=this,o=void 0,l=function(){var s,o,a,l,c,h,u,d;return k(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=N(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{o=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return l=p.sent(),i={error:l},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(i)throw i.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw h=(c=this).headByte,u=c.pos,d=c.totalPos,new RangeError("Insufficient data in parsing ".concat(I(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{r(l.next(e))}catch(e){t(e)}}function i(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(n,i)}r((l=l.apply(s,o||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return U(this,arguments,(function(){var n,i,r,s,o,a,l,c,h;return k(this,(function(u){switch(u.label){case 0:n=t,i=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),r=N(e),u.label=2;case 2:return[4,B(r.next())];case 3:if((s=u.sent()).done)return[3,12];if(o=s.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),n&&(i=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof H))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return l=u.sent(),c={error:l},[3,19];case 14:return u.trys.push([14,,17,18]),s&&!s.done&&(h=r.return)?[4,B(h.call(r))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(c)throw c.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(i=e-128)){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){if(0!=(i=e-144)){this.pushArrayState(i),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(i=this.readU16())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(221===e){if(0!==(i=this.readU32())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(222===e){if(0!==(i=this.readU16())){this.pushMapState(i),this.complete();continue e}t={}}else if(223===e){if(0!==(i=this.readU32())){this.pushMapState(i),this.complete();continue e}t={}}else if(196===e){var i=this.lookU8();t=this.decodeBinary(i,1)}else if(197===e)i=this.lookU16(),t=this.decodeBinary(i,2);else if(198===e)i=this.lookU32(),t=this.decodeBinary(i,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)i=this.lookU8(),t=this.decodeExtension(i,1);else if(200===e)i=this.lookU16(),t=this.decodeExtension(i,2);else{if(201!==e)throw new x("Unrecognized type byte: ".concat(I(e)));i=this.lookU32(),t=this.decodeExtension(i,4)}this.complete();for(var r=this.stack;r.length>0;){var s=r[r.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;r.pop(),t=s.array}else{if(1===s.type){if(void 0,"string"!=(o=typeof t)&&"number"!==o)throw new x("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new x("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}r.pop(),t=s.map}}return t}var o},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new x("Unrecognized array type byte: ".concat(I(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new x("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new x("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new x("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthy?function(e,t,n){var i=e.subarray(t,t+n);return g.decode(i)}(this.bytes,r,e):f(this.bytes,r,e),this.pos+=t+e,i},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new x("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw G;var n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new x("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=l(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),j={};function q(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function X(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var J=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Y?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function Q(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,i,r;return J(this,(function(s){switch(s.label){case 0:t=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Y(t.read())];case 3:return n=s.sent(),i=n.done,r=n.value,i?[4,Y(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return K(r),[4,Y(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function $(e,t){return void 0===t&&(t=j),n=this,i=void 0,s=function(){var n;return function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]{"use strict";n.r(t),n.d(t,{ACESFilmicToneMapping:()=>ne,AddEquation:()=>E,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>Ct,AdditiveBlending:()=>b,AlphaFormat:()=>Oe,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>nn,AmbientLight:()=>Uu,AmbientLightProbe:()=>td,AnimationClip:()=>cu,AnimationLoader:()=>yu,AnimationMixer:()=>Id,AnimationObjectGroup:()=>Pd,AnimationUtils:()=>Zh,ArcCurve:()=>vc,ArrayCamera:()=>Qa,ArrowHelper:()=>wp,Audio:()=>pd,AudioAnalyser:()=>vd,AudioContext:()=>Qu,AudioListener:()=>dd,AudioLoader:()=>$u,AxesHelper:()=>Mp,AxisHelper:()=>sf,BackSide:()=>m,BasicDepthPacking:()=>Ot,BasicShadowMap:()=>h,BinaryTextureLoader:()=>hf,Bone:()=>Ul,BooleanKeyframeTrack:()=>nu,BoundingBoxHelper:()=>of,Box2:()=>Vd,Box3:()=>ci,Box3Helper:()=>yp,BoxBufferGeometry:()=>cs,BoxGeometry:()=>cs,BoxHelper:()=>gp,BufferAttribute:()=>Er,BufferGeometry:()=>Vr,BufferGeometryLoader:()=>ju,ByteType:()=>Se,Cache:()=>uu,Camera:()=>fs,CameraHelper:()=>pp,CanvasRenderer:()=>df,CanvasTexture:()=>gc,CapsuleBufferGeometry:()=>zc,CapsuleGeometry:()=>zc,CatmullRomCurve3:()=>Ec,CineonToneMapping:()=>te,CircleBufferGeometry:()=>Hc,CircleGeometry:()=>Hc,ClampToEdgeWrapping:()=>ue,Clock:()=>od,Color:()=>jn,ColorKeyframeTrack:()=>iu,ColorManagement:()=>Un,CompressedTexture:()=>mc,CompressedTextureLoader:()=>_u,ConeBufferGeometry:()=>Vc,ConeGeometry:()=>Vc,CubeCamera:()=>ys,CubeReflectionMapping:()=>se,CubeRefractionMapping:()=>oe,CubeTexture:()=>_s,CubeTextureLoader:()=>xu,CubeUVReflectionMapping:()=>ce,CubicBezierCurve:()=>Lc,CubicBezierCurve3:()=>Rc,CubicInterpolant:()=>Qh,CullFaceBack:()=>a,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>o,Curve:()=>yc,CurvePath:()=>Bc,CustomBlending:()=>S,CustomToneMapping:()=>ie,CylinderBufferGeometry:()=>Gc,CylinderGeometry:()=>Gc,Cylindrical:()=>Hd,Data3DTexture:()=>ni,DataArrayTexture:()=>ei,DataTexture:()=>Fl,DataTexture2DArray:()=>wf,DataTexture3D:()=>Mf,DataTextureLoader:()=>bu,DataUtils:()=>Ep,DecrementStencilOp:()=>jt,DecrementWrapStencilOp:()=>Xt,DefaultLoadingManager:()=>pu,DepthFormat:()=>Fe,DepthStencilFormat:()=>ze,DepthTexture:()=>nl,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>hp,DiscreteInterpolant:()=>eu,DodecahedronBufferGeometry:()=>jc,DodecahedronGeometry:()=>jc,DoubleSide:()=>g,DstAlphaFactor:()=>N,DstColorFactor:()=>U,DynamicBufferAttribute:()=>Jp,DynamicCopyUsage:()=>un,DynamicDrawUsage:()=>sn,DynamicReadUsage:()=>ln,EdgesGeometry:()=>Zc,EdgesHelper:()=>af,EllipseCurve:()=>_c,EqualDepth:()=>j,EqualStencilFunc:()=>Kt,EquirectangularReflectionMapping:()=>ae,EquirectangularRefractionMapping:()=>le,Euler:()=>Xi,EventDispatcher:()=>gn,ExtrudeBufferGeometry:()=>Eh,ExtrudeGeometry:()=>Eh,FaceColors:()=>Bp,FileLoader:()=>gu,FlatShading:()=>y,Float16BufferAttribute:()=>Ir,Float32Attribute:()=>nf,Float32BufferAttribute:()=>Or,Float64Attribute:()=>rf,Float64BufferAttribute:()=>kr,FloatType:()=>Le,Fog:()=>ll,FogExp2:()=>al,Font:()=>vf,FontLoader:()=>_f,FramebufferTexture:()=>fc,FrontSide:()=>f,Frustum:()=>Ts,GLBufferAttribute:()=>Nd,GLSL1:()=>pn,GLSL3:()=>fn,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>tn,GreaterStencilFunc:()=>$t,GridHelper:()=>sp,Group:()=>$a,HalfFloatType:()=>Re,HemisphereLight:()=>Su,HemisphereLightHelper:()=>rp,HemisphereLightProbe:()=>ed,IcosahedronBufferGeometry:()=>Ah,IcosahedronGeometry:()=>Ah,ImageBitmapLoader:()=>Zu,ImageLoader:()=>vu,ImageUtils:()=>Xn,ImmediateRenderObject:()=>xf,IncrementStencilOp:()=>Wt,IncrementWrapStencilOp:()=>qt,InstancedBufferAttribute:()=>Vl,InstancedBufferGeometry:()=>Wu,InstancedInterleavedBuffer:()=>kd,InstancedMesh:()=>Jl,Int16Attribute:()=>Qp,Int16BufferAttribute:()=>Lr,Int32Attribute:()=>ef,Int32BufferAttribute:()=>Pr,Int8Attribute:()=>Yp,Int8BufferAttribute:()=>Tr,IntType:()=>Ae,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>dl,Interpolant:()=>Kh,InterpolateDiscrete:()=>bt,InterpolateLinear:()=>wt,InterpolateSmooth:()=>Mt,InvertStencilOp:()=>Jt,JSONLoader:()=>pf,KeepStencilOp:()=>Gt,KeyframeTrack:()=>tu,LOD:()=>Pl,LatheBufferGeometry:()=>Fc,LatheGeometry:()=>Fc,Layers:()=>Ji,LensFlare:()=>mf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>Qt,LessStencilFunc:()=>Zt,Light:()=>Mu,LightProbe:()=>Hu,Line:()=>tc,Line3:()=>qd,LineBasicMaterial:()=>Yl,LineCurve:()=>Pc,LineCurve3:()=>Dc,LineDashedMaterial:()=>Jh,LineLoop:()=>sc,LinePieces:()=>kp,LineSegments:()=>rc,LineStrip:()=>Op,LinearEncoding:()=>Dt,LinearFilter:()=>_e,LinearInterpolant:()=>$h,LinearMipMapLinearFilter:()=>we,LinearMipMapNearestFilter:()=>xe,LinearMipmapLinearFilter:()=>be,LinearMipmapNearestFilter:()=>ve,LinearSRGBColorSpace:()=>zt,LinearToneMapping:()=>$,Loader:()=>fu,LoaderUtils:()=>Vu,LoadingManager:()=>du,LoopOnce:()=>_t,LoopPingPong:()=>xt,LoopRepeat:()=>vt,LuminanceAlphaFormat:()=>Ue,LuminanceFormat:()=>Be,MOUSE:()=>r,Material:()=>br,MaterialLoader:()=>Gu,Math:()=>Cn,MathUtils:()=>Cn,Matrix3:()=>Rn,Matrix4:()=>Bi,MaxEquation:()=>L,Mesh:()=>as,MeshBasicMaterial:()=>wr,MeshDepthMaterial:()=>qa,MeshDistanceMaterial:()=>Xa,MeshFaceMaterial:()=>Fp,MeshLambertMaterial:()=>qh,MeshMatcapMaterial:()=>Xh,MeshNormalMaterial:()=>jh,MeshPhongMaterial:()=>Vh,MeshPhysicalMaterial:()=>Gh,MeshStandardMaterial:()=>Hh,MeshToonMaterial:()=>Wh,MinEquation:()=>C,MirroredRepeatWrapping:()=>de,MixOperation:()=>Z,MultiMaterial:()=>zp,MultiplyBlending:()=>M,MultiplyOperation:()=>Y,NearestFilter:()=>pe,NearestMipMapLinearFilter:()=>ye,NearestMipMapNearestFilter:()=>me,NearestMipmapLinearFilter:()=>ge,NearestMipmapNearestFilter:()=>fe,NeverDepth:()=>H,NeverStencilFunc:()=>Yt,NoBlending:()=>v,NoColorSpace:()=>Ut,NoColors:()=>Np,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>At,NormalBlending:()=>x,NotEqualDepth:()=>J,NotEqualStencilFunc:()=>en,NumberKeyframeTrack:()=>ru,Object3D:()=>lr,ObjectLoader:()=>qu,ObjectSpaceNormalMap:()=>Bt,OctahedronBufferGeometry:()=>Ch,OctahedronGeometry:()=>Ch,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>B,OneMinusDstColorFactor:()=>F,OneMinusSrcAlphaFactor:()=>k,OneMinusSrcColorFactor:()=>I,OrthographicCamera:()=>Fs,PCFShadowMap:()=>u,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>Xs,ParametricGeometry:()=>gf,Particle:()=>Gp,ParticleBasicMaterial:()=>jp,ParticleSystem:()=>Vp,ParticleSystemMaterial:()=>qp,Path:()=>Uc,PerspectiveCamera:()=>ms,Plane:()=>Ms,PlaneBufferGeometry:()=>Ls,PlaneGeometry:()=>Ls,PlaneHelper:()=>_p,PointCloud:()=>Hp,PointCloudMaterial:()=>Wp,PointLight:()=>ku,PointLightHelper:()=>ep,Points:()=>uc,PointsMaterial:()=>oc,PolarGridHelper:()=>op,PolyhedronBufferGeometry:()=>Wc,PolyhedronGeometry:()=>Wc,PositionalAudio:()=>_d,PropertyBinding:()=>Rd,PropertyMixer:()=>xd,QuadraticBezierCurve:()=>Ic,QuadraticBezierCurve3:()=>Oc,Quaternion:()=>si,QuaternionKeyframeTrack:()=>ou,QuaternionLinearInterpolant:()=>su,REVISION:()=>i,RGBADepthPacking:()=>kt,RGBAFormat:()=>Ne,RGBAIntegerFormat:()=>je,RGBA_ASTC_10x10_Format:()=>ft,RGBA_ASTC_10x5_Format:()=>ut,RGBA_ASTC_10x6_Format:()=>dt,RGBA_ASTC_10x8_Format:()=>pt,RGBA_ASTC_12x10_Format:()=>mt,RGBA_ASTC_12x12_Format:()=>gt,RGBA_ASTC_4x4_Format:()=>it,RGBA_ASTC_5x4_Format:()=>rt,RGBA_ASTC_5x5_Format:()=>st,RGBA_ASTC_6x5_Format:()=>ot,RGBA_ASTC_6x6_Format:()=>at,RGBA_ASTC_8x5_Format:()=>lt,RGBA_ASTC_8x6_Format:()=>ct,RGBA_ASTC_8x8_Format:()=>ht,RGBA_BPTC_Format:()=>yt,RGBA_ETC2_EAC_Format:()=>nt,RGBA_PVRTC_2BPPV1_Format:()=>$e,RGBA_PVRTC_4BPPV1_Format:()=>Qe,RGBA_S3TC_DXT1_Format:()=>Xe,RGBA_S3TC_DXT3_Format:()=>Je,RGBA_S3TC_DXT5_Format:()=>Ye,RGBFormat:()=>ke,RGB_ETC1_Format:()=>et,RGB_ETC2_Format:()=>tt,RGB_PVRTC_2BPPV1_Format:()=>Ke,RGB_PVRTC_4BPPV1_Format:()=>Ze,RGB_S3TC_DXT1_Format:()=>qe,RGFormat:()=>Ve,RGIntegerFormat:()=>We,RawShaderMaterial:()=>zh,Ray:()=>Ni,Raycaster:()=>Bd,RectAreaLight:()=>Fu,RedFormat:()=>He,RedIntegerFormat:()=>Ge,ReinhardToneMapping:()=>ee,RepeatWrapping:()=>he,ReplaceStencilOp:()=>Vt,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>Lh,RingGeometry:()=>Lh,SRGBColorSpace:()=>Ft,Scene:()=>cl,SceneUtils:()=>ff,ShaderChunk:()=>Rs,ShaderLib:()=>Ds,ShaderMaterial:()=>ps,ShadowMaterial:()=>Fh,Shape:()=>Kc,ShapeBufferGeometry:()=>Rh,ShapeGeometry:()=>Rh,ShapePath:()=>Sp,ShapeUtils:()=>wh,ShortType:()=>Ee,Skeleton:()=>Gl,SkeletonHelper:()=>Qd,SkinnedMesh:()=>Bl,SmoothShading:()=>_,Source:()=>Jn,Sphere:()=>Ci,SphereBufferGeometry:()=>Ph,SphereGeometry:()=>Ph,Spherical:()=>zd,SphericalHarmonics3:()=>zu,SplineCurve:()=>kc,SpotLight:()=>Ru,SpotLightHelper:()=>Jd,Sprite:()=>Al,SpriteMaterial:()=>pl,SrcAlphaFactor:()=>O,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>D,StaticCopyUsage:()=>hn,StaticDrawUsage:()=>rn,StaticReadUsage:()=>an,StereoCamera:()=>sd,StreamCopyUsage:()=>dn,StreamDrawUsage:()=>on,StreamReadUsage:()=>cn,StringKeyframeTrack:()=>au,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>s,TangentSpaceNormalMap:()=>Nt,TetrahedronBufferGeometry:()=>Dh,TetrahedronGeometry:()=>Dh,TextGeometry:()=>yf,Texture:()=>Kn,TextureLoader:()=>wu,TorusBufferGeometry:()=>Ih,TorusGeometry:()=>Ih,TorusKnotBufferGeometry:()=>Oh,TorusKnotGeometry:()=>Oh,Triangle:()=>vr,TriangleFanDrawMode:()=>Pt,TriangleStripDrawMode:()=>Rt,TrianglesDrawMode:()=>Lt,TubeBufferGeometry:()=>kh,TubeGeometry:()=>kh,UVMapping:()=>re,Uint16Attribute:()=>$p,Uint16BufferAttribute:()=>Rr,Uint32Attribute:()=>tf,Uint32BufferAttribute:()=>Dr,Uint8Attribute:()=>Zp,Uint8BufferAttribute:()=>Ar,Uint8ClampedAttribute:()=>Kp,Uint8ClampedBufferAttribute:()=>Cr,Uniform:()=>Od,UniformsLib:()=>Ps,UniformsUtils:()=>ds,UnsignedByteType:()=>Me,UnsignedInt248Type:()=>Ie,UnsignedIntType:()=>Ce,UnsignedShort4444Type:()=>Pe,UnsignedShort5551Type:()=>De,UnsignedShortType:()=>Te,VSMShadowMap:()=>p,Vector2:()=>Ln,Vector3:()=>oi,Vector4:()=>Qn,VectorKeyframeTrack:()=>lu,Vertex:()=>Xp,VertexColors:()=>Up,VideoTexture:()=>pc,WebGL1Renderer:()=>ol,WebGL3DRenderTarget:()=>ii,WebGLArrayRenderTarget:()=>ti,WebGLCubeRenderTarget:()=>vs,WebGLMultipleRenderTargets:()=>ri,WebGLMultisampleRenderTarget:()=>bf,WebGLRenderTarget:()=>$n,WebGLRenderTargetCube:()=>uf,WebGLRenderer:()=>sl,WebGLUtils:()=>Ka,WireframeGeometry:()=>Nh,WireframeHelper:()=>lf,WrapAroundEnding:()=>Tt,XHRLoader:()=>cf,ZeroCurvatureEnding:()=>St,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Et,ZeroStencilOp:()=>Ht,_SRGBAFormat:()=>mn,sRGBEncoding:()=>It});const i="140",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,a=1,l=2,c=3,h=0,u=1,d=2,p=3,f=0,m=1,g=2,y=1,_=2,v=0,x=1,b=2,w=3,M=4,S=5,E=100,T=101,A=102,C=103,L=104,R=200,P=201,D=202,I=203,O=204,k=205,N=206,B=207,U=208,F=209,z=210,H=0,G=1,V=2,W=3,j=4,q=5,X=6,J=7,Y=0,Z=1,K=2,Q=0,$=1,ee=2,te=3,ne=4,ie=5,re=300,se=301,oe=302,ae=303,le=304,ce=306,he=1e3,ue=1001,de=1002,pe=1003,fe=1004,me=1004,ge=1005,ye=1005,_e=1006,ve=1007,xe=1007,be=1008,we=1008,Me=1009,Se=1010,Ee=1011,Te=1012,Ae=1013,Ce=1014,Le=1015,Re=1016,Pe=1017,De=1018,Ie=1020,Oe=1021,ke=1022,Ne=1023,Be=1024,Ue=1025,Fe=1026,ze=1027,He=1028,Ge=1029,Ve=1030,We=1031,je=1033,qe=33776,Xe=33777,Je=33778,Ye=33779,Ze=35840,Ke=35841,Qe=35842,$e=35843,et=36196,tt=37492,nt=37496,it=37808,rt=37809,st=37810,ot=37811,at=37812,lt=37813,ct=37814,ht=37815,ut=37816,dt=37817,pt=37818,ft=37819,mt=37820,gt=37821,yt=36492,_t=2200,vt=2201,xt=2202,bt=2300,wt=2301,Mt=2302,St=2400,Et=2401,Tt=2402,At=2500,Ct=2501,Lt=0,Rt=1,Pt=2,Dt=3e3,It=3001,Ot=3200,kt=3201,Nt=0,Bt=1,Ut="",Ft="srgb",zt="srgb-linear",Ht=0,Gt=7680,Vt=7681,Wt=7682,jt=7683,qt=34055,Xt=34056,Jt=5386,Yt=512,Zt=513,Kt=514,Qt=515,$t=516,en=517,tn=518,nn=519,rn=35044,sn=35048,on=35040,an=35045,ln=35049,cn=35041,hn=35046,un=35050,dn=35042,pn="100",fn="300 es",mn=1035;class gn{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+yn[e>>16&255]+yn[e>>24&255]+"-"+yn[255&t]+yn[t>>8&255]+"-"+yn[t>>16&15|64]+yn[t>>24&255]+"-"+yn[63&n|128]+yn[n>>8&255]+"-"+yn[n>>16&255]+yn[n>>24&255]+yn[255&i]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function wn(e,t,n){return Math.max(t,Math.min(n,e))}function Mn(e,t){return(e%t+t)%t}function Sn(e,t,n){return(1-n)*e+n*t}function En(e){return 0==(e&e-1)&&0!==e}function Tn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function An(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Cn=Object.freeze({__proto__:null,DEG2RAD:vn,RAD2DEG:xn,generateUUID:bn,clamp:wn,euclideanModulo:Mn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Sn,damp:function(e,t,n,i){return Sn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Mn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_n=e);let t=_n+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*vn},radToDeg:function(e){return e*xn},isPowerOfTwo:En,ceilPowerOfTwo:Tn,floorPowerOfTwo:An,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),u=s((t-i)/2),d=o((t-i)/2),p=s((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}},denormalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}});class Ln{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ln.prototype.isVector2=!0;class Rn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],x=i[2],b=i[5],w=i[8];return r[0]=s*f+o*y+a*x,r[3]=s*m+o*_+a*b,r[6]=s*g+o*v+a*w,r[1]=l*f+c*y+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*v+h*w,r[2]=u*f+d*y+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*v+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*s)*f,e[3]=u*f,e[4]=(c*t-i*a)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(s*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*r+n*a,i[3]=t*s+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*a,i[4]=-n*s+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Pn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}Rn.prototype.isMatrix3=!0;const Dn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function In(e,t){return new Dn[e](t)}function On(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function kn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Nn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}const Bn={[Ft]:{[zt]:kn},[zt]:{[Ft]:Nn}},Un={legacyMode:!0,get workingColorSpace(){return zt},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Bn[t]&&void 0!==Bn[t][n]){const i=Bn[t][n];return e.r=i(e.r),e.g=i(e.g),e.b=i(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Fn={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},zn={r:0,g:0,b:0},Hn={h:0,s:0,l:0},Gn={h:0,s:0,l:0};function Vn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Wn(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class jn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Un.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=zt){return this.r=e,this.g=t,this.b=n,Un.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=zt){if(e=Mn(e,1),t=wn(t,0,1),n=wn(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Vn(r,i,e+1/3),this.g=Vn(r,i,e),this.b=Vn(r,i,e-1/3)}return Un.toWorkingColorSpace(this,i),this}setStyle(e,t=Ft){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,Un.toWorkingColorSpace(this,t),n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,Un.toWorkingColorSpace(this,t),n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return n(e[4]),this.setHSL(i,r,s,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=i[1],n=e.length;if(3===n)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,Un.toWorkingColorSpace(this,t),this;if(6===n)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,Un.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ft){const n=Fn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=Nn(e.r),this.g=Nn(e.g),this.b=Nn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ft){return Un.fromWorkingColorSpace(Wn(this,zn),e),wn(255*zn.r,0,255)<<16^wn(255*zn.g,0,255)<<8^wn(255*zn.b,0,255)<<0}getHexString(e=Ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=zt){Un.fromWorkingColorSpace(Wn(this,zn),t);const n=zn.r,i=zn.g,r=zn.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=On("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case ue:e.x=e.x<0?0:1;break;case de:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case he:e.y=e.y-Math.floor(e.y);break;case ue:e.y=e.y<0?0:1;break;case de:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}Kn.DEFAULT_IMAGE=null,Kn.DEFAULT_MAPPING=re,Kn.prototype.isTexture=!0;class Qn{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)a&&e>y?ey?a=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}si.prototype.isQuaternion=!0;class oi{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(li.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(li.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=a*t+s*i-o*n,c=a*n+o*t-r*i,h=a*i+r*n-s*t,u=-r*t-s*n-o*i;return this.x=l*a+u*-r+c*-o-h*-s,this.y=c*a+u*-s+h*-r-l*-o,this.z=h*a+u*-o+l*-s-c*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ai.copy(this).projectOnVector(e),this.sub(ai)}reflect(e){return this.sub(ai.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}oi.prototype.isVector3=!0;const ai=new oi,li=new si;class ci{constructor(e=new oi(1/0,1/0,1/0),t=new oi(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.length;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.count;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ui),ui.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vi),xi.subVectors(this.max,vi),pi.subVectors(e.a,vi),fi.subVectors(e.b,vi),mi.subVectors(e.c,vi),gi.subVectors(fi,pi),yi.subVectors(mi,fi),_i.subVectors(pi,mi);let t=[0,-gi.z,gi.y,0,-yi.z,yi.y,0,-_i.z,_i.y,gi.z,0,-gi.x,yi.z,0,-yi.x,_i.z,0,-_i.x,-gi.y,gi.x,0,-yi.y,yi.x,0,-_i.y,_i.x,0];return!!Mi(t,pi,fi,mi,xi)&&(t=[1,0,0,0,1,0,0,0,1],!!Mi(t,pi,fi,mi,xi)&&(bi.crossVectors(gi,yi),t=[bi.x,bi.y,bi.z],Mi(t,pi,fi,mi,xi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ui.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ui).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(hi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ci.prototype.isBox3=!0;const hi=[new oi,new oi,new oi,new oi,new oi,new oi,new oi,new oi],ui=new oi,di=new ci,pi=new oi,fi=new oi,mi=new oi,gi=new oi,yi=new oi,_i=new oi,vi=new oi,xi=new oi,bi=new oi,wi=new oi;function Mi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){wi.fromArray(e,s);const o=r.x*Math.abs(wi.x)+r.y*Math.abs(wi.y)+r.z*Math.abs(wi.z),a=t.dot(wi),l=n.dot(wi),c=i.dot(wi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Si=new ci,Ei=new oi,Ti=new oi,Ai=new oi;class Ci{constructor(e=new oi,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Si.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ai.subVectors(e,this.center);const t=Ai.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ai.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?Ti.set(0,0,1).multiplyScalar(e.radius):Ti.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ei.copy(e.center).add(Ti)),this.expandByPoint(Ei.copy(e.center).sub(Ti)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Li=new oi,Ri=new oi,Pi=new oi,Di=new oi,Ii=new oi,Oi=new oi,ki=new oi;class Ni{constructor(e=new oi,t=new oi(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Li.copy(this.direction).multiplyScalar(t).add(this.origin),Li.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ri.copy(e).add(t).multiplyScalar(.5),Pi.copy(t).sub(e).normalize(),Di.copy(this.origin).sub(Ri);const r=.5*e.distanceTo(t),s=-this.direction.dot(Pi),o=Di.dot(this.direction),a=-Di.dot(Pi),l=Di.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Pi).multiplyScalar(u).add(Ri),d}intersectSphere(e,t){Li.subVectors(e.center,this.origin);const n=Li.dot(this.direction),i=Li.dot(Li)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,s=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,s=(e.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Li)}intersectTriangle(e,t,n,i,r){Ii.subVectors(t,e),Oi.subVectors(n,e),ki.crossVectors(Ii,Oi);let s,o=this.direction.dot(ki);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Di.subVectors(this.origin,e);const a=s*this.direction.dot(Oi.crossVectors(Di,Oi));if(a<0)return null;const l=s*this.direction.dot(Ii.cross(Di));if(l<0)return null;if(a+l>o)return null;const c=-s*Di.dot(ki);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Bi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Bi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ui.setFromMatrixColumn(e,0).length(),r=1/Ui.setFromMatrixColumn(e,1).length(),s=1/Ui.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zi,e,Hi)}lookAt(e,t,n){const i=this.elements;return Wi.subVectors(e,t),0===Wi.lengthSq()&&(Wi.z=1),Wi.normalize(),Gi.crossVectors(n,Wi),0===Gi.lengthSq()&&(1===Math.abs(n.z)?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),Gi.crossVectors(n,Wi)),Gi.normalize(),Vi.crossVectors(Wi,Gi),i[0]=Gi.x,i[4]=Vi.x,i[8]=Wi.x,i[1]=Gi.y,i[5]=Vi.y,i[9]=Wi.y,i[2]=Gi.z,i[6]=Vi.z,i[10]=Wi.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],C=i[13],L=i[2],R=i[6],P=i[10],D=i[14],I=i[3],O=i[7],k=i[11],N=i[15];return r[0]=s*b+o*E+a*L+l*I,r[4]=s*w+o*T+a*R+l*O,r[8]=s*M+o*A+a*P+l*k,r[12]=s*S+o*C+a*D+l*N,r[1]=c*b+h*E+u*L+d*I,r[5]=c*w+h*T+u*R+d*O,r[9]=c*M+h*A+u*P+d*k,r[13]=c*S+h*C+u*D+d*N,r[2]=p*b+f*E+m*L+g*I,r[6]=p*w+f*T+m*R+g*O,r[10]=p*M+f*A+m*P+g*k,r[14]=p*S+f*C+m*D+g*N,r[3]=y*b+_*E+v*L+x*I,r[7]=y*w+_*T+v*R+x*O,r[11]=y*M+_*A+v*P+x*k,r[15]=y*S+_*C+v*D+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-i*l*h-r*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*s*h-n*s*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=h*m*l-f*u*l+f*a*d-o*m*d-h*a*g+o*u*g,_=p*u*l-c*m*l-p*a*d+s*m*d+c*a*g-s*u*g,v=c*f*l-p*h*l+p*o*d-s*f*d-c*o*g+s*h*g,x=p*h*a-c*f*a-p*o*u+s*f*u+c*o*m-s*h*m,b=t*y+n*_+i*v+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,e[2]=(o*m*r-f*a*r+f*i*l-n*m*l-o*i*g+n*a*g)*w,e[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=_*w,e[5]=(c*m*r-p*u*r+p*i*d-t*m*d-c*i*g+t*u*g)*w,e[6]=(p*a*r-s*m*r-p*i*l+t*m*l+s*i*g-t*a*g)*w,e[7]=(s*u*r-c*a*r+c*i*l-t*u*l-s*i*d+t*a*d)*w,e[8]=v*w,e[9]=(p*h*r-c*f*r-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(s*f*r-p*o*r+p*n*l-t*f*l-s*n*g+t*o*g)*w,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*f*i-p*h*i+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*o*i-s*f*i-p*n*a+t*f*a+s*n*m-t*o*m)*w,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=o*h,y=a*l,_=a*c,v=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+v)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(u+g))*b,i[6]=(m+y)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-y)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ui.set(i[0],i[1],i[2]).length();const s=Ui.set(i[4],i[5],i[6]).length(),o=Ui.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Fi.copy(this);const a=1/r,l=1/s,c=1/o;return Fi.elements[0]*=a,Fi.elements[1]*=a,Fi.elements[2]*=a,Fi.elements[4]*=l,Fi.elements[5]*=l,Fi.elements[6]*=l,Fi.elements[8]*=c,Fi.elements[9]*=c,Fi.elements[10]*=c,t.setFromRotationMatrix(Fi),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,s){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(s-r),h=(t+e)*a,u=(n+i)*l,d=(s+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Bi.prototype.isMatrix4=!0;const Ui=new oi,Fi=new Bi,zi=new oi(0,0,0),Hi=new oi(1,1,1),Gi=new oi,Vi=new oi,Wi=new oi,ji=new Bi,qi=new si;class Xi{constructor(e=0,t=0,n=0,i=Xi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(wn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-wn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(wn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-wn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-wn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ji.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ji,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qi.setFromEuler(this),this.setFromQuaternion(qi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xi.prototype.isEuler=!0,Xi.DefaultOrder="XYZ",Xi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ji{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){cr.subVectors(i,t),hr.subVectors(n,t),ur.subVectors(e,t);const s=cr.dot(cr),o=cr.dot(hr),a=cr.dot(ur),l=hr.dot(hr),c=hr.dot(ur),h=s*l-o*o;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,dr),dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getUV(e,t,n,i,r,s,o,a){return this.getBarycoord(e,t,n,i,dr),a.set(0,0),a.addScaledVector(r,dr.x),a.addScaledVector(s,dr.y),a.addScaledVector(o,dr.z),a}static isFrontFacing(e,t,n,i){return cr.subVectors(n,t),hr.subVectors(e,t),cr.cross(hr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return cr.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),.5*cr.cross(hr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return vr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return vr.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;pr.subVectors(i,n),fr.subVectors(r,n),gr.subVectors(e,n);const a=pr.dot(gr),l=fr.dot(gr);if(a<=0&&l<=0)return t.copy(n);yr.subVectors(e,i);const c=pr.dot(yr),h=fr.dot(yr);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(pr,s);_r.subVectors(e,r);const d=pr.dot(_r),p=fr.dot(_r);if(p>=0&&d<=p)return t.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fr,o);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return mr.subVectors(r,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(mr,o);const g=1/(m+f+u);return s=f*g,o=u*g,t.copy(n).addScaledVector(pr,s).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let xr=0;class br extends gn{constructor(){super(),Object.defineProperty(this,"id",{value:xr++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=O,this.blendDst=k,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=nn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gt,this.stencilZFail=Gt,this.stencilZPass=Gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===y;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==f&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}br.prototype.isMaterial=!0,br.fromType=function(){return null};class wr extends br{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}wr.prototype.isMeshBasicMaterial=!0;const Mr=new oi,Sr=new Ln;class Er{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(r),!1===e.ray.intersectsSphere(qr))return;if(Wr.copy(r).invert(),jr.copy(e.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===jr.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:os.clone(),object:e}}(e,t,n,i,Xr,Jr,Yr,ss);if(p){a&&(ns.fromBufferAttribute(a,c),is.fromBufferAttribute(a,h),rs.fromBufferAttribute(a,u),p.uv=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln)),l&&(ns.fromBufferAttribute(l,c),is.fromBufferAttribute(l,h),rs.fromBufferAttribute(l,u),p.uv2=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln));const e={a:c,b:h,c:u,normal:new oi,materialIndex:0};vr.getNormal(Xr,Jr,Yr,e.normal),p.face=e}return p}as.prototype.isMesh=!0;class cs extends Vr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,i,r,s,p,f,m,g,y){const _=s/m,v=p/g,x=s/2,b=p/2,w=f/2,M=m+1,S=g+1;let E=0,T=0;const A=new oi;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}ps.prototype.isShaderMaterial=!0;class fs extends lr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Bi,this.projectionMatrix=new Bi,this.projectionMatrixInverse=new Bi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}fs.prototype.isCamera=!0;class ms extends fs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*xn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*vn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*xn*Math.atan(Math.tan(.5*vn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*vn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}ms.prototype.isPerspectiveCamera=!0;const gs=90;class ys extends lr{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ms(gs,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new oi(1,0,0)),this.add(i);const r=new ms(gs,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new oi(-1,0,0)),this.add(r);const s=new ms(gs,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new oi(0,1,0)),this.add(s);const o=new ms(gs,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new oi(0,-1,0)),this.add(o);const a=new ms(gs,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new oi(0,0,1)),this.add(a);const l=new ms(gs,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new oi(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,c=e.getRenderTarget(),h=e.toneMapping,u=e.xr.enabled;e.toneMapping=Q,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=h,e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class _s extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:se,n,i,r,s,o,a,l,c),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}_s.prototype.isCubeTexture=!0;class vs extends $n{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new _s(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:_e}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new cs(5,5,5),o=new ps({name:"CubemapFromEquirect",uniforms:hs(n),vertexShader:i,fragmentShader:r,side:m,blending:v});o.uniforms.tEquirect.value=t;const a=new as(s,o),l=t.minFilter;return t.minFilter===be&&(t.minFilter=_e),new ys(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}vs.prototype.isWebGLCubeRenderTarget=!0;const xs=new oi,bs=new oi,ws=new Rn;class Ms{constructor(e=new oi(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=xs.subVectors(n,t).cross(bs.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(xs),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ws.getNormalMatrix(e),i=this.coplanarPoint(xs).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Ms.prototype.isPlane=!0;const Ss=new Ci,Es=new oi;class Ts{constructor(e=new Ms,t=new Ms,n=new Ms,i=new Ms,r=new Ms,s=new Ms){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],_=n[15];return t[0].setComponents(o-i,h-a,f-u,_-m).normalize(),t[1].setComponents(o+i,h+a,f+u,_+m).normalize(),t[2].setComponents(o+r,h+l,f+d,_+g).normalize(),t[3].setComponents(o-r,h-l,f-d,_-g).normalize(),t[4].setComponents(o-s,h-c,f-p,_-y).normalize(),t[5].setComponents(o+s,h+c,f+p,_+y).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ss.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(e){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Es.y=i.normal.y>0?e.max.y:e.min.y,Es.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Es)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Cs(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 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}\nfloat 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}\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\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; }\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 color ) { return dot( color, vec3( 0.3333 ) ); }\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};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.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}",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\tvec2 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 r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), 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_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 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, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( 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}",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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\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 )\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 )\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:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, 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#if defined( 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, 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#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\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\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_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\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 ( PHYSICALLY_CORRECT_LIGHTS )\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#else\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#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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\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 GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\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_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, 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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\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 ], geometry.normal );\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, vUv2 );\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( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\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#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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\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_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\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, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\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\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\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 = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\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 OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - 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_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, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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\tvarying vec4 vSpotShadowCoord[ 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#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\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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, vSpotShadowCoord[ 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\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\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, vUv );\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 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}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\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\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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\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;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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, vUv2 );\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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \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 + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Ps={common:{diffuse:{value:new jn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Rn},uv2Transform:{value:new Rn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ln(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new jn(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 jn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}},sprite:{diffuse:{value:new jn(16777215)},opacity:{value:1},center:{value:new Ln(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}}},Ds={basic:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.fog]),vertexShader:Rs.meshbasic_vert,fragmentShader:Rs.meshbasic_frag},lambert:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshlambert_vert,fragmentShader:Rs.meshlambert_frag},phong:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},specular:{value:new jn(1118481)},shininess:{value:30}}]),vertexShader:Rs.meshphong_vert,fragmentShader:Rs.meshphong_frag},standard:{uniforms:us([Ps.common,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.roughnessmap,Ps.metalnessmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag},toon:{uniforms:us([Ps.common,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.gradientmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshtoon_vert,fragmentShader:Rs.meshtoon_frag},matcap:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,{matcap:{value:null}}]),vertexShader:Rs.meshmatcap_vert,fragmentShader:Rs.meshmatcap_frag},points:{uniforms:us([Ps.points,Ps.fog]),vertexShader:Rs.points_vert,fragmentShader:Rs.points_frag},dashed:{uniforms:us([Ps.common,Ps.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Rs.linedashed_vert,fragmentShader:Rs.linedashed_frag},depth:{uniforms:us([Ps.common,Ps.displacementmap]),vertexShader:Rs.depth_vert,fragmentShader:Rs.depth_frag},normal:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,{opacity:{value:1}}]),vertexShader:Rs.meshnormal_vert,fragmentShader:Rs.meshnormal_frag},sprite:{uniforms:us([Ps.sprite,Ps.fog]),vertexShader:Rs.sprite_vert,fragmentShader:Rs.sprite_frag},background:{uniforms:{uvTransform:{value:new Rn},t2D:{value:null}},vertexShader:Rs.background_vert,fragmentShader:Rs.background_frag},cube:{uniforms:us([Ps.envmap,{opacity:{value:1}}]),vertexShader:Rs.cube_vert,fragmentShader:Rs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Rs.equirect_vert,fragmentShader:Rs.equirect_frag},distanceRGBA:{uniforms:us([Ps.common,Ps.displacementmap,{referencePosition:{value:new oi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Rs.distanceRGBA_vert,fragmentShader:Rs.distanceRGBA_frag},shadow:{uniforms:us([Ps.lights,Ps.fog,{color:{value:new jn(0)},opacity:{value:1}}]),vertexShader:Rs.shadow_vert,fragmentShader:Rs.shadow_frag}};function Is(e,t,n,i,r,s){const o=new jn(0);let a,l,c=!0===r?0:1,h=null,u=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,p(o,c)},render:function(n,r){let s=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const y=e.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(g=null),null===g?p(o,c):g&&g.isColor&&(p(g,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===ce)?(void 0===l&&(l=new as(new cs(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:hs(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,h===g&&u===g.version&&d===e.toneMapping||(l.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new as(new Ls(2,2),new ps({name:"BackgroundMaterial",uniforms:hs(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&u===g.version&&d===e.toneMapping||(a.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),a.layers.enableAll(),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Os(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},l=p(null);let c=l,h=!1;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){const t=[],n=[],i=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return c.attributesNum!==o||c.index!==i}(r,v,d,x),b&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const a=n.getAttributes();for(const t in a)if(a[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}c.attributes=r,c.attributesNum=o,c.index=i}(r,v,d,x)}else{const e=!0===l.wireframe;c.geometry===v.id&&c.program===d.id&&c.wireframe===e||(c.geometry=v.id,c.program=d.id,c.wireframe=e,b=!0)}null!==x&&n.update(x,34963),(b||h)&&(h=!1,function(r,s,o,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();const l=a.attributes,c=o.getAttributes(),h=s.defaultAttributeValues;for(const t in c){const i=c[t];if(i.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,o=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=s||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),y=e.getParameter(36349),_=u>0,v=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:_,floatFragmentTextures:v,floatVertexTextures:_&&v,maxSamples:s?e.getParameter(36183):0}}function Bs(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new Ms,a=new Rn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length0){const o=new vs(s.height/2);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Ds.physical={uniforms:us([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ln(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new jn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ln},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new jn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new jn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag};class Fs extends fs{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Fs.prototype.isOrthographicCamera=!0;const zs=[.125,.215,.35,.446,.526,.582],Hs=new Fs,Gs=new jn;let Vs=null;const Ws=(1+Math.sqrt(5))/2,js=1/Ws,qs=[new oi(1,1,1),new oi(-1,1,1),new oi(1,1,-1),new oi(-1,1,-1),new oi(0,Ws,js),new oi(0,Ws,-js),new oi(js,0,Ws),new oi(-js,0,Ws),new oi(Ws,js,0),new oi(-Ws,js,0)];class Xs{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Vs=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ks(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Zs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?a=zs[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,y=new Float32Array(f*p*d),_=new Float32Array(m*p*d),v=new Float32Array(g*p*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];y.set(i,f*p*e),_.set(u,m*p*e);const r=[e,e,e,e,e,e];v.set(r,g*p*e)}const x=new Vr;x.setAttribute("position",new Er(y,f)),x.setAttribute("uv",new Er(_,m)),x.setAttribute("faceIndex",new Er(v,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new oi(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new as(this._lodPlanes[0],e);this._renderer.compile(t,Hs)}_sceneToCubeUV(e,t,n,i){const r=new ms(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(Gs),a.toneMapping=Q,a.autoClear=!1;const h=new wr({name:"PMREM.Background",side:m,depthWrite:!1,depthTest:!1}),u=new as(new cs,h);let d=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(Gs),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ys(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(e,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===se||e.mapping===oe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ks()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Zs());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new as(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ys(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Hs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ey-4?i-y+4:0),4*(this._cubeSize-_),3*_,2*_),a.setRenderTarget(t),a.render(c,Hs)}}function Js(e,t,n){const i=new $n(e,t,n);return i.texture.mapping=ce,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ys(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Zs(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}function Ks(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\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",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:v,depthTest:!1,depthWrite:!1})}function Qs(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ae||s===le,a=s===se||s===oe;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new Xs(e)),i=o?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new Xs(e));const s=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $s(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function eo(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);const m=new Float32Array(p*f*4*r),g=new ei(m,p,f,r);g.type=Le,g.needsUpdate=!0;const y=4*d;for(let t=0;t0)return e;const r=t*n;let s=po[r];if(void 0===s&&(s=new Float32Array(r),po[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function vo(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function wa(e){return e.replace(ba,Ma)}function Ma(e,t){const n=Rs[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return wa(n)}const Sa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ea=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ta(e){return e.replace(Ea,Ca).replace(Sa,Aa)}function Aa(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ca(0,t,n,i)}function Ca(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(v+="\n"),x=[g,y].filter(_a).join("\n"),x.length>0&&(x+="\n")):(v=[La(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(_a).join("\n"),x=[g,La(n),"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Rs.tonemapping_pars_fragment:"",n.toneMapping!==Q?ya("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Rs.encodings_pars_fragment,ga("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_a).join("\n")),o=wa(o),o=va(o,n),o=xa(o,n),a=wa(a),a=va(a,n),a=xa(a,n),o=Ta(o),a=Ta(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+v,x=["#define varying in",n.glslVersion===fn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,M=pa(r,35633,b+v+o),S=pa(r,35632,w);if(r.attachShader(_,M),r.attachShader(_,S),void 0!==n.index0AttributeName?r.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(_).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(_,35714)){i=!1;const t=ma(r,M,"vertex"),n=ma(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:v},fragmentShader:{log:n,prefix:x}})}let E,T;return r.deleteShader(M),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new da(r,_)),E},this.getAttributes=function(){return void 0===T&&(T=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,k=s.clearcoat>0;return{isWebGL2:h,shaderID:E,shaderName:s.type,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:d,outputEncoding:null===I?e.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:Dt,map:!!s.map,matcap:!!s.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===Bt,tangentSpaceNormalMap:s.normalMapType===Nt,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===It,clearcoat:k,clearcoatMap:k&&!!s.clearcoatMap,clearcoatRoughnessMap:k&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:k&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===x,alphaMap:!!s.alphaMap,alphaTest:O,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:A,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===g,flipSided:s.side===m,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0),t.supportsVertexTextures&&a.enable(1),t.instancing&&a.enable(2),t.instancingColor&&a.enable(3),t.map&&a.enable(4),t.matcap&&a.enable(5),t.envMap&&a.enable(6),t.lightMap&&a.enable(7),t.aoMap&&a.enable(8),t.emissiveMap&&a.enable(9),t.bumpMap&&a.enable(10),t.normalMap&&a.enable(11),t.objectSpaceNormalMap&&a.enable(12),t.tangentSpaceNormalMap&&a.enable(13),t.clearcoat&&a.enable(14),t.clearcoatMap&&a.enable(15),t.clearcoatRoughnessMap&&a.enable(16),t.clearcoatNormalMap&&a.enable(17),t.displacementMap&&a.enable(18),t.specularMap&&a.enable(19),t.roughnessMap&&a.enable(20),t.metalnessMap&&a.enable(21),t.gradientMap&&a.enable(22),t.alphaMap&&a.enable(23),t.alphaTest&&a.enable(24),t.vertexColors&&a.enable(25),t.vertexAlphas&&a.enable(26),t.vertexUvs&&a.enable(27),t.vertexTangents&&a.enable(28),t.uvsVertexOnly&&a.enable(29),t.fog&&a.enable(30),e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0),t.flatShading&&a.enable(1),t.logarithmicDepthBuffer&&a.enable(2),t.skinning&&a.enable(3),t.morphTargets&&a.enable(4),t.morphNormals&&a.enable(5),t.morphColors&&a.enable(6),t.premultipliedAlpha&&a.enable(7),t.shadowMapEnabled&&a.enable(8),t.physicallyCorrectLights&&a.enable(9),t.doubleSided&&a.enable(10),t.flipSided&&a.enable(11),t.useDepthPacking&&a.enable(12),t.dithering&&a.enable(13),t.specularIntensityMap&&a.enable(14),t.specularColorMap&&a.enable(15),t.transmission&&a.enable(16),t.transmissionMap&&a.enable(17),t.thicknessMap&&a.enable(18),t.sheen&&a.enable(19),t.sheenColorMap&&a.enable(20),t.sheenRoughnessMap&&a.enable(21),t.decodeVideoTexture&&a.enable(22),t.opaque&&a.enable(23),e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Ds[t];n=ds.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Na),i.length>1&&i.sort(t||Ba),r.length>1&&r.sort(t||Ba)}}}function Fa(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Ua,e.set(t,[i])):n>=e.get(t).length?(i=new Ua,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function za(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new oi,color:new jn};break;case"SpotLight":n={position:new oi,direction:new oi,color:new jn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oi,color:new jn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oi,skyColor:new jn,groundColor:new jn};break;case"RectAreaLight":n={color:new jn,position:new oi,halfWidth:new oi,halfHeight:new oi}}return e[t.id]=n,n}}}let Ha=0;function Ga(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Va(e,t){const n=new za,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new oi);const s=new oi,o=new Bi,a=new Bi;return{setup:function(s,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,m=0,g=0,y=0;s.sort(Ga);const _=!0!==o?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ps.LTC_FLOAT_1,r.rectAreaLTC2=Ps.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ps.LTC_HALF_1,r.rectAreaLTC2=Ps.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=c;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===m&&v.numPointShadows===g&&v.numSpotShadows===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,v.directionalLength=h,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=m,v.numPointShadows=g,v.numSpotShadows=y,r.version=Ha++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(s=new Wa(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class qa extends br{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Ot,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}qa.prototype.isMeshDepthMaterial=!0;class Xa extends br{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new oi,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Ja(e,t,n){let i=new Ts;const r=new Ln,s=new Ln,o=new Qn,a=new qa({depthPacking:kt}),l=new Xa,c={},h=n.maxTextureSize,d={0:m,1:f,2:g},y=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ln},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 \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}"}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const x=new Vr;x.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new as(x,y),w=this;function M(n,i){const r=t.update(b);y.defines.VSM_SAMPLES!==n.blurSamples&&(y.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),y.uniforms.shadow_pass.value=n.map.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,y,b,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,b,null)}function S(t,n,i,r,s,o){let h=null;const u=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==u?u:!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const e=h.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=h.clone(),i[t]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=o===p?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=s),h}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===p)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let l=0,c=t.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null!==u.map||u.isPointLightShadow||this.type!==p||(u.map=new $n(r.x,r.y),u.map.texture.name=c.name+".shadowMap",u.mapPass=new $n(r.x,r.y),u.camera.updateProjectionMatrix()),null===u.map){const e={minFilter:pe,magFilter:pe,format:Ne};u.map=new $n(r.x,r.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==he.indexOf("OpenGL ES")&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),le=ce>=2);let ue=null,de={};const pe=e.getParameter(3088),fe=e.getParameter(2978),me=(new Qn).fromArray(pe),ge=(new Qn).fromArray(fe);function ye(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?An:Math.floor,s=i(r*e.width),o=i(r*e.height);void 0===m&&(m=_(s,o));const a=n?_(s,o):m;return a.width=s,a.height=o,a.getContext("2d").drawImage(e,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function x(e){return En(e.width)&&En(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==pe&&e.minFilter!==_e}function w(t){e.generateMipmap(t)}function M(n,i,r,s,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===It&&!1===o?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||t.get("EXT_color_buffer_float"),l}function S(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==pe&&e.minFilter!==_e?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function E(e){return e===pe||e===fe||e===ge?9728:9729}function T(e){const t=e.target;t.removeEventListener("dispose",T),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=g.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&C(e),0===Object.keys(r).length&&g.delete(n)}i.remove(e)}(t),t.isVideoTexture&&f.delete(t)}function A(t){const n=t.target;n.removeEventListener("dispose",A),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&r.__version!==e.version){const n=e.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void k(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}const P={[he]:10497,[ue]:33071,[de]:33648},D={[pe]:9728,[fe]:9984,[ge]:9986,[_e]:9729,[ve]:9985,[be]:9987};function I(n,s,o){if(o?(e.texParameteri(n,10242,P[s.wrapS]),e.texParameteri(n,10243,P[s.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[s.wrapR]),e.texParameteri(n,10240,D[s.magFilter]),e.texParameteri(n,10241,D[s.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),s.wrapS===ue&&s.wrapT===ue||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,E(s.magFilter)),e.texParameteri(n,10241,E(s.minFilter)),s.minFilter!==pe&&s.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const o=t.get("EXT_texture_filter_anisotropic");if(s.type===Le&&!1===t.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Re&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function O(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&C(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function k(t,i,r){let o=3553;i.isDataArrayTexture&&(o=35866),i.isData3DTexture&&(o=32879);const l=O(t,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),c.version!==c.__currentVersion||!0===l){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=function(e){return!a&&(e.wrapS!==ue||e.wrapT!==ue||e.minFilter!==pe&&e.minFilter!==_e)}(i)&&!1===x(i.image);let u=v(i.image,r,!1,h);u=H(i,u);const d=x(u)||a,p=s.convert(i.format,i.encoding);let f,m=s.convert(i.type),g=M(i.internalFormat,p,m,i.encoding,i.isVideoTexture);I(o,i,d);const y=i.mipmaps,_=a&&!0!==i.isVideoTexture,E=void 0===t.__version||!0===l,T=S(i,u,d);if(i.isDepthTexture)g=6402,a?g=i.type===Le?36012:i.type===Ce?33190:i.type===Ie?35056:33189:i.type===Le&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Fe&&6402===g&&i.type!==Te&&i.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Te,m=s.convert(i.type)),i.format===ze&&6402===g&&(g=34041,i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ie,m=s.convert(i.type))),E&&(_?n.texStorage2D(3553,1,g,u.width,u.height):n.texImage2D(3553,0,g,u.width,u.height,0,p,m,null));else if(i.isDataTexture)if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e>=1,t>>=1}}else if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,n){const i=e.encoding,r=e.format,s=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===mn||i!==Dt&&(i===It?!1===a?!0===t.has("EXT_sRGB")&&r===Ne?(e.format=mn,e.minFilter=_e,e.generateMipmaps=!1):n=Xn.sRGBToLinear(n):r===Ne&&s===Me||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const e=L;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(t,r){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;const o=O(t,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===o){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,o=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=r||o?o?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=H(i,h[e]);const u=h[0],d=x(u)||a,p=s.convert(i.format,i.encoding),f=s.convert(i.type),m=M(i.internalFormat,p,f,i.encoding),g=a&&!0!==i.isVideoTexture,y=void 0===t.__version;let _,E=S(i,u,d);if(I(34067,i,d),r){g&&y&&n.texStorage2D(34067,E,m,u.width,u.height);for(let e=0;e<6;e++){_=h[e].mipmaps;for(let t=0;t<_.length;t++){const r=_[t];i.format!==Ne?null!==p?g?n.compressedTexSubImage2D(34069+e,t,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+e,t,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+e,t,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+e,t,m,r.width,r.height,0,p,f,r.data)}}}else{_=i.mipmaps,g&&y&&(_.length>0&&E++,n.texStorage2D(34067,E,m,h[0].width,h[0].height));for(let e=0;e<6;e++)if(o){g?n.texSubImage2D(34069+e,0,0,0,h[e].width,h[e].height,p,f,h[e].data):n.texImage2D(34069+e,0,m,h[e].width,h[e].height,0,p,f,h[e].data);for(let t=0;t<_.length;t++){const i=_[t].image[e].image;g?n.texSubImage2D(34069+e,t+1,0,0,i.width,i.height,p,f,i.data):n.texImage2D(34069+e,t+1,m,i.width,i.height,0,p,f,i.data)}}else{g?n.texSubImage2D(34069+e,0,0,0,p,f,h[e]):n.texImage2D(34069+e,0,m,p,f,h[e]);for(let t=0;t<_.length;t++){const i=_[t];g?n.texSubImage2D(34069+e,t+1,0,0,p,f,i.image[e]):n.texImage2D(34069+e,t+1,m,p,f,i.image[e])}}}b(i,d)&&w(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){const r=i.get(e);void 0!==t&&N(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&U(e)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",A),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=x(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;t0&&!1===z(t)){c.__webglMultisampledFramebuffer=e.createFramebuffer(),c.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),o=M(l.internalFormat,i,r,l.encoding),a=F(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(c.__webglDepthRenderbuffer=e.createRenderbuffer(),B(c.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),I(34067,l,p);for(let e=0;e<6;e++)N(c.__webglFramebuffer[e],t,l,36064,34069+e);b(l,p)&&w(34067),n.unbindTexture()}else if(d){const e=t.texture;for(let r=0,s=e.length;r0&&!1===z(t)){const r=t.width,s=t.height;let o=16384;const a=[36064],l=t.stencilBuffer?33306:36096;t.depthBuffer&&a.push(l);const c=i.get(t),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(e.invalidateFramebuffer(36008,[l]),e.invalidateFramebuffer(36009,[l])),e.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),p&&e.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=N,this.useMultisampledRTT=z}function Ka(e,t,n){const i=n.isWebGL2;return{convert:function(n,r=null){let s;if(n===Me)return 5121;if(n===Pe)return 32819;if(n===De)return 32820;if(n===Se)return 5120;if(n===Ee)return 5122;if(n===Te)return 5123;if(n===Ae)return 5124;if(n===Ce)return 5125;if(n===Le)return 5126;if(n===Re)return i?5131:(s=t.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(n===Oe)return 6406;if(n===Ne)return 6408;if(n===Be)return 6409;if(n===Ue)return 6410;if(n===Fe)return 6402;if(n===ze)return 34041;if(n===He)return 6403;if(n===ke)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===mn)return s=t.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(n===Ge)return 36244;if(n===Ve)return 33319;if(n===We)return 33320;if(n===je)return 36249;if(n===qe||n===Xe||n===Je||n===Ye)if(r===It){if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(n===qe)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=t.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(n===qe)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ze||n===Ke||n===Qe||n===$e){if(s=t.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(n===Ze)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ke)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qe)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$e)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===et)return s=t.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===tt||n===nt){if(s=t.get("WEBGL_compressed_texture_etc"),null===s)return null;if(n===tt)return r===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===nt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(n===it||n===rt||n===st||n===ot||n===at||n===lt||n===ct||n===ht||n===ut||n===dt||n===pt||n===ft||n===mt||n===gt){if(s=t.get("WEBGL_compressed_texture_astc"),null===s)return null;if(n===it)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===st)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ot)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===at)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ct)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ht)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ut)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ft)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===yt){if(s=t.get("EXT_texture_compression_bptc"),null===s)return null;if(n===yt)return r===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Ie?i?34042:(s=t.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}Xa.prototype.isMeshDistanceMaterial=!0;class Qa extends ms{constructor(e=[]){super(),this.cameras=e}}Qa.prototype.isArrayCamera=!0;class $a extends lr{constructor(){super(),this.type="Group"}}$a.prototype.isGroup=!0;const el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $a,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $a,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new oi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new oi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $a,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new oi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new oi),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==o&&(i=t.getPose(e.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el))),l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const e=new $a;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}const r=l.joints[i.jointName];null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class nl extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){if((c=void 0!==c?c:Fe)!==Fe&&c!==ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Fe&&(n=Te),void 0===n&&c===ze&&(n=Ie),super(null,i,r,s,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==a?a:pe,this.flipY=!1,this.generateMipmaps=!1}}nl.prototype.isDepthTexture=!0;class il extends gn{constructor(e,t){super();const n=this;let i=null,r=1,s=null,o="local-floor",a=null,l=null,c=null,h=null,u=null,d=null;const p=t.getContextAttributes();let f=null,m=null;const g=[],y=new Map,_=new ms;_.layers.enable(1),_.viewport=new Qn;const v=new ms;v.layers.enable(2),v.viewport=new Qn;const x=[_,v],b=new Qa;b.layers.enable(1),b.layers.enable(2);let w=null,M=null;function S(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function E(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),w=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,m=null,P.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function T(e){const t=i.inputSources;for(let e=0;e0&&(n.alphaTest.value=i.alphaTest);const r=t.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const t=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*t}let s,o;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(e,i):i.isMeshToonMaterial?(n(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(n(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(n(e,i),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===m&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o)):i.isMeshMatcapMaterial?(n(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?n(e,i):i.isMeshDistanceMaterial?(n(e,i),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?n(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function sl(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=On("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let d=null,p=null;const y=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Dt,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1;const v=this;let x=!1,b=0,w=0,M=null,S=-1,E=null;const T=new Qn,A=new Qn;let C=null,L=t.width,R=t.height,P=1,D=null,I=null;const O=new Qn(0,0,L,R),k=new Qn(0,0,L,R);let N=!1;const B=new Ts;let U=!1,F=!1,z=null;const H=new Bi,G=new Ln,V=new oi,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===M?P:1}let q,X,J,Y,Z,K,$,ee,te,ne,ie,re,se,oe,ae,le,ce,he,ue,de,pe,fe,me,ge=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){const i=X.isWebGL2;null===z&&(z=new $n(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Re:Me,minFilter:be,samples:i&&!0===o?4:0})),v.getDrawingBufferSize(G),i?z.setSize(G.x,G.y):z.setSize(An(G.x),An(G.y));const r=v.getRenderTarget();v.setRenderTarget(z),v.clear();const s=v.toneMapping;v.toneMapping=Q,Ie(e,t,n),v.toneMapping=s,K.updateMultisampleRenderTarget(z),K.updateRenderTargetMipmap(z),v.setRenderTarget(r)}(r,t,n),i&&J.viewport(T.copy(i)),r.length>0&&Ie(r,t,n),s.length>0&&Ie(s,t,n),a.length>0&&Ie(a,t,n),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ie(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?_[_.length-1]:null,y.pop(),d=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(e,t,n){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=n;const i=Z.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=Z.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){M=e,b=t,w=n;let i=!0;if(e){const t=Z.get(e);void 0!==t.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?K.setupRenderTarget(e):t.__hasExternalTextures&&K.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(e){const n=e.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const i=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?Z.get(e).__webglMultisampledFramebuffer:i,T.copy(e.viewport),A.copy(e.scissor),C=e.scissorTest}else T.copy(O).multiplyScalar(P).floor(),A.copy(k).multiplyScalar(P).floor(),C=N;if(J.bindFramebuffer(36160,r)&&X.drawBuffers&&i&&J.drawBuffers(e,r),J.viewport(T),J.scissor(A),J.setScissorTest(C),s){const i=Z.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(o){const i=Z.get(e.texture),r=t||0;ge.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){J.bindFramebuffer(36160,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==Ne&&fe.convert(a)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Re&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(l===Me||fe.convert(l)===ge.getParameter(35738)||l===Le&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ge.readPixels(t,n,i,r,fe.convert(a),fe.convert(l),s)}finally{const e=null!==M?Z.get(M).__webglFramebuffer:null;J.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);K.setTexture2D(t,0),ge.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);K.setTexture2D(n,0),ge.pixelStorei(37440,n.flipY),ge.pixelStorei(37441,n.premultiplyAlpha),ge.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,i,e.x,e.y,r,s,o,a,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ge.texSubImage2D(3553,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ge.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isData3DTexture)K.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(i,0),h=35866}ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment);const u=ge.getParameter(3314),d=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),m=ge.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ge.pixelStorei(3314,g.width),ge.pixelStorei(32878,g.height),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ge.compressedTexSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,g.data)):ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g),ge.pixelStorei(3314,u),ge.pixelStorei(32878,d),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,m),0===r&&i.generateMipmaps&&ge.generateMipmap(h),J.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),J.unbindTexture()},this.resetState=function(){b=0,w=0,M=null,J.reset(),me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sl.prototype.isWebGLRenderer=!0;class ol extends sl{}ol.prototype.isWebGL1Renderer=!0;class al{constructor(e,t=25e-5){this.name="",this.color=new jn(e),this.density=t}clone(){return new al(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}al.prototype.isFogExp2=!0;class ll{constructor(e,t=1,n=1e3){this.name="",this.color=new jn(e),this.near=t,this.far=n}clone(){return new ll(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ll.prototype.isFog=!0;class cl extends lr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}cl.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:a,point:ml.clone(),uv:vr.getUV(ml,bl,wl,Ml,Sl,El,Tl,new Ln),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Cl(e,t,n,i,r,s){_l.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(vl.x=s*_l.x-r*_l.y,vl.y=r*_l.x+s*_l.y):vl.copy(_l),e.copy(t),e.x+=vl.x,e.y+=vl.y,e.applyMatrix4(xl)}Al.prototype.isSprite=!0;const Ll=new oi,Rl=new oi;class Pl extends lr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){Ll.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);const n=Ll.distanceTo(Rl)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;ia)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}tc.prototype.isLine=!0;const nc=new oi,ic=new oi;class rc extends tc{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dc(e,t,n,i,r,s,o){const a=lc.distanceSqToPoint(e);if(ar.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}uc.prototype.isPoints=!0;class pc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.minFilter=void 0!==s?s:_e,this.magFilter=void 0!==r?r:_e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}pc.prototype.isVideoTexture=!0;class fc extends Kn{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=pe,this.minFilter=pe,this.generateMipmaps=!1,this.needsUpdate=!0}}fc.prototype.isFramebufferTexture=!0;class mc extends Kn{constructor(e,t,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}mc.prototype.isCompressedTexture=!0;class gc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.needsUpdate=!0}}gc.prototype.isCanvasTexture=!0;class yc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new Ln:new oi);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oi,i=[],r=[],s=[],o=new oi,a=new Bi;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new oi)}r[0]=new oi,s[0]=new oi;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(wn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(wn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _c extends yc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new Ln,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(bc.subVectors(i[0],i[1]).add(i[0]),o=bc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Tc(o,a.x,l.x,c.x,h.x),Tc(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Fc extends Vr{constructor(e=[new Ln(0,.5),new Ln(.5,0),new Ln(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=wn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new oi,u=new Ln,d=new oi,p=new oi,f=new oi;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),a.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){const d=n+r*c*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*f,s.push(h.x,h.y,h.z),u.x=r/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*f;l.push(i,c,d)}}for(let n=0;n0&&y(!0),t>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(d,2))}static fromJSON(e){return new Gc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vc extends Gc{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Vc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wc extends Vr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Wc(e.vertices,e.indices,e.radius,e.details)}}class jc extends Wc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new jc(e.radius,e.detail)}}const qc=new oi,Xc=new oi,Jc=new oi,Yc=new vr;class Zc extends Vr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(vn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e0)for(s=t;s=t;s-=i)o=vh(s,e[s],e[s+1],o);return o&&ph(o,o.next)&&(xh(o),o=o.next),o}function $c(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!ph(i,i.next)&&0!==dh(i.prev,i,i.next))i=i.next;else{if(xh(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function eh(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=lh(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?nh(e,i,r,s):th(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),xh(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?eh(e=ih($c(e),t,n),t,n,i,r,s,2):2===o&&rh(e,t,n,i,r,s):eh($c(e),t,n,i,r,s,1);break}}function th(e){const t=e.prev,n=e,i=e.next;if(dh(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(hh(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&dh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function nh(e,t,n,i){const r=e.prev,s=e,o=e.next;if(dh(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=lh(a,l,t,n,i),d=lh(c,h,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ih(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!ph(r,s)&&fh(r,i,i.next,s)&&yh(r,s)&&yh(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),xh(i),xh(i.next),i=e=s),i=i.next}while(i!==e);return $c(i)}function rh(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&uh(o,e)){let a=_h(o,e);return o=$c(o,o.next),a=$c(a,a.next),eh(o,t,n,i,r,s),void eh(a,t,n,i,r,s)}e=e.next}o=o.next}while(o!==e)}function sh(e,t){return e.x-t.x}function oh(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&hh(rs.x||n.x===s.x&&ah(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}(e,t)){const n=_h(t,e);$c(t,t.next),$c(n,n.next)}}function ah(e,t){return dh(e.prev,e,t.prev)<0&&dh(t.next,e,e.next)<0}function lh(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ch(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function uh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&fh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(yh(e,t)&&yh(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(dh(e.prev,e,t.prev)||dh(e,t.prev,t))||ph(e,t)&&dh(e.prev,e,e.next)>0&&dh(t.prev,t,t.next)>0)}function dh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ph(e,t){return e.x===t.x&&e.y===t.y}function fh(e,t,n,i){const r=gh(dh(e,t,n)),s=gh(dh(e,t,i)),o=gh(dh(n,i,e)),a=gh(dh(n,i,t));return r!==s&&o!==a||!(0!==r||!mh(e,n,t))||!(0!==s||!mh(e,i,t))||!(0!==o||!mh(n,e,i))||!(0!==a||!mh(n,t,i))}function mh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function gh(e){return e>0?1:e<0?-1:0}function yh(e,t){return dh(e.prev,e,e.next)<0?dh(e,t,e.next)>=0&&dh(e,e.prev,t)>=0:dh(e,t,e.prev)<0||dh(e,e.next,t)<0}function _h(e,t){const n=new bh(e.i,e.x,e.y),i=new bh(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function vh(e,t,n,i){const r=new bh(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function xh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class wh{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return eh(s,o,n,a,l,p),o}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function Sh(e,t){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=t.x-a/u,f=t.y+o/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-a*l);i=p+o*m-e.x,r=f+a*m-e.y;const g=i*i+r*r;if(g<=2)return new Ln(i,r);s=Math.sqrt(g/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Ln(i/s,r/s)}const P=[];for(let e=0,t=T.length,n=t-1,i=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,t=T.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e0)&&d.push(t,r,l),(e!==n-1||a0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Gh.prototype.isMeshPhysicalMaterial=!0;class Vh extends br{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new jn(16777215),this.specular=new jn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}Vh.prototype.isMeshPhongMaterial=!0;class Wh extends br{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new jn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}Wh.prototype.isMeshToonMaterial=!0;class jh extends br{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}jh.prototype.isMeshNormalMaterial=!0;class qh extends br{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}qh.prototype.isMeshLambertMaterial=!0;class Xh extends br{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new jn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}Xh.prototype.isMeshMatcapMaterial=!0;class Jh extends Yl{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Jh.prototype.isLineDashedMaterial=!0;const Yh={ShadowMaterial:Fh,SpriteMaterial:pl,RawShaderMaterial:zh,ShaderMaterial:ps,PointsMaterial:oc,MeshPhysicalMaterial:Gh,MeshStandardMaterial:Hh,MeshPhongMaterial:Vh,MeshToonMaterial:Wh,MeshNormalMaterial:jh,MeshLambertMaterial:qh,MeshDepthMaterial:qa,MeshDistanceMaterial:Xa,MeshBasicMaterial:wr,MeshMatcapMaterial:Xh,LineDashedMaterial:Jh,LineBasicMaterial:Yl,Material:br};br.fromType=function(e){return new Yh[e]};const Zh={arraySlice:function(e,t,n){return Zh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Zh.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),d=Zh.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new si).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let e=0;e=r)break e;{const o=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=Zh.arraySlice(n,r,s),this.values=Zh.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&Zh.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Zh.arraySlice(this.times),t=Zh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Mt,r=e.length-1;let s=1;for(let o=1;o0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=Zh.arraySlice(e,0,s),this.values=Zh.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=Zh.arraySlice(this.times,0),t=Zh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tu.prototype.TimeBufferType=Float32Array,tu.prototype.ValueBufferType=Float32Array,tu.prototype.DefaultInterpolation=wt;class nu extends tu{}nu.prototype.ValueTypeName="bool",nu.prototype.ValueBufferType=Array,nu.prototype.DefaultInterpolation=bt,nu.prototype.InterpolantFactoryMethodLinear=void 0,nu.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends tu{}iu.prototype.ValueTypeName="color";class ru extends tu{}ru.prototype.ValueTypeName="number";class su extends Kh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)si.slerpFlat(r,0,s,l-o,s,l,a);return r}}class ou extends tu{InterpolantFactoryMethodLinear(e){return new su(this.times,this.values,this.getValueSize(),e)}}ou.prototype.ValueTypeName="quaternion",ou.prototype.DefaultInterpolation=wt,ou.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends tu{}au.prototype.ValueTypeName="string",au.prototype.ValueBufferType=Array,au.prototype.DefaultInterpolation=bt,au.prototype.InterpolantFactoryMethodLinear=void 0,au.prototype.InterpolantFactoryMethodSmooth=void 0;class lu extends tu{}lu.prototype.ValueTypeName="vector";class cu{constructor(e,t=-1,n,i=At){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hu(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tu.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Zh.flattenJSON(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==mu[e])return void mu[e].push({onLoad:t,onProgress:n,onError:i});mu[e]=[],mu[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=mu[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{uu.add(e,t);const n=mu[e];delete mu[e];for(let e=0,i=n.length;e{const n=mu[e];if(void 0===n)throw this.manager.itemError(e),t;delete mu[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class yu extends fu{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new gu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new jn).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Ln).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new oi).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new Qn).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Rn).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Bi).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Ln).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ln).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Vu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){const n=new du(t);r=new vu(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new vu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){si.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;si.multiplyQuaternionsFlat(e,s,e,t,e,n),si.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const bd=new RegExp("[\\[\\]\\.:\\/]","g"),wd="[^\\[\\]\\.:\\/]",Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sd=/((?:WC+[\/:])*)/.source.replace("WC",wd),Ed=/(WCOD+)?/.source.replace("WCOD",Md),Td=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",wd),Ad=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",wd),Cd=new RegExp("^"+Sd+Ed+Td+Ad+"$"),Ld=["material","materials","bones"];class Rd{constructor(e,t,n){this.path=t,this.parsedPath=n||Rd.parseTrackName(t),this.node=Rd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rd.Composite(e,t,n):new Rd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(bd,"")}static parseTrackName(e){const t=Cd.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Ld.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Rd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Pd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:St,endingEnd:St};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case Ct:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);break;case At:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===xt;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(n===_t){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Et,i.endingEnd=Et):(i.endingStart=e?this.zeroSlopeAtStart?Et:St:Tt,i.endingEnd=t?this.zeroSlopeAtEnd?Et:St:Tt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}class Id extends gn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new xd(Rd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Gd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Vd.prototype.isBox2=!0;const Wd=new oi,jd=new oi;class qd{constructor(e=new oi,t=new oi){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Wd.subVectors(e,this.start),jd.subVectors(this.end,this.start);const n=jd.dot(jd);let i=jd.dot(Wd)/n;return t&&(i=wn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Xd=new oi;class Jd extends lr{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new Vr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{vp.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(vp,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Mp extends rc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Vr;n.setAttribute("position",new Or(t,3)),n.setAttribute("color",new Or([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Yl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new jn,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Sp{constructor(){this.type="ShapePath",this.color=new jn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(e){const t=[];for(let n=0,i=e.length;nNumber.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const r=wh.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],l=new Kc,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1,t=0;for(let e=0,t=d.length;e0&&!1===e&&(m=u)}for(let e=0,t=d.length;e65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=wn(e,-65504,65504),Ap[0]=e;const t=Cp[0],n=t>>23&511;return Lp[n]+((8388607&t)>>Rp[n])}static fromHalfFloat(e){const t=e>>10;return Cp[0]=Pp[Ip[t]+(1023&e)]+Dp[t],Ap[0]}}const Tp=new ArrayBuffer(4),Ap=new Float32Array(Tp),Cp=new Uint32Array(Tp),Lp=new Uint32Array(512),Rp=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Lp[e]=0,Lp[256|e]=32768,Rp[e]=24,Rp[256|e]=24):t<-14?(Lp[e]=1024>>-t-14,Lp[256|e]=1024>>-t-14|32768,Rp[e]=-t-1,Rp[256|e]=-t-1):t<=15?(Lp[e]=t+15<<10,Lp[256|e]=t+15<<10|32768,Rp[e]=13,Rp[256|e]=13):t<128?(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=24,Rp[256|e]=24):(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=13,Rp[256|e]=13)}const Pp=new Uint32Array(2048),Dp=new Uint32Array(64),Ip=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;0==(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,Pp[e]=t|n}for(let e=1024;e<2048;++e)Pp[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Dp[e]=e<<23;Dp[31]=1199570944,Dp[32]=2147483648;for(let e=33;e<63;++e)Dp[e]=2147483648+(e-32<<23);Dp[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(Ip[e]=1024);const Op=0,kp=1,Np=0,Bp=1,Up=2;function Fp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function zp(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}class Hp extends uc{constructor(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(e,t)}}class Gp extends Al{constructor(e){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(e)}}class Vp extends uc{constructor(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(e,t)}}class Wp extends oc{constructor(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class jp extends oc{constructor(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class qp extends oc{constructor(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class Xp extends oi{constructor(e,t,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(e,t,n)}}class Jp extends Er{constructor(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(e,t),this.setUsage(sn)}}class Yp extends Tr{constructor(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(e,t)}}class Zp extends Ar{constructor(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(e,t)}}class Kp extends Cr{constructor(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(e,t)}}class Qp extends Lr{constructor(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(e,t)}}class $p extends Rr{constructor(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(e,t)}}class ef extends Pr{constructor(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(e,t)}}class tf extends Dr{constructor(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(e,t)}}class nf extends Or{constructor(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(e,t)}}class rf extends kr{constructor(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(e,t)}}yc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(yc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Uc.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)};class sf extends Mp{constructor(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(e)}}class of extends gp{constructor(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(e,t)}}class af extends rc{constructor(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new Zc(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}sp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Qd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};class lf extends rc{constructor(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new Nh(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}fu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Vu.extractUrlBase(e)},fu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};class cf extends gu{constructor(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(e)}}class hf extends bu{constructor(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(e)}}Vd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Vd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Vd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Vd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},ci.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ci.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ci.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ci.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ci.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Xi.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Ci.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ts.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},qd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Rn.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Rn.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Rn.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Rn.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Bi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Bi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Bi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new oi).setFromMatrixColumn(this,3)},Bi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Bi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Bi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Bi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Bi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Bi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Bi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Bi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Bi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Bi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Bi.prototype.makeFrustum=function(e,t,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,s)},Bi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ms.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},si.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},si.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Ni.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Ni.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Ni.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},vr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},vr.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},vr.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},vr.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},vr.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},vr.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),vr.getBarycoord(e,t,n,i,r)},vr.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),vr.getNormal(e,t,n,i)},Kc.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Kc.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Eh(this,e)},Kc.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rh(this,e)},Ln.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ln.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Ln.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},oi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},oi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},oi.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},oi.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},oi.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},oi.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},oi.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},oi.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},oi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Qn.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Qn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},lr.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},lr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},lr.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},lr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},lr.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(lr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),as.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(as.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Lt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},ms.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Mu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Er.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===sn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(sn)}}}),Er.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},Er.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Er.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vr.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},Vr.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Er(arguments[1],arguments[2])))},Vr.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},Vr.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Vr.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Vr.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},Vr.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Vr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Eh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Eh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Eh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},cl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Od.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(br.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new jn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(ps.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),sl.prototype.clearTarget=function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},sl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},sl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},sl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},sl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},sl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},sl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},sl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},sl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},sl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},sl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},sl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},sl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},sl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},sl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},sl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},sl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},sl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},sl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},sl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},sl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},sl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},sl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},sl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},sl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(sl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?It:Dt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ja.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});class uf extends vs{constructor(e,t,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(e,n)}}function df(){console.error("THREE.CanvasRenderer has been removed")}function pf(){console.error("THREE.JSONLoader has been removed.")}Object.defineProperties($n.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),pd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new $u).load(e,(function(e){t.setBuffer(e)})),this},vd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ys.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ys.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},Xn.crossOrigin=void 0,Xn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new wu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new xu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Xn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const ff={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function mf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}class gf extends Vr{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}}class yf extends Vr{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}}function _f(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function vf(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function xf(){console.error("THREE.ImmediateRenderObject has been removed.")}class bf extends $n{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class wf extends ei{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class Mf extends ni{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i)},365:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(477);const r={type:"change"},s={type:"start"},o={type:"end"};class a extends i.EventDispatcher{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new i.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",X),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),l=a.NONE},this.update=function(){const t=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),o=s.clone().invert(),m=new i.Vector3,g=new i.Quaternion,y=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(s),h.setFromVector3(t),n.autoRotate&&l===a.NONE&&A(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(h.theta+=u.theta*n.dampingFactor,h.phi+=u.phi*n.dampingFactor):(h.theta+=u.theta,h.phi+=u.phi);let i=n.minAzimuthAngle,_=n.maxAzimuthAngle;return isFinite(i)&&isFinite(_)&&(i<-Math.PI?i+=y:i>Math.PI&&(i-=y),_<-Math.PI?_+=y:_>Math.PI&&(_-=y),h.theta=i<=_?Math.max(i,Math.min(_,h.theta)):h.theta>(i+_)/2?Math.max(i,h.theta):Math.min(_,h.theta)),h.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=d,h.radius=Math.max(n.minDistance,Math.min(n.maxDistance,h.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(h),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),p.set(0,0,0)),d=1,!!(f||m.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c)&&(n.dispatchEvent(r),m.copy(n.object.position),g.copy(n.object.quaternion),f=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",q),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",X)};const n=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,h=new i.Spherical,u=new i.Spherical;let d=1;const p=new i.Vector3;let f=!1;const m=new i.Vector2,g=new i.Vector2,y=new i.Vector2,_=new i.Vector2,v=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,S=[],E={};function T(){return Math.pow(.95,n.zoomSpeed)}function A(e){u.theta-=e}function C(e){u.phi-=e}const L=function(){const e=new i.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),R=function(){const e=new i.Vector3;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),P=function(){const e=new i.Vector3;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;e.copy(s).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*t*o/r.clientHeight,n.object.matrix),R(2*i*o/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function D(e){n.object.isPerspectiveCamera?d/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){n.object.isPerspectiveCamera?d*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function k(e){_.set(e.clientX,e.clientY)}function N(){if(1===S.length)m.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);m.set(e,t)}}function B(){if(1===S.length)_.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);_.set(e,t)}}function U(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function F(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g)}function z(e){if(1===S.length)v.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v)}function H(e){const t=K(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);w.set(0,s),M.set(0,Math.pow(w.y/b.y,n.zoomSpeed)),D(M.y),b.copy(w)}function G(e){!1!==n.enabled&&(0===S.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",W)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(Z(e),S.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;N(),l=a.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;B(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(),n.enablePan&&B(),l=a.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(),n.enableRotate&&N(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),l=a.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;k(e),l=a.PAN}else{if(!1===n.enableRotate)return;O(e),l=a.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),l=a.ROTATE}else{if(!1===n.enablePan)return;k(e),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e))}function V(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),l){case a.TOUCH_ROTATE:if(!1===n.enableRotate)return;F(e),n.update();break;case a.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case a.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&H(e),n.enablePan&&z(e)}(e),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&H(e),n.enableRotate&&F(e)}(e),n.update();break;default:l=a.NONE}}(e):function(e){if(!1!==n.enabled)switch(l){case a.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g),n.update()}(e);break;case a.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,b),M.y>0?D(T()):M.y<0&&I(T()),b.copy(w),n.update()}(e);break;case a.PAN:if(!1===n.enablePan)return;!function(e){v.set(e.clientX,e.clientY),x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v),n.update()}(e)}}(e))}function W(e){Y(e),0===S.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W)),n.dispatchEvent(o),l=a.NONE}function j(e){Y(e)}function q(e){!1!==n.enabled&&!1!==n.enableZoom&&l===a.NONE&&(e.preventDefault(),n.dispatchEvent(s),function(e){e.deltaY<0?I(T()):e.deltaY>0&&D(T()),n.update()}(e),n.dispatchEvent(o))}function X(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:P(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:P(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:P(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:P(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function Y(e){delete E[e.pointerId];for(let t=0;t{"use strict";n.d(t,{G:()=>s});var i=n(477);class r extends i.DataTextureLoader{constructor(e){super(e)}parse(e){e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let t=0;const n=new Uint8Array(e),r={id_length:n[t++],colormap_type:n[t++],image_type:n[t++],colormap_index:n[t++]|n[t++]<<8,colormap_length:n[t++]|n[t++]<<8,colormap_size:n[t++],origin:[n[t++]|n[t++]<<8,n[t++]|n[t++]<<8],width:n[t++]|n[t++]<<8,height:n[t++]|n[t++]<<8,pixel_size:n[t++],flags:n[t++]};!function(e){switch(e.image_type){case 1:case 9:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let s=!1,o=!1,a=!1;switch(r.image_type){case 9:s=!0,o=!0;break;case 1:o=!0;break;case 10:s=!0;break;case 2:break;case 11:s=!0,a=!0;break;case 3:a=!0}const l=new Uint8Array(r.width*r.height*4),c=function(e,t,n,i,r){let s,o;const a=n.pixel_size>>3,l=n.width*n.height*a;if(t&&(o=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;s=new Uint8Array(l);let o=0;const c=new Uint8Array(a);for(;o>4){default:case 2:o=0,c=1,u=t,l=0,h=1,d=n;break;case 0:o=0,c=1,u=t,l=n-1,h=-1,d=-1;break;case 3:o=t-1,c=-1,u=-1,l=0,h=1,d=n;break;case 1:o=t-1,c=-1,u=-1,l=n-1,h=-1,d=-1}if(a)switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d++)c=l[d],e[4*(h+p*u)+0]=c,e[4*(h+p*u)+1]=c,e[4*(h+p*u)+2]=c,e[4*(h+p*u)+3]=255}(e,l,h,d,o,c,u,i);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=2)e[4*(c+d*h)+0]=l[u+0],e[4*(c+d*h)+1]=l[u+0],e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+3]=l[u+1]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l,c){const h=c;let u,d,p,f=0;const m=r.width;for(p=t;p!==i;p+=n)for(d=s;d!==a;d+=o,f++)u=l[f],e[4*(d+m*p)+3]=255,e[4*(d+m*p)+2]=h[3*u+0],e[4*(d+m*p)+1]=h[3*u+1],e[4*(d+m*p)+0]=h[3*u+2]}(e,l,h,d,o,c,u,i,s);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d+=2)c=l[d+0]+(l[d+1]<<8),e[4*(h+p*u)+0]=(31744&c)>>7,e[4*(h+p*u)+1]=(992&c)>>2,e[4*(h+p*u)+2]=(31&c)<<3,e[4*(h+p*u)+3]=32768&c?0:255}(e,l,h,d,o,c,u,i);break;case 24:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=3)e[4*(c+d*h)+3]=255,e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2]}(e,l,h,d,o,c,u,i);break;case 32:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=4)e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2],e[4*(c+d*h)+3]=l[u+3]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(l,r.width,r.height,c.pixel_data,c.palettes),{data:l,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:i.LinearMipmapLinearFilter}}}class s extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===s.path?i.LoaderUtils.extractUrlBase(e):s.path,a=new i.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e,t){function n(e,t){const n=[],i=e.childNodes;for(let e=0,r=i.length;e0&&t.push(new i.VectorKeyframeTrack(r+".position",s,o)),a.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",s,a)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",s,l)),t}function S(e,t,n){let i,r,s,o=!0;for(r=0,s=e.length;r=0;){const i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t>>0));switch(n=n.toLowerCase(),n){case"tga":t=Xe;break;default:t=qe}return t}(s);if(void 0!==t){const r=t.load(s),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===c(o.technique)){const e=o.technique;r.wrapS=e.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,r.wrapT=e.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping;return null!==n&&(r.encoding=n),r}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",s),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}s.name=e.name||"";const a=r.parameters;for(const e in a){const t=a[e];switch(e){case"diffuse":t.color&&s.color.fromArray(t.color),t.texture&&(s.map=o(t.texture,i.sRGBEncoding));break;case"specular":t.color&&s.specular&&s.specular.fromArray(t.color),t.texture&&(s.specularMap=o(t.texture));break;case"bump":t.texture&&(s.normalMap=o(t.texture));break;case"ambient":t.texture&&(s.lightMap=o(t.texture,i.sRGBEncoding));break;case"shininess":t.float&&s.shininess&&(s.shininess=t.float);break;case"emission":t.color&&s.emissive&&s.emissive.fromArray(t.color),t.texture&&(s.emissiveMap=o(t.texture,i.sRGBEncoding))}}s.color.convertSRGBToLinear(),s.specular&&s.specular.convertSRGBToLinear(),s.emissive&&s.emissive.convertSRGBToLinear();let l=a.transparent,h=a.transparency;if(void 0===h&&l&&(h={float:1}),void 0===l&&h&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&h)if(l.data.texture)s.transparent=!0;else{const e=l.data.color;switch(l.opaque){case"A_ONE":s.opacity=e[3]*h.float;break;case"RGB_ZERO":s.opacity=1-e[0]*h.float;break;case"A_ZERO":s.opacity=1-e[3]*h.float;break;case"RGB_ONE":s.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}s.opacity<1&&(s.transparent=!0)}if(void 0!==r.extra&&void 0!==r.extra.technique){const e=r.extra.technique;for(const t in e){const n=e[t];switch(t){case"double_sided":s.side=1===n?i.DoubleSide:i.FrontSide;break;case"bump":s.normalMap=o(n.texture),s.normalScale=new i.Vector2(1,1)}}}return s}function K(e){return f(Qe.materials[e],Z)}function Q(e){for(let t=0;t0?n+s:n;t.inputs[o]={id:e,offset:r},t.stride=Math.max(t.stride,r+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=a(i.textContent);break;case"p":t.p=a(i.textContent)}}return t}function he(e){let t=0;for(let n=0,i=e.length;n0&&t0&&d.setAttribute("position",new i.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),a.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),h.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(h,4)),u.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(u,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function pe(e,t,n,i,r=!1){const s=e.p,o=e.stride,a=e.vcount;function l(e){let t=s[e+n]*h;const o=t+h;for(;t4)for(let t=1,i=n-2;t<=i;t++){const n=e+o*t,i=e+o*(t+1);l(e+0*o),l(n),l(i)}e+=o*n}}else for(let e=0,t=s.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;nr.limits.max||t{"use strict";n.d(t,{v:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===this.path?i.LoaderUtils.extractUrlBase(e):this.path,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,o={};for(let e=0;e=0?t.substring(0,s):t;a=a.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},o[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const a=new s(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class s{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:i.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:i.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const i=e[n],r={};t[n]=r;for(const e in i){let t=!0,n=i[e];const s=e.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(r[s]=n)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(e,n){if(r[e])return;const s=t.getTextureParams(n,r),o=t.loadTexture((a=t.baseUrl,"string"!=typeof(l=s.url)||""===l?"":/^https?:\/\//i.test(l)?l:a+l));var a,l;o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(o.encoding=i.sRGBEncoding),r[e]=o}for(const e in n){const t=n[e];let o;if(""!==t)switch(e.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ks":r.specular=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ke":r.emissive=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"map_kd":s("map",t);break;case"map_ks":s("specularMap",t);break;case"map_ke":s("emissiveMap",t);break;case"norm":s("normalMap",t);break;case"map_bump":case"bump":s("bumpMap",t);break;case"map_d":s("alphaMap",t),r.transparent=!0;break;case"ns":r.shininess=parseFloat(t);break;case"d":o=parseFloat(t),o<1&&(r.opacity=o,r.transparent=!0);break;case"tr":o=parseFloat(t),this.options&&this.options.invertTrProperty&&(o=1-o),o>0&&(r.opacity=1-o,r.transparent=!0)}}return this.materials[e]=new i.MeshPhongMaterial(r),this.materials[e]}getTextureParams(e,t){const n={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const o=void 0!==this.manager?this.manager:i.DefaultLoadingManager;let a=o.getHandler(e);null===a&&(a=new i.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(e,n,r,s);return void 0!==t&&(l.mapping=t),l}}},476:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new i.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(s.parse(n))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e){function t(e,t,n){for(let i=0,r=e.length;i>5&31)/31,o=(e>>10&31)/31):(r=l,s=c,o=h)}for(let l=1;l<=3;l++){const c=n+12*l,h=3*e*3+3*(l-1);f[h]=t.getFloat32(c,!0),f[h+1]=t.getFloat32(c+4,!0),f[h+2]=t.getFloat32(c+8,!0),m[h]=i,m[h+1]=u,m[h+2]=p,d&&(a[h]=r,a[h+1]=s,a[h+2]=o)}}return p.setAttribute("position",new i.BufferAttribute(f,3)),p.setAttribute("normal",new i.BufferAttribute(m,3)),d&&(p.setAttribute("color",new i.BufferAttribute(a,3)),p.hasColors=!0,p.alpha=u),p}(n):function(e){const t=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g;let s=0;const o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),l=new RegExp("normal"+o+o+o,"g"),c=[],h=[],u=new i.Vector3;let d,p=0,f=0,m=0;for(;null!==(d=n.exec(e));){f=m;const e=d[0];for(;null!==(d=r.exec(e));){let e=0,t=0;const n=d[0];for(;null!==(d=l.exec(n));)u.x=parseFloat(d[1]),u.y=parseFloat(d[2]),u.z=parseFloat(d[3]),t++;for(;null!==(d=a.exec(n));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),h.push(u.x,u.y,u.z),e++,m++;1!==t&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==e&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}const n=f,i=m-f;t.addGroup(n,i,p),p++}return t.setAttribute("position",new i.Float32BufferAttribute(c,3)),t.setAttribute("normal",new i.Float32BufferAttribute(h,3)),t}("string"!=typeof(r=e)?i.LoaderUtils.decodeText(new Uint8Array(r)):r);var r}}},140:(e,t,n)=>{"use strict";n.d(t,{qf:()=>r});var i=n(477);function r(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),o=new Set(Object.keys(e[0].morphAttributes)),a={},l={},c=e[0].morphTargetsRelative,h=new i.BufferGeometry;let u=0;for(let i=0;i{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Viewer:()=>Viewer,THREE:()=>three__WEBPACK_IMPORTED_MODULE_3__,msgpack:()=>msgpack});var three__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(140),wwobjloader2__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(973),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(976),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(23),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(476),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(365),msgpack=__webpack_require__(676),dat=__webpack_require__(376).ZP;__webpack_require__(583);const extensionCodec=new msgpack.ExtensionCodec;function merge_geometries(e,t=!1){let n=[],i=[],r=e.matrix.clone();!function e(t,r){let s=r.clone().multiply(t.matrix);"Mesh"===t.type&&(t.geometry.applyMatrix4(s),i.push(t.geometry),n.push(t.material));for(let n of t.children)e(n,s)}(e,r);let s=null;return 1==i.length?(s=i[0],t&&(s.material=n[0])):i.length>1?(s=(0,three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__.qf)(i,!0),t&&(s.material=n)):s=new three__WEBPACK_IMPORTED_MODULE_3__.BufferGeometry,s}function handle_special_texture(e){if("_text"==e.type){let t=document.createElement("canvas");t.width=256,t.height=256;let n=t.getContext("2d");n.textAlign="center";let i=e.font_size;for(n.font=i+"px "+e.font_face;n.measureText(e.text).width>t.width;)i--,n.font=i+"px "+e.font_face;n.fillText(e.text,t.width/2,t.height/2);let r=new three__WEBPACK_IMPORTED_MODULE_3__.CanvasTexture(t);return r.uuid=e.uuid,r}return null}function handle_special_geometry(e){if("_meshfile"==e.type&&(console.warn("_meshfile is deprecated. Please use _meshfile_geometry for geometries and _meshfile_object for objects with geometry and material"),e.type="_meshfile_geometry"),"_meshfile_geometry"==e.type){if("obj"==e.format){let t=merge_geometries((new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe).parse(e.data+"\n"));return t.uuid=e.uuid,t}if("dae"==e.format){let t=merge_geometries((new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G).parse(e.data).scene);return t.uuid=e.uuid,t}if("stl"==e.format){let t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer);return t.uuid=e.uuid,t}return console.error("Unsupported mesh type:",e),null}return null}extensionCodec.register({type:22,encode:e=>(console.error("Uint32Array encode not implemented"),null),decode:e=>{const t=new Uint32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Float32Array encode not implemented"),null),decode:e=>{const t=new Float32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;evoid 0!==e.resources[t]?e.resources[t]:t)),"obj"==e.format){let s=new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe(i);if(e.mtl_library){let t=new three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__.v(i).parse(e.mtl_library+"\n",""),n=wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.eW.addMaterialsFromMtlLoader(t);s.setMaterials(n),this.onTextureLoad()}t=merge_geometries(s.parse(e.data+"\n",r),!0),t.uuid=e.uuid,n=t.material}else if("dae"==e.format){let s=new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G(i);s.onTextureLoad=this.onTextureLoad,t=merge_geometries(s.parse(e.data,r).scene,!0),t.uuid=e.uuid,n=t.material}else{if("stl"!=e.format)return console.error("Unsupported mesh type:",e),null;t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer,r),t.uuid=e.uuid,n=t.material}let s=new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(t,n);return s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userjson&&(s.userjson=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),s}return super.parseObject(e,t,n)}}class SceneNode{constructor(e,t,n){this.object=e,this.folder=t,this.children={},this.controllers=[],this.on_update=n,this.create_controls();for(let e of this.object.children)this.add_child(e)}add_child(e){let t=this.folder.addFolder(e.name),n=new SceneNode(e,t,this.on_update);return this.children[e.name]=n,n}create_child(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Group;return t.name=e,this.object.add(t),this.add_child(t)}find(e){if(0==e.length)return this;{let t=e[0],n=this.children[t];return void 0===n&&(n=this.create_child(t)),n.find(e.slice(1))}}create_controls(){for(let e of this.controllers)this.folder.remove(e);if(this.controllers=[],void 0!==this.vis_controller&&this.folder.domElement.removeChild(this.vis_controller.domElement),this.vis_controller=new dat.controllers.BooleanController(this.object,"visible"),this.vis_controller.onChange((()=>this.on_update())),this.folder.domElement.prepend(this.vis_controller.domElement),this.vis_controller.domElement.style.height="0",this.vis_controller.domElement.style.float="right",this.vis_controller.domElement.classList.add("meshcat-visibility-checkbox"),this.vis_controller.domElement.children[0].addEventListener("change",(e=>{e.target.checked?this.folder.domElement.classList.remove("meshcat-hidden-scene-element"):this.folder.domElement.classList.add("meshcat-hidden-scene-element")})),this.object.isLight){let e=this.folder.add(this.object,"intensity").min(0).step(.01);if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.castShadow){let e=this.folder.add(this.object,"castShadow");if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.shadow){let e=this.folder.add(this.object.shadow,"radius").min(0).step(.05).max(3);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(void 0!==this.object.distance){let e=this.folder.add(this.object,"distance").min(0).step(.1).max(100);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(this.object.isCamera){let e=this.folder.add(this.object,"zoom").min(0).step(.1);e.onChange((()=>{this.on_update()})),this.controllers.push(e)}}set_property(e,t){if("position"===e)this.object.position.set(t[0],t[1],t[2]);else if("quaternion"===e)this.object.quaternion.set(t[0],t[1],t[2],t[3]);else if("scale"===e)this.object.scale.set(t[0],t[1],t[2]);else if("color"===e){function e(t,n){if(t.material){t.material.color.setRGB(n[0],n[1],n[2]);let e=n[3];t.material.opacity=e,t.material.transparent=1!=e}for(let i of t.children)e(i,n)}e(this.object,t)}else this.object[e]="top_color"==e||"bottom_color"==e?t.map((e=>255*e)):t;this.vis_controller.updateDisplay(),this.controllers.forEach((e=>e.updateDisplay()))}set_transform(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;t.fromArray(e),t.decompose(this.object.position,this.object.quaternion,this.object.scale)}set_object(e){let t=this.object.parent;this.dispose_recursive(),this.object.parent.remove(this.object),this.object=e,t.add(e),this.create_controls()}dispose_recursive(){for(let e of Object.keys(this.children))this.children[e].dispose_recursive();dispose(this.object)}delete(e){if(0==e.length)console.error("Can't delete an empty path");else{let t=this.find(e.slice(0,e.length-1)),n=e[e.length-1],i=t.children[n];void 0!==i&&(i.dispose_recursive(),t.object.remove(i.object),remove_folders(i.folder),t.folder.removeFolder(i.folder),delete t.children[n])}}}function remove_folders(e){for(let t of Object.keys(e.__folders)){let n=e.__folders[t];remove_folders(n),dat.dom.dom.unbind(window,"resize",n.__resizeHandler),e.removeFolder(n)}}function dispose(e){if(e&&(e.geometry&&e.geometry.dispose(),e.material))if(Array.isArray(e.material))for(let t of e.material)t.map&&t.map.dispose(),t.dispose();else e.material.map&&e.material.map.dispose(),e.material.dispose()}function create_default_scene(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.Scene;return e.name="Scene",e.rotateX(-Math.PI/2),e}function download_data_uri(e,t){let n=document.createElement("a");n.download=e,n.href=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function download_file(e,t,n){n=n||"text/plain";let i=new Blob([t],{type:n}),r=document.createElement("a");document.body.appendChild(r),r.download=e,r.href=window.URL.createObjectURL(i),r.onclick=function(e){let t=this;setTimeout((function(){window.URL.revokeObjectURL(t.href)}),1500)},r.click(),r.remove()}class Animator{constructor(e){this.viewer=e,this.folder=this.viewer.gui.addFolder("Animations"),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer,this.loader=new three__WEBPACK_IMPORTED_MODULE_3__.ObjectLoader,this.clock=new three__WEBPACK_IMPORTED_MODULE_3__.Clock,this.actions=[],this.playing=!1,this.time=0,this.time_scrubber=null,this.setup_capturer("png"),this.duration=0}setup_capturer(e){this.capturer=new window.CCapture({format:e,name:"meshcat_"+String(Date.now())}),this.capturer.format=e}play(){this.clock.start();for(let e of this.actions)e.play();this.playing=!0}record(){this.reset(),this.play(),this.recording=!0,this.capturer.start()}pause(){this.clock.stop(),this.playing=!1,this.recording&&(this.stop_capture(),this.save_capture())}stop_capture(){this.recording=!1,this.capturer.stop(),this.viewer.animate()}save_capture(){this.capturer.save(),"png"===this.capturer.format?alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.png \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4"):"jpg"===this.capturer.format&&alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.jpg \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4")}display_progress(e){this.time=e,null!==this.time_scrubber&&this.time_scrubber.updateDisplay()}seek(e){this.actions.forEach((t=>{t.time=Math.max(0,Math.min(t._clip.duration,e))})),this.mixer.update(0),this.viewer.set_dirty()}reset(){for(let e of this.actions)e.reset();this.display_progress(0),this.mixer.update(0),this.setup_capturer(this.capturer.format),this.viewer.set_dirty()}clear(){remove_folders(this.folder),this.mixer.stopAllAction(),this.actions=[],this.duration=0,this.display_progress(0),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer}load(e,t){this.clear(),this.folder.open();let n=this.folder.addFolder("default");n.open(),n.add(this,"play"),n.add(this,"pause"),n.add(this,"reset"),this.time_scrubber=n.add(this,"time",0,1e9,.001),this.time_scrubber.onChange((e=>this.seek(e))),n.add(this.mixer,"timeScale").step(.01).min(0);let i=n.addFolder("Recording");i.add(this,"record"),i.add({format:"png"},"format",["png","jpg"]).onChange((e=>{this.setup_capturer(e)})),void 0===t.play&&(t.play=!0),void 0===t.loopMode&&(t.loopMode=three__WEBPACK_IMPORTED_MODULE_3__.LoopRepeat),void 0===t.repetitions&&(t.repetitions=1),void 0===t.clampWhenFinished&&(t.clampWhenFinished=!0),this.duration=0,this.progress=0;for(let n of e){let e=this.viewer.scene_tree.find(n.path).object,i=three__WEBPACK_IMPORTED_MODULE_3__.AnimationClip.parse(n.clip);i.uuid=three__WEBPACK_IMPORTED_MODULE_3__.MathUtils.generateUUID();let r=this.mixer.clipAction(i,e);r.clampWhenFinished=t.clampWhenFinished,r.setLoop(t.loopMode,t.repetitions),this.actions.push(r),this.duration=Math.max(this.duration,i.duration)}this.time_scrubber.min(0),this.time_scrubber.max(this.duration),this.reset(),t.play&&this.play()}update(){if(this.playing){if(this.mixer.update(this.clock.getDelta()),this.viewer.set_dirty(),0!=this.duration){let e=this.actions.reduce(((e,t)=>Math.max(e,t.time)),0);this.display_progress(e)}else this.display_progress(0);if(this.actions.every((e=>e.paused))){this.pause();for(let e of this.actions)e.reset()}}}after_render(){this.recording&&this.capturer.capture(this.viewer.renderer.domElement)}}function gradient_texture(e,t){var n=new Uint8Array(8);for(let i=0;i<3;++i)n[i]=t[i],n[4+i]=e[i];n[3]=n[7]=255;var i=new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(n,1,2,three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);return i.magFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,i.encoding=three__WEBPACK_IMPORTED_MODULE_3__.LinearEncoding,i.matrixAutoUpdate=!1,i.matrix.set(.5,0,.25,0,.5,.25,0,0,1),i.needsUpdate=!0,i}class Viewer{constructor(e,t,n){this.dom_element=e,void 0===n?(this.renderer=new three__WEBPACK_IMPORTED_MODULE_3__.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=three__WEBPACK_IMPORTED_MODULE_3__.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.renderer.setPixelRatio(window.devicePixelRatio),this.scene=create_default_scene(),this.gui_controllers={},this.keydown_callbacks={},this.create_scene_tree(),this.add_default_scene_elements(),this.set_dirty(),this.create_camera(),this.num_messages_received=0,window.onload=e=>this.set_3d_pane_size(),window.addEventListener("resize",(e=>this.set_3d_pane_size()),!1),window.addEventListener("keydown",(e=>{this.on_keydown(e)})),requestAnimationFrame((()=>this.set_3d_pane_size())),(t||void 0===t)&&this.animate()}on_keydown(e){if(e.code in this.keydown_callbacks)for(const t of this.keydown_callbacks[e.code])t.callback(e)}hide_background(){this.scene.background=null,this.set_dirty()}show_background(){var e=this.scene_tree.find(["Background"]).object.top_color,t=this.scene_tree.find(["Background"]).object.bottom_color;this.scene.background=gradient_texture(e,t),this.set_dirty()}set_dirty(){this.needs_render=!0}create_camera(){let e=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;e.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],e.toArray());let t=new three__WEBPACK_IMPORTED_MODULE_3__.PerspectiveCamera(75,1,.01,100);this.set_camera(t),this.set_object(["Cameras","default","rotated"],t),t.position.set(3,1,0)}create_default_spot_light(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.SpotLight(16777215,.8);return e.position.set(1.5,1.5,2),e.castShadow=!1,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024,e.shadow.camera.near=.5,e.shadow.camera.far=50,e.shadow.bias=-.001,e}add_default_scene_elements(){var e=this.create_default_spot_light();this.set_object(["Lights","SpotLight"],e),this.set_property(["Lights","SpotLight"],"visible",!1);var t=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);t.position.set(1.5,1.5,2),t.castShadow=!1,t.distance=10,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,t.shadow.camera.near=.5,t.shadow.camera.far=10,t.shadow.bias=-.001,this.set_object(["Lights","PointLightNegativeX"],t);var n=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);n.position.set(-1.5,-1.5,2),n.castShadow=!1,n.distance=10,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,n.shadow.camera.near=.5,n.shadow.camera.far=10,n.shadow.bias=-.001,this.set_object(["Lights","PointLightPositiveX"],n);var i=new three__WEBPACK_IMPORTED_MODULE_3__.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new three__WEBPACK_IMPORTED_MODULE_3__.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var s=new three__WEBPACK_IMPORTED_MODULE_3__.GridHelper(20,40);s.rotateX(Math.PI/2),this.set_object(["Grid"],s);var o=new three__WEBPACK_IMPORTED_MODULE_3__.AxesHelper(.5);this.set_object(["Axes"],o)}create_scene_tree(){this.gui&&this.gui.destroy(),this.gui=new dat.GUI({autoPlace:!1}),this.dom_element.parentElement.appendChild(this.gui.domElement),this.gui.domElement.style.position="absolute",this.gui.domElement.style.right=0,this.gui.domElement.style.top=0;let e=this.gui.addFolder("Scene");e.open(),this.scene_tree=new SceneNode(this.scene,e,(()=>this.set_dirty()));let t=this.gui.addFolder("Save / Load / Capture");t.add(this,"save_scene"),t.add(this,"load_scene"),t.add(this,"save_image"),this.animator=new Animator(this),this.gui.close(),this.set_property(["Background"],"top_color",[135/255,206/255,250/255]),this.set_property(["Background"],"bottom_color",[25/255,25/255,112/255]),this.scene_tree.find(["Background"]).on_update=()=>{this.scene_tree.find(["Background"]).object.visible?this.show_background():this.hide_background()},this.show_background()}set_3d_pane_size(e,t){void 0===e&&(e=this.dom_element.offsetWidth),void 0===t&&(t=this.dom_element.offsetHeight),"OrthographicCamera"==this.camera.type?this.camera.right=this.camera.left+e*(this.camera.top-this.camera.bottom)/t:this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.set_dirty()}render(){this.controls.update(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.animator.after_render(),this.needs_render=!1}animate(){requestAnimationFrame((()=>this.animate())),this.animator.update(),this.needs_render&&this.render()}capture_image(e,t){let n=this.dom_element.offsetWidth,i=this.dom_element.offsetHeight;this.set_3d_pane_size(e,t),this.render();let r=this.renderer.domElement.toDataURL();return this.set_3d_pane_size(n,i),r}save_image(){download_data_uri("meshcat.png",this.capture_image())}set_camera(e){this.camera=e,this.controls=new three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__.z(e,this.dom_element),this.controls.enableKeys=!1,this.controls.screenSpacePanning=!0,this.controls.addEventListener("start",(()=>{this.set_dirty()})),this.controls.addEventListener("change",(()=>{this.set_dirty()}))}set_camera_target(e){this.controls.target.set(e[0],e[1],e[2])}set_camera_from_json(e){(new ExtensibleObjectLoader).parse(e,(e=>{this.set_camera(e)}))}set_transform(e,t){this.scene_tree.find(e).set_transform(t)}set_object(e,t){this.scene_tree.find(e.concat([""])).set_object(t)}set_object_from_json(e,t){let n=new ExtensibleObjectLoader;n.onTextureLoad=()=>{this.set_dirty()},n.parse(t,(t=>{void 0!==t.geometry&&"BufferGeometry"==t.geometry.type?void 0!==t.geometry.attributes.normal&&0!==t.geometry.attributes.normal.count||t.geometry.computeVertexNormals():t.type.includes("Camera")&&(this.set_camera(t),this.set_3d_pane_size()),t.castShadow=!0,t.receiveShadow=!0,this.set_object(e,t),this.set_dirty()}))}delete_path(e){0==e.length?console.error("Deleting the entire scene is not implemented"):this.scene_tree.delete(e)}set_property(e,t,n){this.scene_tree.find(e).set_property(t,n),"Background"===e[0]&&this.scene_tree.find(e).on_update()}set_animation(e,t){t=t||{},this.animator.load(e,t)}set_control(name,callback,value,min,max,step,keycode1,keycode2){let my_callback=eval(callback),handler={};if(name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value){function e(e,t,n){if(null!=t){let i={name,callback:()=>{value=e.gui_controllers[name].getValue();let t=Math.min(Math.max(value+n,min),max);e.gui_controllers[name].setValue(t)}};t in e.keydown_callbacks?e.keydown_callbacks[t].push(i):e.keydown_callbacks[t]=[i]}}handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(my_callback),e(this,keycode1,-step),e(this,keycode2,+step)}else if(handler[name]=my_callback,this.gui_controllers[name]=this.gui.add(handler,name),this.gui_controllers[name].domElement.parentElement.querySelector(".property-name").style.width="100%",null!=keycode1){let e={name,callback:my_callback};keycode1 in this.keydown_callbacks?this.keydown_callbacks[keycode1].push(e):this.keydown_callbacks[keycode1]=[e]}}set_control_value(e,t,n=!0){e in this.gui_controllers&&this.gui_controllers[e]instanceof dat.controllers.NumberController&&(n?this.gui_controllers[e].setValue(t):(this.gui_controllers[e].object[e]=t,this.gui_controllers[e].updateDisplay()))}delete_control(e){e in this.gui_controllers&&(this.gui.remove(this.gui_controllers[e]),delete this.gui_controllers[e]);for(let t in this.keydown_callbacks){let n=this.keydown_callbacks[t].length;for(;n--;)this.keydown_callbacks[t][n].name==e&&this.keydown_callbacks[t].splice(n,1)}}handle_command(e){if("set_transform"==e.type){let t=split_path(e.path);this.set_transform(t,e.matrix)}else if("delete"==e.type){let t=split_path(e.path);this.delete_path(t)}else if("set_object"==e.type){let t=split_path(e.path);this.set_object_from_json(t,e.object)}else if("set_property"==e.type){let t=split_path(e.path);this.set_property(t,e.property,e.value)}else if("set_animation"==e.type)e.animations.forEach((e=>{e.path=split_path(e.path)})),this.set_animation(e.animations,e.options);else if("set_target"==e.type)this.set_camera_target(e.value);else if("set_control"==e.type)this.set_control(e.name,e.callback,e.value,e.min,e.max,e.step,e.keycode1,e.keycode2);else if("set_control_value"==e.type)this.set_control_value(e.name,e.value,e.invoke_callback);else if("delete_control"==e.type)this.delete_control(e.name);else if("capture_image"==e.type){let t=e.xres||1920,n=e.yres||1080;t/=this.renderer.getPixelRatio(),n/=this.renderer.getPixelRatio();let i=this.capture_image(t,n);this.connection.send(JSON.stringify({type:"img",data:i}))}else"save_image"==e.type&&this.save_image();this.set_dirty()}decode(e){return msgpack.decode(new Uint8Array(e.data),{extensionCodec})}handle_command_bytearray(e){let t=msgpack.decode(e,{extensionCodec});this.handle_command(t)}handle_command_message(e){this.num_messages_received++;let t=this.decode(e);this.handle_command(t)}connect(e){void 0===e&&(e=`ws://${location.host}`),"https:"==location.protocol&&(e=e.replace("ws:","wss:")),this.connection=new WebSocket(e),this.connection.binaryType="arraybuffer",this.connection.onmessage=e=>this.handle_command_message(e),this.connection.onclose=function(e){console.log("onclose:",e)}}save_scene(){download_file("scene.json",JSON.stringify(this.scene.toJSON()))}load_scene_from_json(e){let t=new ExtensibleObjectLoader;t.onTextureLoad=()=>{this.set_dirty()},this.scene_tree.dispose_recursive(),this.scene=t.parse(e),this.show_background(),this.create_scene_tree();let n=this.scene_tree.find(["Cameras","default","rotated",""]);n.object.isCamera?this.set_camera(n.object):this.create_camera()}handle_load_file(e){let t=e.files[0];if(!t)return;let n=new FileReader,i=this;n.onload=function(e){let t=this.result,n=JSON.parse(t);i.load_scene_from_json(n)},n.readAsText(t)}load_scene(){let e=document.createElement("input");e.type="file",document.body.appendChild(e);let t=this;e.addEventListener("change",(function(){console.log(this,t),t.handle_load_file(this)}),!1),e.click(),e.remove()}}function split_path(e){return e.split("/").filter((e=>e.length>0))}let style=document.createElement("style");style.appendChild(document.createTextNode("")),document.head.appendChild(style),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input {\n float: right;\n }"),style.sheet.insertRule("\n .meshcat-hidden-scene-element li .meshcat-visibility-checkbox {\n opacity: 0.25;\n pointer-events: none;\n }"),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input[type=checkbox] {\n height: 16px;\n width: 16px;\n display:inline-block;\n padding: 0 0 0 0px;\n }")})(),__webpack_exports__})()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MeshCat=t():e.MeshCat=t()}(self,(function(){return(()=>{var __webpack_modules__={583:(e,t,n)=>{var i;e=n.nmd(e),function(){if(void 0!==e.exports)var r=n(617),s=n(549),o=n(468);var a={function:!0,object:!0};function l(e){return e&&e.Object===Object?e:null}parseFloat,parseInt;var c=a[typeof t]&&t&&!t.nodeType?t:void 0,h=a.object&&e&&!e.nodeType?e:void 0,u=(h&&h.exports,l(c&&h&&"object"==typeof n.g&&n.g)),d=l(a[typeof self]&&self),p=l(a[typeof window]&&window),f=l(a[typeof this]&&this);function m(e){return String("0000000"+e).slice(-7)}u||p!==(f&&f.window)&&p||d||f||Function("return this")(),"gc"in window||(window.gc=function(){}),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),r=i.length,s=new Uint8Array(r),o=0;o=c.frameLimit||c.timeLimit&&e>=c.timeLimit)&&(H(),W());var t=new Date(null);t.setSeconds(e),c.motionBlurFrames>2?_.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+t.toISOString().substr(11,8):_.textContent="CCapture "+c.format+" | "+d+" frames | "+t.toISOString().substr(11,8)}(),j("Frame: "+d+" "+p);for(var s=0;s=h[s].triggerTime&&(G(h[s].callback),h.splice(s,1));for(s=0;s=u[s].triggerTime&&(G(u[s].callback),u[s].triggerTime+=u[s].time);f.forEach((function(e){G(e,n-g)})),f=[]}function W(e){e||(e=function(e){return s(e,l.filename+l.extension,l.mimeType),!1}),l.save(e)}function j(e){t&&console.log(e)}return{start:function(){!function(){function e(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),z.push(this)),this._hookedTime+c.startTime}j("Capturer start"),i=window.Date.now(),n=i+c.startTime,o=window.performance.now(),r=o+c.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(e,t){var i={callback:e,time:t,triggerTime:n+t};return h.push(i),j("Timeout set to "+i.time),i},window.clearTimeout=function(e){for(var t=0;t2?(function(e){A.width===e.width&&A.height===e.height||(A.width=e.width,A.height=e.height,E=new Uint16Array(A.height*A.width*4),C.fillStyle="#0",C.fillRect(0,0,A.width,A.height))}(e),function(e){C.drawImage(e,0,0),T=C.getImageData(0,0,A.width,A.height);for(var t=0;t=.5*c.motionBlurFrames?function(){for(var e=T.data,t=0;t0&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(e){this.filename=this.baseFilename+"-part-"+m(this.part),s(e,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+m(this.part),this.step()}.bind(this)):this.step()},b.prototype.save=function(e){this.videoWriter.complete().then(e)},b.prototype.dispose=function(e){this.frames=[]},w.prototype=Object.create(y.prototype),w.prototype.start=function(){this.encoder.start(this.settings)},w.prototype.add=function(e){this.encoder.add(e)},w.prototype.save=function(e){this.callback=e,this.encoder.end()},w.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},M.prototype=Object.create(y.prototype),M.prototype.add=function(e){this.stream||(this.stream=e.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(e){this.chunks.push(e.data)}.bind(this)),this.step()},M.prototype.save=function(e){this.mediaRecorder.onstop=function(t){var n=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],e(n)}.bind(this),this.mediaRecorder.stop()},S.prototype=Object.create(y.prototype),S.prototype.add=function(e){this.sizeSet||(this.encoder.setOption("width",e.width),this.encoder.setOption("height",e.height),this.sizeSet=!0),this.canvas.width=e.width,this.canvas.height=e.height,this.ctx.drawImage(e,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},S.prototype.save=function(e){this.callback=e,this.encoder.render()},(p||d||{}).CCapture=E,void 0===(i=function(){return E}.call(t,n,t,e))||(e.exports=i)}()},549:e=>{void 0!==e.exports&&(e.exports=function(e,t,n){var i,r,s,o=window,a="application/octet-stream",l=n||a,c=e,h=document,u=h.createElement("a"),d=function(e){return String(e)},p=o.Blob||o.MozBlob||o.WebKitBlob||d,f=o.MSBlobBuilder||o.WebKitBlobBuilder||o.BlobBuilder,m=t||"download";if("true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(e){for(var t=e.split(/[:;,]/),n=t[1],i=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=i.length,s=0,o=new Uint8Array(r);s{e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=void 0,o=0;o0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,o,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){var i=e("./TypedNeuQuant.js"),r=e("./LZWEncoder.js");function s(){this.page=-1,this.pages=[],this.newPage()}s.pageSize=4096,s.charMap={};for(var o=0;o<256;o++)s.charMap[o]=String.fromCharCode(o);function a(e,t){this.width=~~e,this.height=~~t,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new s}s.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(s.pageSize),this.cursor=0},s.prototype.getData=function(){for(var e="",t=0;t=s.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=e},s.prototype.writeUTFBytes=function(e){for(var t=e.length,n=0;n=0&&(this.dispose=e)},a.prototype.setRepeat=function(e){this.repeat=e},a.prototype.setTransparent=function(e){this.transparent=e},a.prototype.addFrame=function(e){this.image=e,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},a.prototype.finish=function(){this.out.writeByte(59)},a.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},a.prototype.setDither=function(e){!0===e&&(e="FloydSteinberg"),this.dither=e},a.prototype.setGlobalPalette=function(e){this.globalPalette=e},a.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},a.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},a.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new i(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},a.prototype.indexPixels=function(e){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var n=0,i=0;i=0&&b+h=0&&w+c>16,(65280&e)>>8,255&e,t)},a.prototype.findClosestRGB=function(e,t,n,i){if(null===this.colorTab)return-1;if(this.neuQuant&&!i)return this.neuQuant.lookupRGB(e,t,n);for(var r=0,s=16777216,o=this.colorTab.length,a=0,l=0;a=0&&(t=7&this.dispose),t<<=2,this.out.writeByte(0|t|e),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},a.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},a.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},a.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},a.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},a.prototype.writePixels=function(){new r(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},a.prototype.stream=function(){return this.out},t.exports=a},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(e,t,n){var i=5003,r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var o,a,l,c,h,u,d=Math.max(2,s),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,y=0,_=!1;function v(e,t){p[a++]=e,a>=254&&w(t)}function x(e){b(i),y=h+2,_=!0,E(h,e)}function b(e){for(var t=0;t0&&(e.writeByte(a),e.writeBytes(p,0,a),a=0)}function M(e){return(1<0?o|=e<=8;)v(255&o,t),o>>=8,g-=8;if((y>l||_)&&(_?(l=M(n_bits=c),_=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),e==u){for(;g>0;)v(255&o,t),o>>=8,g-=8;w(t)}}this.encode=function(n){n.writeByte(d),remaining=e*t,curPixel=0,function(e,t){var n,r,s,o,d,p;for(c=e,_=!1,n_bits=c,l=M(n_bits),u=1+(h=1<=0){d=5003-s,0===s&&(d=1);do{if((s-=d)<0&&(s+=5003),f[s]===n){o=m[s];continue e}}while(f[s]>=0)}E(o,t),o=r,y<4096?(m[s]=y++,f[s]=n):x(t)}else o=m[s];E(o,t),E(u,t)}(d+1,n),n.writeByte(0)}}},{}],4:[function(e,t,n){var i=256,r=1024,s=1<<18;t.exports=function(e,t){var n,o,a,l,c;function h(e,t,i,s,o){n[t][0]-=e*(n[t][0]-i)/r,n[t][1]-=e*(n[t][1]-s)/r,n[t][2]-=e*(n[t][2]-o)/r}function u(e,t,r,o,a){for(var l,h,u=Math.abs(t-e),d=Math.min(t+e,i),p=t+1,f=t-1,m=1;pu;)h=c[m++],pu&&((l=n[f--])[0]-=h*(l[0]-r)/s,l[1]-=h*(l[1]-o)/s,l[2]-=h*(l[2]-a)/s)}function d(e,t,r){var s,o,c,h,u,d=~(1<<31),p=d,f=-1,m=f;for(s=0;s>12))>10,l[s]-=u,a[s]+=u<<10;return l[f]+=64,a[f]-=65536,m}this.buildColormap=function(){(function(){var e,t;for(n=[],o=new Int32Array(256),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),e=0;e>6;for(v<=1&&(v=0),n=0;n=p&&(x-=p),0===g&&(g=1),++n%g==0)for(y-=y/f,(v=(_-=_/30)>>6)<=1&&(v=0),l=0;l>=4,n[e][1]>>=4,n[e][2]>>=4,n[e][3]=e}(),function(){var e,t,r,s,a,l,c=0,h=0;for(e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)o[t]=255}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)u=c?u=i:(u++,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)=0&&((l=t-(a=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)t;0<=t?++e:--e)n.push(null);return n}.call(this),t=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(e=0,n=t;0<=n?en;0<=n?++e:--e)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},i.prototype.abort=function(){for(var e;null!=(e=this.activeWorkers.shift());)this.log("killing active worker"),e.terminate();return this.running=!1,this.emit("abort")},i.prototype.spawnWorkers=function(){var e,t,n,i;return e=Math.min(this.options.workers,this.frames.length),function(){n=[];for(var i=t=this.freeWorkers.length;t<=e?ie;t<=e?i++:i--)n.push(i);return n}.apply(this).forEach((i=this,function(e){var t;return i.log("spawning worker "+e),(t=new Worker(i.options.workerScript)).onmessage=function(e){return i.activeWorkers.splice(i.activeWorkers.indexOf(t),1),i.freeWorkers.push(t),i.frameFinished(e.data)},i.freeWorkers.push(t)})),e},i.prototype.frameFinished=function(e){var t,n;if(this.log("frame "+e.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[e.index]=e,!0===this.options.globalPalette&&(this.options.globalPalette=e.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(t=1,n=this.freeWorkers.length;1<=n?tn;1<=n?++t:--t)this.renderNextFrame();return o.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m;for(a=0,r=0,l=(p=this.imageParts).length;r=this.frames.length))return e=this.frames[this.nextFrame++],n=this.freeWorkers.shift(),t=this.getTask(e),this.log("starting frame "+(t.index+1)+" of "+this.frames.length),this.activeWorkers.push(n),n.postMessage(t)},i.prototype.getContextData=function(e){return e.getImageData(0,0,this.options.width,this.options.height).data},i.prototype.getImageData=function(e){var t;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(t=this._canvas.getContext("2d")).setFill=this.options.background,t.fillRect(0,0,this.options.width,this.options.height),t.drawImage(e,0,0),this.getContextData(t)},i.prototype.getTask=function(e){var t,n;if(n={index:t=this.frames.indexOf(e),last:t===this.frames.length-1,delay:e.delay,dispose:e.dispose,transparent:e.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===r.name},null!=e.data)n.data=e.data;else if(null!=e.context)n.data=this.getContextData(e.context);else{if(null==e.image)throw new Error("Invalid frame");n.data=this.getImageData(e.image)}return n},i.prototype.log=function(){var e;if(e=1<=arguments.length?a.call(arguments,0):[],this.options.debug)return console.log.apply(console,e)},i}(i)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(e,t,n){var i,r;i=e("./GIFEncoder.js"),r=function(e){var t,n,r,s;return t=new i(e.width,e.height),0===e.index?t.writeHeader():t.firstFrame=!1,t.setTransparent(e.transparent),t.setDispose(e.dispose),t.setRepeat(e.repeat),t.setDelay(e.delay),t.setQuality(e.quality),t.setDither(e.dither),t.setGlobalPalette(e.globalPalette),t.addFrame(e.data),e.last&&t.finish(),!0===e.globalPalette&&(e.globalPalette=t.getGlobalPalette()),r=t.stream(),e.data=r.pages,e.cursor=r.cursor,e.pageSize=r.constructor.pageSize,e.canTransfer?(s=function(){var t,i,r,s;for(s=[],t=0,i=(r=e.data).length;t{!function(){"use strict";var e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];function t(e){var t,n=new Uint8Array(e);for(t=0;t>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];switch(a.length%4){case 1:a+="=";break;case 2:a+="=="}return a}}(),function(){"use strict";var e,t=window.utils;e=[{field:"fileName",length:100},{field:"fileMode",length:8},{field:"uid",length:8},{field:"gid",length:8},{field:"fileSize",length:12},{field:"mtime",length:12},{field:"checksum",length:8},{field:"type",length:1},{field:"linkName",length:100},{field:"ustar",length:8},{field:"owner",length:32},{field:"group",length:32},{field:"majorNumber",length:8},{field:"minorNumber",length:8},{field:"filenamePrefix",length:155},{field:"padding",length:12}],window.header={},window.header.structure=e,window.header.format=function(n,i){var r=t.clean(512),s=0;return e.forEach((function(e){var t,i,o=n[e.field]||"";for(t=0,i=o.length;ti&&(t.push({blocks:r,length:n}),r=[],n=0),r.push(e),n+=e.headerLength+e.inputLength})),t.push({blocks:r,length:n}),t.forEach((function(t){var n=new Uint8Array(t.length),i=0;t.blocks.forEach((function(e){n.set(e.header,i),i+=e.headerLength,n.set(e.input,i),i+=e.inputLength})),e.push(n)})),e.push(new Uint8Array(1024)),new Blob(e,{type:"octet/stream"})},s.prototype.clear=function(){this.written=0,this.out=i.clean(t)},void 0!==e.exports?e.exports=s:window.Tar=s}()},376:(e,t,n)=>{"use strict";function i(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),s=Math.round(e.b),o=e.a,a=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+s+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+s+","+o+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+s+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+s+","+o+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+",a:"+o+"}":"unknown format"}n.d(t,{ZP:()=>he});var r=Array.prototype.forEach,s=Array.prototype.slice,o={BREAK:{},extend:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=s.call(arguments);return function(){for(var t=s.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(r&&e.forEach&&e.forEach===r)e.forEach(t,n);else if(e.length===e.length+0){var i,s=void 0;for(s=0,i=e.length;s1?o.toArray(arguments):arguments[0];return o.each(a,(function(t){if(t.litmus(e))return o.each(t.conversions,(function(t,n){if(l=t.read(e),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=t,o.BREAK})),o.BREAK})),c},u=void 0,d={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),s=n*(1-t),o=n*(1-r*t),a=n*(1-(1-r)*t),l=[[n,a,s],[o,n,s],[s,n,a],[s,o,n],[a,s,n],[n,s,o]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),s=r-i,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=e===r?(t-n)/s:t===r?2+(n-e)/s:4+(e-t)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(u=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var P=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=i||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,o.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=R(r.__impliedStep),r}return y(t,e),m(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=R(e),this}}]),t}(w),D=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function h(){T.unbind(window,"mousemove",c),T.unbind(window,"mouseup",h),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"change",(function(){var e=parseFloat(s.__input.value);o.isNaN(e)||s.setValue(e)})),T.bind(r.__input,"blur",(function(){l()})),T.bind(r.__input,"mousedown",(function(e){T.bind(window,"mousemove",c),T.bind(window,"mouseup",h),a=e.clientY})),T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P);function I(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var O=function(e){function t(e,n,i,r,s){f(this,t);var o=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:s})),a=o;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(I(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function c(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(I(t,n.left,n.right,a.__min,a.__max))}function u(){T.unbind(window,"touchmove",h),T.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),T.bind(o.__background,"mousedown",(function(e){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(e)})),T.bind(o.__background,"touchstart",(function(e){1===e.touches.length&&(T.bind(window,"touchmove",h),T.bind(window,"touchend",u),h(e))})),T.addClass(o.__background,"slider"),T.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P),k=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,T.bind(r.__button,"click",(function(e){return e.preventDefault(),s.fire(),!1})),T.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return y(t,e),m(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(w),N=function(e){function t(e,n){f(this,t);var i=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new v(i.getValue()),i.__temp=new v(0);var r=i;i.domElement=document.createElement("div"),T.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",T.bind(i.__input,"keydown",(function(e){13===e.keyCode&&p.call(this)})),T.bind(i.__input,"blur",p),T.bind(i.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(r.__selector,"drag")}))})),T.bind(i.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(r.__selector,"drag")}))}));var s,a=document.createElement("div");function l(e){g(e),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",u),T.bind(window,"touchend",u)}function c(e){y(e),T.bind(window,"mousemove",y),T.bind(window,"touchmove",y),T.bind(window,"mouseup",d),T.bind(window,"touchend",d)}function u(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",u),T.unbind(window,"touchend",u),m()}function d(){T.unbind(window,"mousemove",y),T.unbind(window,"touchmove",y),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var e=h(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function m(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function g(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,s=n.clientY,o=(i-t.left)/(t.right-t.left),a=1-(s-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function y(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return o.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),o.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),o.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),o.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),o.extend(a.style,{width:"100%",height:"100%",background:"none"}),U(a,"top","rgba(0,0,0,0)","#000"),o.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=i.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(i.__saturation_field,"mousedown",l),T.bind(i.__saturation_field,"touchstart",l),T.bind(i.__field_knob,"mousedown",l),T.bind(i.__field_knob,"touchstart",l),T.bind(i.__hue_field,"mousedown",c),T.bind(i.__hue_field,"touchstart",c),i.__saturation_field.appendChild(a),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=h(this.getValue());if(!1!==e){var t=!1;o.each(v.COMPONENTS,(function(n){if(!o.isUndefined(e[n])&&!o.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&o.extend(this.__color.__state,e)}o.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;o.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,U(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),o.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(w),B=["-moz-","-o-","-webkit-","-ms-",""];function U(e,t,n,i){e.style.background="",o.each(B,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var F='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',z=function(e,t){var n=e[t];return o.isArray(arguments[2])||o.isObject(arguments[2])?new C(e,t,arguments[2]):o.isNumber(n)?o.isNumber(arguments[2])&&o.isNumber(arguments[3])?o.isNumber(arguments[4])?new O(e,t,arguments[2],arguments[3],arguments[4]):new O(e,t,arguments[2],arguments[3]):o.isNumber(arguments[4])?new D(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new D(e,t,{min:arguments[2],max:arguments[3]}):o.isString(n)?new L(e,t):o.isFunction(n)?new k(e,t,""):o.isBoolean(n)?new A(e,t):null},H=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},G=function(){function e(){f(this,e),this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;T.bind(this.backgroundElement,"click",(function(){t.hide()}))}return m(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",T.unbind(e.domElement,"webkitTransitionEnd",t),T.unbind(e.domElement,"transitionend",t),T.unbind(e.domElement,"oTransitionEnd",t)};T.bind(this.domElement,"webkitTransitionEnd",t),T.bind(this.domElement,"transitionend",t),T.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if("undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var V="Default",W=function(){try{return!!window.localStorage}catch(e){return!1}}(),j=void 0,q=!0,X=void 0,J=!1,Y=[],Z=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=o.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=o.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),o.isUndefined(i.load)?i.load={preset:V}:i.preset&&(i.load.preset=i.preset),o.isUndefined(i.parent)&&i.hideable&&Y.push(this),i.resizable=o.isUndefined(i.parent)&&i.resizable,i.autoPlace&&o.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,s=W&&"true"===localStorage.getItem(ne(0,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:i,factoryArgs:[o.toArray(arguments)]})}if(o.isArray(t)||o.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof O){var i=new D(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});o.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),T.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof D){var r=function(t){if(o.isNumber(n.__min)&&o.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=te(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(i),r&&s.listen(),s}return t};n.min=o.compose(r,n.min),n.max=o.compose(r,n.max)}else n instanceof A?(T.bind(t,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof k?(T.bind(t,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(t,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(t,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof N&&(T.addClass(t,"color"),n.updateDisplay=o.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=o.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&$(e.getRoot(),!0),t}),n.setValue)}(e,c,r),e.__controllers.push(r),r}function ne(e,t){return document.location.href+"."+t}function ie(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function re(e,t){t.style.display=e.useLocalStorage?"block":"none"}function se(e){var t=e.__save_row=document.createElement("li");T.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),T.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",T.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",T.addClass(i,"button"),T.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",T.addClass(r,"button"),T.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",T.addClass(s,"button"),T.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?o.each(e.load.remembered,(function(t,n){ie(e,n,n===e.preset)})):ie(e,V,!1),T.bind(a,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=le(this)),e.folders={},o.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=le(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=le(this,!0)),this.load.remembered[e]=le(this),this.preset=e,ie(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){o.each(this.__controllers,(function(t){this.getRoot().load.remembered?ee(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),o.each(this.__folders,(function(e){e.revert(e)})),e||$(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&ce(this.__listening)},updateDisplay:function(){o.each(this.__controllers,(function(e){e.updateDisplay()})),o.each(this.__folders,(function(e){e.updateDisplay()}))}});const he={color:{Color:v,math:d,interpret:h},controllers:{Controller:w,BooleanController:A,OptionController:C,StringController:L,NumberController:P,NumberControllerBox:D,NumberControllerSlider:O,FunctionController:k,ColorController:N},dom:{dom:T},gui:{GUI:Z},GUI:Z}},973:(e,t,n)=>{"use strict";n.d(t,{eW:()=>S,oe:()=>x});var i=n(477);class r{static addMaterial(e,t,n,i,r){let s;t.name=n,i?(e[n]=t,r&&console.info('Material with name "'+n+'" was forcefully overridden.')):(s=e[n],s?s.uuid!=s.uuid&&r&&console.log('Same material name "'+s.name+'" different uuid ['+s.uuid+"|"+t.uuid+"]"):(e[n]=t,r&&console.info('Material with name "'+n+'" was added.')))}static getMaterialsJSON(e){const t={};let n;for(const i in e)n=e[i],"function"==typeof n.toJSON&&(t[i]=n.toJSON());return t}static cloneMaterial(e,t,n){let i;if(t){let s=t.materialNameOrg;s=null!=s?s:"";const o=e[s];o?(i=o.clone(),Object.assign(i,t.materialProperties),r.addMaterial(e,i,t.materialProperties.name,!0)):n&&console.info('Requested material "'+s+'" is not available!')}return i}}class s{static buildThreeConst(){return"const EventDispatcher = THREE.EventDispatcher;\nconst BufferGeometry = THREE.BufferGeometry;\nconst BufferAttribute = THREE.BufferAttribute;\nconst Box3 = THREE.Box3;\nconst Sphere = THREE.Sphere;\nconst Texture = THREE.Texture;\nconst MaterialLoader = THREE.MaterialLoader;\n"}static buildUglifiedThreeMapping(){return s.buildUglifiedNameAssignment((function(){return i.BufferGeometry}),"BufferGeometry",/_BufferGeometry/,!1)+s.buildUglifiedNameAssignment((function(){return i.BufferAttribute}),"BufferAttribute",/_BufferAttribute/,!1)+s.buildUglifiedNameAssignment((function(){return i.Box3}),"Box3",/_Box3/,!1)+s.buildUglifiedNameAssignment((function(){return i.Sphere}),"Sphere",/_Sphere/,!1)+s.buildUglifiedNameAssignment((function(){return i.Texture}),"Texture",/_Texture/,!1)+s.buildUglifiedNameAssignment((function(){return i.MaterialLoader}),"MaterialLoader",/_MaterialLoader/,!1)}static buildUglifiedThreeWtmMapping(){return s.buildUglifiedNameAssignment((function(){return o}),"DataTransport",/_DataTransport/,!0)+s.buildUglifiedNameAssignment((function(){return l}),"GeometryTransport",/_GeometryTransport/,!0)+s.buildUglifiedNameAssignment((function(){return c}),"MeshTransport",/_MeshTransport/,!0)+s.buildUglifiedNameAssignment((function(){return a}),"MaterialsTransport",/_MaterialsTransport/,!0)+s.buildUglifiedNameAssignment((function(){return r}),"MaterialUtils",/_MaterialUtils/,!0)}static buildUglifiedNameAssignment(e,t,n,i){let r=e.toString();r=r.replace(n,"").replace(/[\r\n]+/gm,""),r=r.replace(/.*return/,"").replace(/\}/,"").replace(/;/gm,"");const s=r.trim();let o="";return s!==t&&(o="const "+(i?t:s)+" = "+(i?s:t)+";\n"),o}}class o{constructor(e,t){this.main={cmd:void 0!==e?e:"unknown",id:void 0!==t?t:0,type:"DataTransport",progress:0,buffers:{},params:{}},this.transferables=[]}loadData(e){return this.main.cmd=e.cmd,this.main.id=e.id,this.main.type="DataTransport",this.setProgress(e.progress),this.setParams(e.params),e.buffers&&Object.entries(e.buffers).forEach((([e,t])=>{this.main.buffers[e]=t})),this}getCmd(){return this.main.cmd}getId(){return this.main.id}setParams(e){return null!=e&&(this.main.params=e),this}getParams(){return this.main.params}setProgress(e){return this.main.progress=e,this}addBuffer(e,t){return this.main.buffers[e]=t,this}getBuffer(e){return this.main.buffers[e]}package(e){for(let t of Object.values(this.main.buffers))if(null!=t){const n=e?t.slice(0):t;this.transferables.push(n)}return this}getMain(){return this.main}getTransferables(){return this.transferables}postMessage(e){return e.postMessage(this.main,this.transferables),this}}class a extends o{constructor(e,t){super(e,t),this.main.type="MaterialsTransport",this.main.materials={},this.main.multiMaterialNames={},this.main.cloneInstructions=[]}loadData(e){super.loadData(e),this.main.type="MaterialsTransport",Object.assign(this.main,e);const t=new i.MaterialLoader;return Object.entries(this.main.materials).forEach((([e,n])=>{this.main.materials[e]=t.parse(n)})),this}_cleanMaterial(e){return Object.entries(e).forEach((([t,n])=>{(n instanceof i.Texture||null===n)&&(e[t]=void 0)})),e}addBuffer(e,t){return super.addBuffer(e,t),this}setParams(e){return super.setParams(e),this}setMaterials(e){return null!=e&&Object.keys(e).length>0&&(this.main.materials=e),this}getMaterials(){return this.main.materials}cleanMaterials(){let e,t={};for(let n of Object.values(this.main.materials))"function"==typeof n.clone&&(e=n.clone(),t[e.name]=this._cleanMaterial(e));return this.setMaterials(t),this}package(e){return super.package(e),this.main.materials=r.getMaterialsJSON(this.main.materials),this}hasMultiMaterial(){return Object.keys(this.main.multiMaterialNames).length>0}getSingleMaterial(){return Object.keys(this.main.materials).length>0?Object.entries(this.main.materials)[0][1]:null}processMaterialTransport(e,t){for(let n=0;n{n[t]=e[i]}));else{const t=this.getSingleMaterial();null!==t&&(n=e[t.name],n||(n=t))}return n}}class l extends o{constructor(e,t){super(e,t),this.main.type="GeometryTransport",this.main.geometryType=0,this.main.geometry={},this.main.bufferGeometry=null}loadData(e){return super.loadData(e),this.main.type="GeometryTransport",this.setGeometry(e.geometry,e.geometryType)}getGeometryType(){return this.main.geometryType}setParams(e){return super.setParams(e),this}setGeometry(e,t){return this.main.geometry=e,this.main.geometryType=t,e instanceof i.BufferGeometry&&(this.main.bufferGeometry=e),this}package(e){super.package(e);const t=this.main.geometry.getAttribute("position"),n=this.main.geometry.getAttribute("normal"),i=this.main.geometry.getAttribute("uv"),r=this.main.geometry.getAttribute("color"),s=this.main.geometry.getAttribute("skinIndex"),o=this.main.geometry.getAttribute("skinWeight"),a=this.main.geometry.getIndex();return this._addBufferAttributeToTransferable(t,e),this._addBufferAttributeToTransferable(n,e),this._addBufferAttributeToTransferable(i,e),this._addBufferAttributeToTransferable(r,e),this._addBufferAttributeToTransferable(s,e),this._addBufferAttributeToTransferable(o,e),this._addBufferAttributeToTransferable(a,e),this}reconstruct(e){if(this.main.bufferGeometry instanceof i.BufferGeometry)return this;this.main.bufferGeometry=new i.BufferGeometry;const t=this.main.geometry;this._assignAttribute(t.attributes.position,"position",e),this._assignAttribute(t.attributes.normal,"normal",e),this._assignAttribute(t.attributes.uv,"uv",e),this._assignAttribute(t.attributes.color,"color",e),this._assignAttribute(t.attributes.skinIndex,"skinIndex",e),this._assignAttribute(t.attributes.skinWeight,"skinWeight",e);const n=t.index;if(null!=n){const t=e?n.array.slice(0):n.array;this.main.bufferGeometry.setIndex(new i.BufferAttribute(t,n.itemSize,n.normalized))}const r=t.boundingBox;null!==r&&(this.main.bufferGeometry.boundingBox=Object.assign(new i.Box3,r));const s=t.boundingSphere;return null!==s&&(this.main.bufferGeometry.boundingSphere=Object.assign(new i.Sphere,s)),this.main.bufferGeometry.uuid=t.uuid,this.main.bufferGeometry.name=t.name,this.main.bufferGeometry.type=t.type,this.main.bufferGeometry.groups=t.groups,this.main.bufferGeometry.drawRange=t.drawRange,this.main.bufferGeometry.userData=t.userData,this}getBufferGeometry(){return this.main.bufferGeometry}_addBufferAttributeToTransferable(e,t){if(null!=e){const n=t?e.array.slice(0):e.array;this.transferables.push(n.buffer)}return this}_assignAttribute(e,t,n){if(e){const r=n?e.array.slice(0):e.array;this.main.bufferGeometry.setAttribute(t,new i.BufferAttribute(r,e.itemSize,e.normalized))}return this}}class c extends l{constructor(e,t){super(e,t),this.main.type="MeshTransport",this.main.materialsTransport=new a}loadData(e){return super.loadData(e),this.main.type="MeshTransport",this.main.meshName=e.meshName,this.main.materialsTransport=(new a).loadData(e.materialsTransport.main),this}setParams(e){return super.setParams(e),this}setMaterialsTransport(e){return e instanceof a&&(this.main.materialsTransport=e),this}getMaterialsTransport(){return this.main.materialsTransport}setMesh(e,t){return this.main.meshName=e.name,super.setGeometry(e.geometry,t),this}package(e){return super.package(e),null!==this.main.materialsTransport&&this.main.materialsTransport.package(e),this}reconstruct(e){return super.reconstruct(e),this}}class h{static serializePrototype(e,t,n,i){let r,s=[],o="";i?(o=e.toString()+"\n\n",r=t):r=e;for(let e in r){let t=r[e],n=t.toString();"function"==typeof t&&s.push("\t"+e+": "+n+",\n\n")}o+=n+(i?".prototype":"")+" = {\n\n";for(let e=0;e0){let n;for(const i in e)n=e[i],r.addMaterial(this.materials,n,i,!0===t)}}getMaterials(){return this.materials}getMaterial(e){return this.materials[e]}clearMaterials(){this.materials={}}}class p{static comRouting(e,t,n,i,r){let s=t.data;"init"===s.cmd?null!=n?n[i](e,s.workerId,s.config):i(e,s.workerId,s.config):"execute"===s.cmd&&(null!=n?n[r](e,s.workerId,s.config):r(e,s.workerId,s.config))}}class f{constructor(e){this.taskTypes=new Map,this.verbose=!1,this.maxParallelExecutions=e||4,this.actualExecutionCount=0,this.storedExecutions=[],this.teardown=!1}setVerbose(e){return this.verbose=e,this}setMaxParallelExecutions(e){return this.maxParallelExecutions=e,this}getMaxParallelExecutions(){return this.maxParallelExecutions}supportsTaskType(e){return this.taskTypes.has(e)}registerTaskType(e,t,n,i,r,s){let o=!this.supportsTaskType(e);if(o){let o=new m(e,this.maxParallelExecutions,r,this.verbose);o.setFunctions(t,n,i),o.setDependencyDescriptions(s),this.taskTypes.set(e,o)}return o}registerTaskTypeModule(e,t){let n=!this.supportsTaskType(e);if(n){let n=new m(e,this.maxParallelExecutions,!1,this.verbose);n.setWorkerModule(t),this.taskTypes.set(e,n)}return n}async initTaskType(e,t,n){let i=this.taskTypes.get(e);if(i)if(i.status.initStarted)for(;!i.status.initComplete;)await this._wait(10);else i.status.initStarted=!0,i.isWorkerModule()?await i.createWorkerModules().then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e))):await i.loadDependencies().then((()=>i.createWorkers())).then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e)))}async _wait(e){return new Promise((t=>{setTimeout(t,e)}))}async enqueueForExecution(e,t,n,i){return new Promise(((r,s)=>{this.storedExecutions.push(new g(e,t,n,r,s,i)),this._depleteExecutions()}))}_depleteExecutions(){let e=0;for(;this.actualExecutionCount{i.onmessage=n=>{"assetAvailable"===n.data.cmd?t.assetAvailableFunction instanceof Function&&t.assetAvailableFunction(n.data):e(n)},i.onerror=n,i.postMessage({cmd:"execute",workerId:i.getId(),config:t.config},t.transferables)})).then((e=>{n.returnAvailableTask(i),t.resolve(e.data),this.actualExecutionCount--,this._depleteExecutions()})).catch((e=>{t.reject("Execution error: "+e)}))):e++}}dispose(){this.teardown=!0;for(let e of this.taskTypes.values())e.dispose();return this}}class m{constructor(e,t,n,i){this.taskType=e,this.fallback=n,this.verbose=!0===i,this.initialised=!1,this.functions={init:null,execute:null,comRouting:null,dependencies:{descriptions:[],code:[]},workerModuleUrl:null},this.workers={code:[],instances:new Array(t),available:[]},this.status={initStarted:!1,initComplete:!1}}getTaskType(){return this.taskType}setFunctions(e,t,n){this.functions.init=e,this.functions.execute=t,this.functions.comRouting=n,void 0!==this.functions.comRouting&&null!==this.functions.comRouting||(this.functions.comRouting=p.comRouting),this._addWorkerCode("init",this.functions.init.toString()),this._addWorkerCode("execute",this.functions.execute.toString()),this._addWorkerCode("comRouting",this.functions.comRouting.toString()),this.workers.code.push('self.addEventListener( "message", message => comRouting( self, message, null, init, execute ), false );')}_addWorkerCode(e,t){t.startsWith("function")?this.workers.code.push("const "+e+" = "+t+";\n\n"):this.workers.code.push("function "+t+";\n\n")}setDependencyDescriptions(e){e&&e.forEach((e=>{this.functions.dependencies.descriptions.push(e)}))}setWorkerModule(e){this.functions.workerModuleUrl=new URL(e,window.location.href)}isWorkerModule(){return null!==this.functions.workerModuleUrl}async loadDependencies(){let e=[],t=new i.FileLoader;t.setResponseType("arraybuffer");for(let n of this.functions.dependencies.descriptions){if(n.url){let i=new URL(n.url,window.location.href);e.push(t.loadAsync(i.href,(e=>{this.verbose&&console.log(e)})))}n.code&&e.push(new Promise((e=>e(n.code))))}this.verbose&&console.log("Task: "+this.getTaskType()+": Waiting for completion of loading of all dependencies."),this.functions.dependencies.code=await Promise.all(e)}async createWorkers(){let e;if(this.fallback)for(let t=0;t{let s;if(i.onmessage=e=>{this.verbose&&console.log("Init Complete: "+e.data.id),n(e)},i.onerror=r,t){s=[];for(let e=0;e0}returnAvailableTask(e){this.workers.available.push(e)}dispose(){for(let e of this.workers.instances)e.terminate()}}class g{constructor(e,t,n,i,r,s){this.taskType=e,this.config=t,this.assetAvailableFunction=n,this.resolve=i,this.reject=r,this.transferables=s}}class y extends Worker{constructor(e,t,n){super(t,n),this.id=e}getId(){return this.id}}class _{constructor(e,t,n){this.id=e,this.functions={init:t,execute:n}}getId(){return this.id}postMessage(e,t){let n=this,i={postMessage:function(e){n.onmessage({data:e})}};p.comRouting(i,{data:e},null,n.functions.init,n.functions.execute)}terminate(){}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class x extends i.Loader{constructor(e){super(e),this.parser=new b,this.materialStore=new d(!0),this.parser.materials=this.materialStore.getMaterials()}setLogging(e,t){return this.parser.logging.enabled=!0===e,this.parser.logging.debug=!0===t,this}setMaterialPerSmoothingGroup(e){return this.parser.aterialPerSmoothingGroup=!0===e,this}setUseOAsMesh(e){return this.parser.useOAsMesh=!0===e,this}setUseIndices(e){return this.parser.useIndices=!0===e,this}setDisregardNormals(e){return this.parser.disregardNormals=!0===e,this}setModelName(e){return e&&(this.parser.modelName=e),this}getModelName(){return this.parser.modelName}setBaseObject3d(e){return this.parser.baseObject3d=null==e?this.parser.baseObject3d:e,this}setMaterials(e){return this.materialStore.addMaterials(e,!1),this.parser.materials=this.materialStore.getMaterials(),this}setCallbackOnProgress(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onProgress=e),this}setCallbackOnError(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onError=e),this}setCallbackOnLoad(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onLoad=e),this}setCallbackOnMeshAlter(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onMeshAlter=e),this}load(e,t,n,r,s){if(!(null!=t&&t instanceof Function)){const e="onLoad is not a function! Aborting...";throw this.parser._onError(e),e}this.setCallbackOnLoad(t);const o=this;null!=r&&r instanceof Function||(r=function(e){let t=e;e.currentTarget&&null!==e.currentTarget.statusText&&(t="Error occurred while downloading!\nurl: "+e.currentTarget.responseURL+"\nstatus: "+e.currentTarget.statusText),o.parser._onError(t)}),e||r("An invalid url was provided. Unable to continue!");const a=new URL(e,window.location.href).href;let l=a;const c=a.split("/");if(c.length>2){l=c[c.length-1];let e=c.slice(0,c.length-1).join("/")+"/";void 0!==e&&(this.path=e)}if(null==n||!(n instanceof Function)){let t=0,i=0;n=function(n){if(n.lengthComputable&&(i=n.loaded/n.total,i>t)){t=i;const n='Download of "'+e+'": '+(100*i).toFixed(2)+"%";o.parser._onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(s);const h=new i.FileLoader(this.manager);h.setPath(this.path||this.resourcePath),h.setResponseType("arraybuffer"),h.load(l,(function(e){o.parse(e)}),n,r)}parse(e){if(this.parser.logging.enabled&&console.info("Using OBJLoader2 version: "+x.OBJLOADER2_VERSION),null==e)throw"Provided content is not a valid ArrayBuffer or String. Unable to continue parsing";return this.parser.logging.enabled&&console.time("OBJLoader parse: "+this.modelName),e instanceof ArrayBuffer||e instanceof Uint8Array?(this.parser.logging.enabled&&console.info("Parsing arrayBuffer..."),this.parser._execute(e)):"string"==typeof e||e instanceof String?(this.parser.logging.enabled&&console.info("Parsing text..."),this.parser._executeLegacy(e)):this.parser._onError("Provided content was neither of type String nor Uint8Array! Aborting..."),this.parser.logging.enabled&&console.timeEnd("OBJLoader parse: "+this.modelName),this.parser.baseObject3d}}v(x,"OBJLOADER2_VERSION","4.0.0-dev");class b{constructor(){this.logging={enabled:!1,debug:!1},this.usedBefore=!1,this._init(),this.callbacks={onLoad:null,onError:null,onProgress:null,onMeshAlter:null}}_init(){this.contentRef=null,this.legacyMode=!1,this.materials={},this.baseObject3d=new i.Object3D,this.modelName="noname",this.materialPerSmoothingGroup=!1,this.useOAsMesh=!1,this.useIndices=!1,this.disregardNormals=!1,this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],this.objectId=0,this.rawMesh={objectName:"",groupName:"",activeMtlName:"",mtllibName:"",faceType:-1,subGroups:[],subGroupInUse:null,smoothingGroup:{splitMaterials:!1,normalized:-1,real:-1},counts:{doubleIndicesCount:0,faceCount:0,mtlCount:0,smoothingGroupCount:0}},this.inputObjectCount=1,this.outputObjectCount=1,this.globalCounts={vertices:0,faces:0,doubleIndicesCount:0,lineByte:0,currentByte:0,totalBytes:0}}_resetRawMesh(){this.rawMesh.subGroups=[],this.rawMesh.subGroupInUse=null,this.rawMesh.smoothingGroup.normalized=-1,this.rawMesh.smoothingGroup.real=-1,this._pushSmoothingGroup(1),this.rawMesh.counts.doubleIndicesCount=0,this.rawMesh.counts.faceCount=0,this.rawMesh.counts.mtlCount=0,this.rawMesh.counts.smoothingGroupCount=0}_configure(){if(this.usedBefore=!0,this._pushSmoothingGroup(1),this.logging.enabled){const e=Object.keys(this.materials);let t="OBJLoader2 Parser configuration:"+(e.length>0?"\n\tmaterialNames:\n\t\t- "+e.join("\n\t\t- "):"\n\tmaterialNames: None")+"\n\tmaterialPerSmoothingGroup: "+this.materialPerSmoothingGroup+"\n\tuseOAsMesh: "+this.useOAsMesh+"\n\tuseIndices: "+this.useIndices+"\n\tdisregardNormals: "+this.disregardNormals;null!==this.callbacks.onProgress&&(t+="\n\tcallbacks.onProgress: "+this.callbacks.onProgress.name),null!==this.callbacks.onError&&(t+="\n\tcallbacks.onError: "+this.callbacks.onError.name),null!==this.callbacks.onMeshAlter&&(t+="\n\tcallbacks.onMeshAlter: "+this.callbacks.onMeshAlter.name),null!==this.callbacks.onLoad&&(t+="\n\tcallbacks.onLoad: "+this.callbacks.onLoad.name),console.info(t)}}_execute(e){this.logging.enabled&&console.time("OBJLoader2Parser.execute"),this._configure();const t=new Uint8Array(e);this.contentRef=t;const n=t.byteLength;this.globalCounts.totalBytes=n;const i=new Array(128);let r,s=0,o=0,a="",l=0;for(;l0&&(i[s++]=a),a="";break;case 47:a.length>0&&(i[s++]=a),o++,a="";break;case 10:this._processLine(i,s,o,a,l),a="",s=0,o=0;break;case 13:break;default:a+=String.fromCharCode(r)}this._processLine(i,s,o,a,l),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.execute")}_executeLegacy(e){this.logging.enabled&&console.time("OBJLoader2Parser.executeLegacy"),this._configure(),this.legacyMode=!0,this.contentRef=e;const t=e.length;this.globalCounts.totalBytes=t;const n=new Array(128);let i,r=0,s=0,o="",a=0;for(;a0&&(n[r++]=o),o="";break;case"/":o.length>0&&(n[r++]=o),s++,o="";break;case"\n":this._processLine(n,r,s,o,a),o="",r=0,s=0;break;case"\r":break;default:o+=i}this._processLine(n,r,o,s),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.executeLegacy")}_processLine(e,t,n,i,r){if(this.globalCounts.lineByte=this.globalCounts.currentByte,this.globalCounts.currentByte=r,t<1)return;i.length>0&&(e[t++]=i);const s=function(e,t,n,i){let r="";if(i>n){let s;if(t)for(s=n;s4&&(this.colors.push(parseFloat(e[4])),this.colors.push(parseFloat(e[5])),this.colors.push(parseFloat(e[6])));break;case"vt":this.uvs.push(parseFloat(e[1])),this.uvs.push(parseFloat(e[2]));break;case"vn":this.normals.push(parseFloat(e[1])),this.normals.push(parseFloat(e[2])),this.normals.push(parseFloat(e[3]));break;case"f":if(o=t-1,0===n)for(this._checkFaceType(0),l=2,a=o;l0?s-1:s+r.vertices.length/3),a=r.colors.length>0?o:null;const l=i.vertices;if(l.push(r.vertices[o++]),l.push(r.vertices[o++]),l.push(r.vertices[o]),null!==a){const e=i.colors;e.push(r.colors[a++]),e.push(r.colors[a++]),e.push(r.colors[a])}if(t){const e=parseInt(t);let n=2*(e>0?e-1:e+r.uvs.length/2);const s=i.uvs;s.push(r.uvs[n++]),s.push(r.uvs[n])}if(n&&!r.disregardNormals){const e=parseInt(n);let t=3*(e>0?e-1:e+r.normals.length/3);const s=i.normals;s.push(r.normals[t++]),s.push(r.normals[t++]),s.push(r.normals[t])}};if(this.useIndices){this.disregardNormals&&(n=void 0);const r=e+(t?"_"+t:"_n")+(n?"_"+n:"_n");let o=i.indexMappings[r];null==o?(o=this.rawMesh.subGroupInUse.vertices.length/3,s(),i.indexMappings[r]=o,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(o)}else s();this.rawMesh.counts.faceCount++}_createRawMeshReport(e){return"Input Object number: "+e+"\n\tObject name: "+this.rawMesh.objectName+"\n\tGroup name: "+this.rawMesh.groupName+"\n\tMtllib name: "+this.rawMesh.mtllibName+"\n\tVertex count: "+this.vertices.length/3+"\n\tNormal count: "+this.normals.length/3+"\n\tUV count: "+this.uvs.length/2+"\n\tSmoothingGroup count: "+this.rawMesh.counts.smoothingGroupCount+"\n\tMaterial count: "+this.rawMesh.counts.mtlCount+"\n\tReal MeshOutputGroup count: "+this.rawMesh.subGroups.length}_finalizeRawMesh(){const e=[];let t,n,i=0,r=0,s=0,o=0,a=0,l=0;for(const c in this.rawMesh.subGroups)if(t=this.rawMesh.subGroups[c],t.vertices.length>0){if(n=t.indices,n.length>0&&r>0)for(let e=0;e0&&(c={name:""!==this.rawMesh.groupName?this.rawMesh.groupName:this.rawMesh.objectName,subGroups:e,absoluteVertexCount:i,absoluteIndexCount:s,absoluteColorCount:o,absoluteNormalCount:a,absoluteUvCount:l,faceCount:this.rawMesh.counts.faceCount,doubleIndicesCount:this.rawMesh.counts.doubleIndicesCount}),c}_processCompletedMesh(){const e=this._finalizeRawMesh(),t=null!==e;if(t){this.colors.length>0&&this.colors.length!==this.vertices.length&&this._onError("Vertex Colors were detected, but vertex count and color count do not match!"),this.logging.enabled&&this.logging.debug&&console.debug(this._createRawMeshReport(this.inputObjectCount)),this.inputObjectCount++,this._buildMesh(e);const t=this.globalCounts.currentByte/this.globalCounts.totalBytes;this._onProgress("Completed [o: "+this.rawMesh.objectName+" g:"+this.rawMesh.groupName+"] Total progress: "+(100*t).toFixed(2)+"%"),this._resetRawMesh()}return t}_buildMesh(e){const t=e.subGroups;this.globalCounts.vertices+=e.absoluteVertexCount/3,this.globalCounts.faces+=e.faceCount,this.globalCounts.doubleIndicesCount+=e.doubleIndicesCount;const n=new i.BufferGeometry,s=new Float32Array(e.absoluteVertexCount),o=e.absoluteIndexCount>0?new Uint32Array(e.absoluteIndexCount):null,a=e.absoluteColorCount>0?new Float32Array(e.absoluteColorCount):null,l=e.absoluteNormalCount>0?new Float32Array(e.absoluteNormalCount):null,c=e.absoluteUvCount>0?new Float32Array(e.absoluteUvCount):null;let h;n.setAttribute("position",new i.BufferAttribute(s,3,!1)),null!=l&&n.setAttribute("normal",new i.BufferAttribute(l,3,!1)),null!=c&&n.setAttribute("uv",new i.BufferAttribute(c,2,!1)),null!=a&&n.setAttribute("color",new i.BufferAttribute(a,3,!1)),null!==o&&n.setIndex(new i.BufferAttribute(o,1,!1));let u=0,d=0,p=0,f=0,m=0,g=0,y=0;const _=t.length>1,v=[],x=null!==a;let b,w,M,S,E,T=0;const A={cloneInstructions:[],multiMaterialNames:{},modelName:this.modelName,progress:this.globalCounts.currentByte/this.globalCounts.totalBytes,geometryType:this.rawMesh.faceType<4?0:6===this.rawMesh.faceType?2:1,objectId:this.objectId};for(const e in t)if(t.hasOwnProperty(e)){if(h=t[e],E=h.materialName,b=0===h.smoothingGroup,this.rawMesh.faceType<4?(S=E,x&&(S+="_vertexColor"),b&&(S+="_flat")):S=6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",w=this.materials[E],M=this.materials[S],null==w&&null==M&&(S=x?"defaultVertexColorMaterial":"defaultMaterial",M=this.materials[S],this.logging.enabled&&console.info('object_group "'+h.objectName+"_"+h.groupName+'" was defined with unresolvable material "'+E+'"! Assigning "'+S+'".')),null==M){const e={materialNameOrg:E,materialProperties:{name:S,vertexColors:x?2:0,flatShading:b}};M=r.cloneMaterial(this.materials,e,this.logging.enabled&&this.logging.debug),A.cloneInstructions.push(e)}if(_&&(y=this.useIndices?h.indices.length:h.vertices.length/3,n.addGroup(g,y,T),M=this.materials[S],v[T]=M,A.multiMaterialNames[T]=M.name,g+=y,T++),s.set(h.vertices,u),u+=h.vertices.length,null!==o&&(o.set(h.indices,d),d+=h.indices.length),null!==a&&(a.set(h.colors,p),p+=h.colors.length),null!==l&&(l.set(h.normals,f),f+=h.normals.length),null!==c&&(c.set(h.uvs,m),m+=h.uvs.length),this.logging.enabled&&this.logging.debug){let e="";T>0&&(e="\n\t\tmaterialIndex: "+T);const t="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+h.groupName+"\n\t\tIndex: "+h.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+h.materialName+"\n\t\tsmoothingGroup: "+h.smoothingGroup+e+"\n\t\tobjectName: "+h.objectName+"\n\t\t#vertices: "+h.vertices.length/3+"\n\t\t#indices: "+h.indices.length+"\n\t\t#colors: "+h.colors.length/3+"\n\t\t#uvs: "+h.uvs.length/2+"\n\t\t#normals: "+h.normals.length/3;console.debug(t)}}let C;this.outputObjectCount++,null==n.getAttribute("normal")&&n.computeVertexNormals();const L=_?v:M;C=0===A.geometryType?new i.Mesh(n,L):1===A.geometryType?new i.LineSegments(n,L):new i.Points(n,L),C.name=e.name,this._onAssetAvailable(C,A)}_finalizeParsing(){if(this.logging.enabled&&console.info("Global output object count: "+this.outputObjectCount),this._processCompletedMesh()&&this.logging.enabled){const e="Overall counts: \n\tVertices: "+this.globalCounts.vertices+"\n\tFaces: "+this.globalCounts.faces+"\n\tMultiple definitions: "+this.globalCounts.doubleIndicesCount;console.info(e)}this._onLoad()}_onProgress(e){if(null!==this.callbacks.onProgress)this.callbacks.onProgress(e);else{const t=e||"";this.logging.enabled&&this.logging.debug&&console.log(t)}}_onError(e){null!==this.callbacks.onError?this.callbacks.onError(e):this.logging.enabled&&this.logging.debug&&console.error(e)}_onAssetAvailable(e,t){this._onMeshAlter(e,t),this.baseObject3d.add(e)}_onMeshAlter(e){null!==this.callbacks.onMeshAlter&&this.callbacks.onMeshAlter(e,this.baseObject3d)}_onLoad(){null!==this.callbacks.onLoad&&this.callbacks.onLoad(this.baseObject3d,this.objectId)}static buildUglifiedMapping(){return s.buildUglifiedNameAssignment((function(){return b}),"OBJLoader2Parser",/_OBJLoader2Parser/,!0)}}class w{static buildStandardWorkerDependencies(e){return[{url:e},{code:s.buildThreeConst()},{code:w.buildThreeExtraConst()},{code:"\n\n"},{code:s.buildUglifiedThreeMapping()},{code:w.buildUglifiedThreeExtraMapping()},{code:"\n\n"},{code:h.serializeClass(o)},{code:h.serializeClass(l)},{code:h.serializeClass(c)},{code:h.serializeClass(a)},{code:h.serializeClass(r)},{code:h.serializeClass(b)},{code:h.serializeClass(u)},{code:s.buildUglifiedThreeWtmMapping()},{code:"\n\n"},{code:b.buildUglifiedMapping()},{code:"\n\n"}]}static buildThreeExtraConst(){return"const MathUtils = THREE.MathUtils;\nconst Material = THREE.Material;\nconst Object3D = THREE.Object3D;\nconst Mesh = THREE.Mesh;\n"}static buildUglifiedThreeExtraMapping(){return s.buildUglifiedNameAssignment((function(){return i.MathUtils}),"MathUtils",/_MathUtils/,!1)+s.buildUglifiedNameAssignment((function(){return i.Material}),"Material",/_Material/,!1)+s.buildUglifiedNameAssignment((function(){return i.Object3D}),"Object3D",/_Object3D/,!1)+s.buildUglifiedNameAssignment((function(){return i.Mesh}),"Mesh",/_Mesh/,!1)}static init(e,t,n){const i=(new a).loadData(n);e.obj2={parser:new b,buffer:null,materials:i.getMaterials()},e.obj2.parser._onMeshAlter=(t,n)=>{const i=new a;if(i.main.multiMaterialNames=n.multiMaterialNames,0===Object.keys(i.main.multiMaterialNames).length){const e=t.material;r.addMaterial(i.main.materials,e,e.name,!1,!1)}i.main.cloneInstructions=n.cloneInstructions,i.cleanMaterials(),new c("assetAvailable",n.objectId).setProgress(n.progress).setParams({modelName:n.modelName}).setMesh(t,n.geometryType).setMaterialsTransport(i).postMessage(e)},e.obj2.parser.callbacks.onLoad=()=>{new o("execComplete",e.obj2.parser.objectId).postMessage(e)},e.obj2.parser.callbacks.onProgress=t=>{e.obj2.parser.logging.debug&&console.debug("WorkerRunner: progress: "+t)},u.applyProperties(e.obj2.parser,i.getParams(),!1);const s=i.getBuffer("modelData");null!=s&&(e.obj2.buffer=s),new o("init",t).postMessage(e)}static execute(e,t,n){e.obj2.parser.usedBefore&&e.obj2.parser._init(),e.obj2.parser.materials=e.obj2.materials;const i=(new o).loadData(n);u.applyProperties(e.obj2.parser,i.getParams(),!1);const r=i.getBuffer("modelData");null!=r&&(e.obj2.buffer=r),e.obj2.buffer&&(e.obj2.parser.objectId=i.getId(),e.obj2.parser._execute(e.obj2.buffer))}}class M extends x{constructor(e){super(e),this.preferJsmWorker=!1,this.urls={jsmWorker:new URL(M.DEFAULT_JSM_WORKER_PATH,window.location.href),threejs:new URL(M.DEFAULT_JSM_THREEJS_PATH,window.location.href)},this.workerTaskManager=null,this.taskName="tmOBJLoader2"}setWorkerTaskManager(e,t){return this.workerTaskManager=e,t&&(this.taskName=t),this}setJsmWorker(e,t){if(this.preferJsmWorker=!0===e,!(null!=t&&t instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.jsmWorker=t,this}setThreejsLocation(e){if(!(null!=e&&e instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.threejs=e,this}setTerminateWorkerOnLoad(e){return this.terminateWorkerOnLoad=!0===e,this}async _buildWorkerCode(e){null!==this.workerTaskManager&&this.workerTaskManager instanceof f||(this.parser.logging.debug&&console.log("Needed to create new WorkerTaskManager"),this.workerTaskManager=new f(1),this.workerTaskManager.setVerbose(this.parser.logging.enabled&&this.parser.logging.debug)),this.workerTaskManager.supportsTaskType(this.taskName)||(this.preferJsmWorker?this.workerTaskManager.registerTaskTypeModule(this.taskName,this.urls.jsmWorker):this.workerTaskManager.registerTaskType(this.taskName,w.init,w.execute,null,!1,w.buildStandardWorkerDependencies(this.urls.threejs)),await this.workerTaskManager.initTaskType(this.taskName,e.getMain()))}load(e,t,n,i,r){const s=this;x.prototype.load.call(this,e,(function(e,n){"OBJLoader2ParallelDummy"===e.name?s.parser.logging.enabled&&s.parser.logging.debug&&console.debug("Received dummy answer from OBJLoader2Parallel#parse"):t(e,n)}),n,i,r)}parse(e){this.parser.logging.enabled&&console.info("Using OBJLoader2Parallel version: "+M.OBJLOADER2_PARALLEL_VERSION);const t=(new o).setParams({logging:{enabled:this.parser.logging.enabled,debug:this.parser.logging.debug}});this._buildWorkerCode(t).then((()=>{this.parser.logging.debug&&console.log("OBJLoader2Parallel init was performed"),this._executeWorkerParse(e)})).catch((e=>console.error(e)));let n=new i.Object3D;return n.name="OBJLoader2ParallelDummy",n}_executeWorkerParse(e){const t=new o("execute",Math.floor(Math.random()*Math.floor(65536)));t.setParams({modelName:this.parser.modelName,useIndices:this.parser.useIndices,disregardNormals:this.parser.disregardNormals,materialPerSmoothingGroup:this.parser.materialPerSmoothingGroup,useOAsMesh:this.parser.useOAsMesh,materials:r.getMaterialsJSON(this.materialStore.getMaterials())}).addBuffer("modelData",e).package(!1),this.workerTaskManager.enqueueForExecution(this.taskName,t.getMain(),(e=>this._onLoad(e)),t.getTransferables()).then((e=>{this._onLoad(e),this.terminateWorkerOnLoad&&this.workerTaskManager.dispose()})).catch((e=>console.error(e)))}_onLoad(e){let t=e.cmd;if("assetAvailable"===t){let t;if("MeshTransport"===e.type?t=(new c).loadData(e).reconstruct(!1):console.error("Received unknown asset.type: "+e.type),t){let e,n=t.getMaterialsTransport().processMaterialTransport(this.materialStore.getMaterials(),this.parser.logging.enabled);null===n&&(n=new i.MeshStandardMaterial({color:16711680})),e=0===t.getGeometryType()?new i.Mesh(t.getBufferGeometry(),n):1===t.getGeometryType()?new i.LineSegments(t.getBufferGeometry(),n):new i.Points(t.getBufferGeometry(),n),this.parser._onMeshAlter(e),this.parser.baseObject3d.add(e)}}else if("execComplete"===t){let t;"DataTransport"===e.type?(t=(new o).loadData(e),t instanceof o&&null!==this.parser.callbacks.onLoad&&this.parser.callbacks.onLoad(this.parser.baseObject3d,t.getId())):console.error("Received unknown asset.type: "+e.type)}else console.error("Received unknown command: "+t)}}v(M,"OBJLOADER2_PARALLEL_VERSION",x.OBJLOADER2_VERSION),v(M,"DEFAULT_JSM_WORKER_PATH","/src/loaders/tmOBJLoader2.js"),v(M,"DEFAULT_JSM_THREEJS_PATH","/node_modules/three/build/three.min.js");class S{static link(e,t){"function"==typeof t.setMaterials&&t.setMaterials(S.addMaterialsFromMtlLoader(e),!0)}static addMaterialsFromMtlLoader(e){let t={};return void 0!==e.preload&&e.preload instanceof Function&&(e.preload(),t=e.materials),t}}},676:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DataViewIndexOutOfBoundsError:()=>H,DecodeError:()=>x,Decoder:()=>W,EXT_TIMESTAMP:()=>b,Encoder:()=>R,ExtData:()=>_,ExtensionCodec:()=>C,decode:()=>q,decodeArrayStream:()=>ee,decodeAsync:()=>$,decodeMulti:()=>X,decodeMultiStream:()=>te,decodeStream:()=>ne,decodeTimestampExtension:()=>T,decodeTimestampToTimeSpec:()=>E,encode:()=>D,encodeDateToTimeSpec:()=>M,encodeTimeSpecToTimestamp:()=>w,encodeTimestampExtension:()=>S});var i,r,s,o=4294967295;function a(e,t,n){var i=Math.floor(n/4294967296),r=n;e.setUint32(t,i),e.setUint32(t+4,r)}function l(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var c=("undefined"==typeof process||"never"!==(null===(i=null===process||void 0===process?void 0:process.env)||void 0===i?void 0:i.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function h(e){for(var t=e.length,n=0,i=0;i=55296&&r<=56319&&i65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var m,g=c?new TextDecoder:null,y=c?"undefined"!=typeof process&&"force"!==(null===(s=null===process||void 0===process?void 0:process.env)||void 0===s?void 0:s.TEXT_DECODER)?200:0:o,_=function(e,t){this.type=e,this.data=t},v=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e){function t(n){var i=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(i,r),Object.defineProperty(i,"name",{configurable:!0,enumerable:!1,value:t.name}),i}return v(t,e),t}(Error),b=-1;function w(e){var t,n=e.sec,i=e.nsec;if(n>=0&&i>=0&&n<=17179869183){if(0===i&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var s=n/4294967296,o=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,i<<2|3&s),t.setUint32(4,o),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,i),a(t,4,n),r}function M(e){var t=e.getTime(),n=Math.floor(t/1e3),i=1e6*(t-1e3*n),r=Math.floor(i/1e9);return{sec:n+r,nsec:i-1e9*r}}function S(e){return e instanceof Date?w(M(e)):null}function E(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:l(t,4),nsec:t.getUint32(0)};default:throw new x("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}function T(e){var t=E(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:S,decode:T},C=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,i=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=i;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=i}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>d){var t=h(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),p(e,this.bytes,this.pos),this.pos+=t}else t=h(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var i=e.length,r=n,s=0;s>6&31|192;else{if(o>=55296&&o<=56319&&s>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=63&o|128}else t[r++]=o}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=L(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var i=0,r=e;i0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var i=0,r=this.caches[n-1];i=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)},e.prototype.decode=function(e,t,n){var i=this.find(e,t,n);if(null!=i)return this.hit++,i;this.miss++;var r=f(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,r),r},e}(),k=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof B?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},F=new DataView(new ArrayBuffer(0)),z=new Uint8Array(F.buffer),H=function(){try{F.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),G=new H("Insufficient data"),V=new O,W=function(){function e(e,t,n,i,r,s,a,l){void 0===e&&(e=C.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=o),void 0===i&&(i=o),void 0===r&&(r=o),void 0===s&&(s=o),void 0===a&&(a=o),void 0===l&&(l=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=r,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=l,this.totalPos=0,this.pos=0,this.view=F,this.bytes=z,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=L(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=L(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=L(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return k(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,i,r,s,o,a,l;return s=this,o=void 0,l=function(){var s,o,a,l,c,h,u,d;return k(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=N(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{o=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return l=p.sent(),i={error:l},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(i)throw i.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw h=(c=this).headByte,u=c.pos,d=c.totalPos,new RangeError("Insufficient data in parsing ".concat(I(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{r(l.next(e))}catch(e){t(e)}}function i(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(n,i)}r((l=l.apply(s,o||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return U(this,arguments,(function(){var n,i,r,s,o,a,l,c,h;return k(this,(function(u){switch(u.label){case 0:n=t,i=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),r=N(e),u.label=2;case 2:return[4,B(r.next())];case 3:if((s=u.sent()).done)return[3,12];if(o=s.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),n&&(i=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof H))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return l=u.sent(),c={error:l},[3,19];case 14:return u.trys.push([14,,17,18]),s&&!s.done&&(h=r.return)?[4,B(h.call(r))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(c)throw c.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(i=e-128)){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){if(0!=(i=e-144)){this.pushArrayState(i),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(i=this.readU16())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(221===e){if(0!==(i=this.readU32())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(222===e){if(0!==(i=this.readU16())){this.pushMapState(i),this.complete();continue e}t={}}else if(223===e){if(0!==(i=this.readU32())){this.pushMapState(i),this.complete();continue e}t={}}else if(196===e){var i=this.lookU8();t=this.decodeBinary(i,1)}else if(197===e)i=this.lookU16(),t=this.decodeBinary(i,2);else if(198===e)i=this.lookU32(),t=this.decodeBinary(i,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)i=this.lookU8(),t=this.decodeExtension(i,1);else if(200===e)i=this.lookU16(),t=this.decodeExtension(i,2);else{if(201!==e)throw new x("Unrecognized type byte: ".concat(I(e)));i=this.lookU32(),t=this.decodeExtension(i,4)}this.complete();for(var r=this.stack;r.length>0;){var s=r[r.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;r.pop(),t=s.array}else{if(1===s.type){if(void 0,"string"!=(o=typeof t)&&"number"!==o)throw new x("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new x("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}r.pop(),t=s.map}}return t}var o},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new x("Unrecognized array type byte: ".concat(I(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new x("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new x("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new x("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthy?function(e,t,n){var i=e.subarray(t,t+n);return g.decode(i)}(this.bytes,r,e):f(this.bytes,r,e),this.pos+=t+e,i},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new x("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw G;var n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new x("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=l(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),j={};function q(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function X(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var J=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Y?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function Q(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,i,r;return J(this,(function(s){switch(s.label){case 0:t=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Y(t.read())];case 3:return n=s.sent(),i=n.done,r=n.value,i?[4,Y(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return K(r),[4,Y(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function $(e,t){return void 0===t&&(t=j),n=this,i=void 0,s=function(){var n;return function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]{"use strict";n.r(t),n.d(t,{ACESFilmicToneMapping:()=>ne,AddEquation:()=>E,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>Ct,AdditiveBlending:()=>b,AlphaFormat:()=>Oe,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>nn,AmbientLight:()=>Uu,AmbientLightProbe:()=>td,AnimationClip:()=>cu,AnimationLoader:()=>yu,AnimationMixer:()=>Id,AnimationObjectGroup:()=>Pd,AnimationUtils:()=>Zh,ArcCurve:()=>vc,ArrayCamera:()=>Qa,ArrowHelper:()=>wp,Audio:()=>pd,AudioAnalyser:()=>vd,AudioContext:()=>Qu,AudioListener:()=>dd,AudioLoader:()=>$u,AxesHelper:()=>Mp,AxisHelper:()=>sf,BackSide:()=>m,BasicDepthPacking:()=>Ot,BasicShadowMap:()=>h,BinaryTextureLoader:()=>hf,Bone:()=>Ul,BooleanKeyframeTrack:()=>nu,BoundingBoxHelper:()=>of,Box2:()=>Vd,Box3:()=>ci,Box3Helper:()=>yp,BoxBufferGeometry:()=>cs,BoxGeometry:()=>cs,BoxHelper:()=>gp,BufferAttribute:()=>Er,BufferGeometry:()=>Vr,BufferGeometryLoader:()=>ju,ByteType:()=>Se,Cache:()=>uu,Camera:()=>fs,CameraHelper:()=>pp,CanvasRenderer:()=>df,CanvasTexture:()=>gc,CapsuleBufferGeometry:()=>zc,CapsuleGeometry:()=>zc,CatmullRomCurve3:()=>Ec,CineonToneMapping:()=>te,CircleBufferGeometry:()=>Hc,CircleGeometry:()=>Hc,ClampToEdgeWrapping:()=>ue,Clock:()=>od,Color:()=>jn,ColorKeyframeTrack:()=>iu,ColorManagement:()=>Un,CompressedTexture:()=>mc,CompressedTextureLoader:()=>_u,ConeBufferGeometry:()=>Vc,ConeGeometry:()=>Vc,CubeCamera:()=>ys,CubeReflectionMapping:()=>se,CubeRefractionMapping:()=>oe,CubeTexture:()=>_s,CubeTextureLoader:()=>xu,CubeUVReflectionMapping:()=>ce,CubicBezierCurve:()=>Lc,CubicBezierCurve3:()=>Rc,CubicInterpolant:()=>Qh,CullFaceBack:()=>a,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>o,Curve:()=>yc,CurvePath:()=>Bc,CustomBlending:()=>S,CustomToneMapping:()=>ie,CylinderBufferGeometry:()=>Gc,CylinderGeometry:()=>Gc,Cylindrical:()=>Hd,Data3DTexture:()=>ni,DataArrayTexture:()=>ei,DataTexture:()=>Fl,DataTexture2DArray:()=>wf,DataTexture3D:()=>Mf,DataTextureLoader:()=>bu,DataUtils:()=>Ep,DecrementStencilOp:()=>jt,DecrementWrapStencilOp:()=>Xt,DefaultLoadingManager:()=>pu,DepthFormat:()=>Fe,DepthStencilFormat:()=>ze,DepthTexture:()=>nl,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>hp,DiscreteInterpolant:()=>eu,DodecahedronBufferGeometry:()=>jc,DodecahedronGeometry:()=>jc,DoubleSide:()=>g,DstAlphaFactor:()=>N,DstColorFactor:()=>U,DynamicBufferAttribute:()=>Jp,DynamicCopyUsage:()=>un,DynamicDrawUsage:()=>sn,DynamicReadUsage:()=>ln,EdgesGeometry:()=>Zc,EdgesHelper:()=>af,EllipseCurve:()=>_c,EqualDepth:()=>j,EqualStencilFunc:()=>Kt,EquirectangularReflectionMapping:()=>ae,EquirectangularRefractionMapping:()=>le,Euler:()=>Xi,EventDispatcher:()=>gn,ExtrudeBufferGeometry:()=>Eh,ExtrudeGeometry:()=>Eh,FaceColors:()=>Bp,FileLoader:()=>gu,FlatShading:()=>y,Float16BufferAttribute:()=>Ir,Float32Attribute:()=>nf,Float32BufferAttribute:()=>Or,Float64Attribute:()=>rf,Float64BufferAttribute:()=>kr,FloatType:()=>Le,Fog:()=>ll,FogExp2:()=>al,Font:()=>vf,FontLoader:()=>_f,FramebufferTexture:()=>fc,FrontSide:()=>f,Frustum:()=>Ts,GLBufferAttribute:()=>Nd,GLSL1:()=>pn,GLSL3:()=>fn,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>tn,GreaterStencilFunc:()=>$t,GridHelper:()=>sp,Group:()=>$a,HalfFloatType:()=>Re,HemisphereLight:()=>Su,HemisphereLightHelper:()=>rp,HemisphereLightProbe:()=>ed,IcosahedronBufferGeometry:()=>Ah,IcosahedronGeometry:()=>Ah,ImageBitmapLoader:()=>Zu,ImageLoader:()=>vu,ImageUtils:()=>Xn,ImmediateRenderObject:()=>xf,IncrementStencilOp:()=>Wt,IncrementWrapStencilOp:()=>qt,InstancedBufferAttribute:()=>Vl,InstancedBufferGeometry:()=>Wu,InstancedInterleavedBuffer:()=>kd,InstancedMesh:()=>Jl,Int16Attribute:()=>Qp,Int16BufferAttribute:()=>Lr,Int32Attribute:()=>ef,Int32BufferAttribute:()=>Pr,Int8Attribute:()=>Yp,Int8BufferAttribute:()=>Tr,IntType:()=>Ae,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>dl,Interpolant:()=>Kh,InterpolateDiscrete:()=>bt,InterpolateLinear:()=>wt,InterpolateSmooth:()=>Mt,InvertStencilOp:()=>Jt,JSONLoader:()=>pf,KeepStencilOp:()=>Gt,KeyframeTrack:()=>tu,LOD:()=>Pl,LatheBufferGeometry:()=>Fc,LatheGeometry:()=>Fc,Layers:()=>Ji,LensFlare:()=>mf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>Qt,LessStencilFunc:()=>Zt,Light:()=>Mu,LightProbe:()=>Hu,Line:()=>tc,Line3:()=>qd,LineBasicMaterial:()=>Yl,LineCurve:()=>Pc,LineCurve3:()=>Dc,LineDashedMaterial:()=>Jh,LineLoop:()=>sc,LinePieces:()=>kp,LineSegments:()=>rc,LineStrip:()=>Op,LinearEncoding:()=>Dt,LinearFilter:()=>_e,LinearInterpolant:()=>$h,LinearMipMapLinearFilter:()=>we,LinearMipMapNearestFilter:()=>xe,LinearMipmapLinearFilter:()=>be,LinearMipmapNearestFilter:()=>ve,LinearSRGBColorSpace:()=>zt,LinearToneMapping:()=>$,Loader:()=>fu,LoaderUtils:()=>Vu,LoadingManager:()=>du,LoopOnce:()=>_t,LoopPingPong:()=>xt,LoopRepeat:()=>vt,LuminanceAlphaFormat:()=>Ue,LuminanceFormat:()=>Be,MOUSE:()=>r,Material:()=>br,MaterialLoader:()=>Gu,Math:()=>Cn,MathUtils:()=>Cn,Matrix3:()=>Rn,Matrix4:()=>Bi,MaxEquation:()=>L,Mesh:()=>as,MeshBasicMaterial:()=>wr,MeshDepthMaterial:()=>qa,MeshDistanceMaterial:()=>Xa,MeshFaceMaterial:()=>Fp,MeshLambertMaterial:()=>qh,MeshMatcapMaterial:()=>Xh,MeshNormalMaterial:()=>jh,MeshPhongMaterial:()=>Vh,MeshPhysicalMaterial:()=>Gh,MeshStandardMaterial:()=>Hh,MeshToonMaterial:()=>Wh,MinEquation:()=>C,MirroredRepeatWrapping:()=>de,MixOperation:()=>Z,MultiMaterial:()=>zp,MultiplyBlending:()=>M,MultiplyOperation:()=>Y,NearestFilter:()=>pe,NearestMipMapLinearFilter:()=>ye,NearestMipMapNearestFilter:()=>me,NearestMipmapLinearFilter:()=>ge,NearestMipmapNearestFilter:()=>fe,NeverDepth:()=>H,NeverStencilFunc:()=>Yt,NoBlending:()=>v,NoColorSpace:()=>Ut,NoColors:()=>Np,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>At,NormalBlending:()=>x,NotEqualDepth:()=>J,NotEqualStencilFunc:()=>en,NumberKeyframeTrack:()=>ru,Object3D:()=>lr,ObjectLoader:()=>qu,ObjectSpaceNormalMap:()=>Bt,OctahedronBufferGeometry:()=>Ch,OctahedronGeometry:()=>Ch,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>B,OneMinusDstColorFactor:()=>F,OneMinusSrcAlphaFactor:()=>k,OneMinusSrcColorFactor:()=>I,OrthographicCamera:()=>Fs,PCFShadowMap:()=>u,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>Xs,ParametricGeometry:()=>gf,Particle:()=>Gp,ParticleBasicMaterial:()=>jp,ParticleSystem:()=>Vp,ParticleSystemMaterial:()=>qp,Path:()=>Uc,PerspectiveCamera:()=>ms,Plane:()=>Ms,PlaneBufferGeometry:()=>Ls,PlaneGeometry:()=>Ls,PlaneHelper:()=>_p,PointCloud:()=>Hp,PointCloudMaterial:()=>Wp,PointLight:()=>ku,PointLightHelper:()=>ep,Points:()=>uc,PointsMaterial:()=>oc,PolarGridHelper:()=>op,PolyhedronBufferGeometry:()=>Wc,PolyhedronGeometry:()=>Wc,PositionalAudio:()=>_d,PropertyBinding:()=>Rd,PropertyMixer:()=>xd,QuadraticBezierCurve:()=>Ic,QuadraticBezierCurve3:()=>Oc,Quaternion:()=>si,QuaternionKeyframeTrack:()=>ou,QuaternionLinearInterpolant:()=>su,REVISION:()=>i,RGBADepthPacking:()=>kt,RGBAFormat:()=>Ne,RGBAIntegerFormat:()=>je,RGBA_ASTC_10x10_Format:()=>ft,RGBA_ASTC_10x5_Format:()=>ut,RGBA_ASTC_10x6_Format:()=>dt,RGBA_ASTC_10x8_Format:()=>pt,RGBA_ASTC_12x10_Format:()=>mt,RGBA_ASTC_12x12_Format:()=>gt,RGBA_ASTC_4x4_Format:()=>it,RGBA_ASTC_5x4_Format:()=>rt,RGBA_ASTC_5x5_Format:()=>st,RGBA_ASTC_6x5_Format:()=>ot,RGBA_ASTC_6x6_Format:()=>at,RGBA_ASTC_8x5_Format:()=>lt,RGBA_ASTC_8x6_Format:()=>ct,RGBA_ASTC_8x8_Format:()=>ht,RGBA_BPTC_Format:()=>yt,RGBA_ETC2_EAC_Format:()=>nt,RGBA_PVRTC_2BPPV1_Format:()=>$e,RGBA_PVRTC_4BPPV1_Format:()=>Qe,RGBA_S3TC_DXT1_Format:()=>Xe,RGBA_S3TC_DXT3_Format:()=>Je,RGBA_S3TC_DXT5_Format:()=>Ye,RGBFormat:()=>ke,RGB_ETC1_Format:()=>et,RGB_ETC2_Format:()=>tt,RGB_PVRTC_2BPPV1_Format:()=>Ke,RGB_PVRTC_4BPPV1_Format:()=>Ze,RGB_S3TC_DXT1_Format:()=>qe,RGFormat:()=>Ve,RGIntegerFormat:()=>We,RawShaderMaterial:()=>zh,Ray:()=>Ni,Raycaster:()=>Bd,RectAreaLight:()=>Fu,RedFormat:()=>He,RedIntegerFormat:()=>Ge,ReinhardToneMapping:()=>ee,RepeatWrapping:()=>he,ReplaceStencilOp:()=>Vt,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>Lh,RingGeometry:()=>Lh,SRGBColorSpace:()=>Ft,Scene:()=>cl,SceneUtils:()=>ff,ShaderChunk:()=>Rs,ShaderLib:()=>Ds,ShaderMaterial:()=>ps,ShadowMaterial:()=>Fh,Shape:()=>Kc,ShapeBufferGeometry:()=>Rh,ShapeGeometry:()=>Rh,ShapePath:()=>Sp,ShapeUtils:()=>wh,ShortType:()=>Ee,Skeleton:()=>Gl,SkeletonHelper:()=>Qd,SkinnedMesh:()=>Bl,SmoothShading:()=>_,Source:()=>Jn,Sphere:()=>Ci,SphereBufferGeometry:()=>Ph,SphereGeometry:()=>Ph,Spherical:()=>zd,SphericalHarmonics3:()=>zu,SplineCurve:()=>kc,SpotLight:()=>Ru,SpotLightHelper:()=>Jd,Sprite:()=>Al,SpriteMaterial:()=>pl,SrcAlphaFactor:()=>O,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>D,StaticCopyUsage:()=>hn,StaticDrawUsage:()=>rn,StaticReadUsage:()=>an,StereoCamera:()=>sd,StreamCopyUsage:()=>dn,StreamDrawUsage:()=>on,StreamReadUsage:()=>cn,StringKeyframeTrack:()=>au,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>s,TangentSpaceNormalMap:()=>Nt,TetrahedronBufferGeometry:()=>Dh,TetrahedronGeometry:()=>Dh,TextGeometry:()=>yf,Texture:()=>Kn,TextureLoader:()=>wu,TorusBufferGeometry:()=>Ih,TorusGeometry:()=>Ih,TorusKnotBufferGeometry:()=>Oh,TorusKnotGeometry:()=>Oh,Triangle:()=>vr,TriangleFanDrawMode:()=>Pt,TriangleStripDrawMode:()=>Rt,TrianglesDrawMode:()=>Lt,TubeBufferGeometry:()=>kh,TubeGeometry:()=>kh,UVMapping:()=>re,Uint16Attribute:()=>$p,Uint16BufferAttribute:()=>Rr,Uint32Attribute:()=>tf,Uint32BufferAttribute:()=>Dr,Uint8Attribute:()=>Zp,Uint8BufferAttribute:()=>Ar,Uint8ClampedAttribute:()=>Kp,Uint8ClampedBufferAttribute:()=>Cr,Uniform:()=>Od,UniformsLib:()=>Ps,UniformsUtils:()=>ds,UnsignedByteType:()=>Me,UnsignedInt248Type:()=>Ie,UnsignedIntType:()=>Ce,UnsignedShort4444Type:()=>Pe,UnsignedShort5551Type:()=>De,UnsignedShortType:()=>Te,VSMShadowMap:()=>p,Vector2:()=>Ln,Vector3:()=>oi,Vector4:()=>Qn,VectorKeyframeTrack:()=>lu,Vertex:()=>Xp,VertexColors:()=>Up,VideoTexture:()=>pc,WebGL1Renderer:()=>ol,WebGL3DRenderTarget:()=>ii,WebGLArrayRenderTarget:()=>ti,WebGLCubeRenderTarget:()=>vs,WebGLMultipleRenderTargets:()=>ri,WebGLMultisampleRenderTarget:()=>bf,WebGLRenderTarget:()=>$n,WebGLRenderTargetCube:()=>uf,WebGLRenderer:()=>sl,WebGLUtils:()=>Ka,WireframeGeometry:()=>Nh,WireframeHelper:()=>lf,WrapAroundEnding:()=>Tt,XHRLoader:()=>cf,ZeroCurvatureEnding:()=>St,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Et,ZeroStencilOp:()=>Ht,_SRGBAFormat:()=>mn,sRGBEncoding:()=>It});const i="140",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,a=1,l=2,c=3,h=0,u=1,d=2,p=3,f=0,m=1,g=2,y=1,_=2,v=0,x=1,b=2,w=3,M=4,S=5,E=100,T=101,A=102,C=103,L=104,R=200,P=201,D=202,I=203,O=204,k=205,N=206,B=207,U=208,F=209,z=210,H=0,G=1,V=2,W=3,j=4,q=5,X=6,J=7,Y=0,Z=1,K=2,Q=0,$=1,ee=2,te=3,ne=4,ie=5,re=300,se=301,oe=302,ae=303,le=304,ce=306,he=1e3,ue=1001,de=1002,pe=1003,fe=1004,me=1004,ge=1005,ye=1005,_e=1006,ve=1007,xe=1007,be=1008,we=1008,Me=1009,Se=1010,Ee=1011,Te=1012,Ae=1013,Ce=1014,Le=1015,Re=1016,Pe=1017,De=1018,Ie=1020,Oe=1021,ke=1022,Ne=1023,Be=1024,Ue=1025,Fe=1026,ze=1027,He=1028,Ge=1029,Ve=1030,We=1031,je=1033,qe=33776,Xe=33777,Je=33778,Ye=33779,Ze=35840,Ke=35841,Qe=35842,$e=35843,et=36196,tt=37492,nt=37496,it=37808,rt=37809,st=37810,ot=37811,at=37812,lt=37813,ct=37814,ht=37815,ut=37816,dt=37817,pt=37818,ft=37819,mt=37820,gt=37821,yt=36492,_t=2200,vt=2201,xt=2202,bt=2300,wt=2301,Mt=2302,St=2400,Et=2401,Tt=2402,At=2500,Ct=2501,Lt=0,Rt=1,Pt=2,Dt=3e3,It=3001,Ot=3200,kt=3201,Nt=0,Bt=1,Ut="",Ft="srgb",zt="srgb-linear",Ht=0,Gt=7680,Vt=7681,Wt=7682,jt=7683,qt=34055,Xt=34056,Jt=5386,Yt=512,Zt=513,Kt=514,Qt=515,$t=516,en=517,tn=518,nn=519,rn=35044,sn=35048,on=35040,an=35045,ln=35049,cn=35041,hn=35046,un=35050,dn=35042,pn="100",fn="300 es",mn=1035;class gn{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+yn[e>>16&255]+yn[e>>24&255]+"-"+yn[255&t]+yn[t>>8&255]+"-"+yn[t>>16&15|64]+yn[t>>24&255]+"-"+yn[63&n|128]+yn[n>>8&255]+"-"+yn[n>>16&255]+yn[n>>24&255]+yn[255&i]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function wn(e,t,n){return Math.max(t,Math.min(n,e))}function Mn(e,t){return(e%t+t)%t}function Sn(e,t,n){return(1-n)*e+n*t}function En(e){return 0==(e&e-1)&&0!==e}function Tn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function An(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Cn=Object.freeze({__proto__:null,DEG2RAD:vn,RAD2DEG:xn,generateUUID:bn,clamp:wn,euclideanModulo:Mn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Sn,damp:function(e,t,n,i){return Sn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Mn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_n=e);let t=_n+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*vn},radToDeg:function(e){return e*xn},isPowerOfTwo:En,ceilPowerOfTwo:Tn,floorPowerOfTwo:An,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),u=s((t-i)/2),d=o((t-i)/2),p=s((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}},denormalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}});class Ln{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ln.prototype.isVector2=!0;class Rn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],x=i[2],b=i[5],w=i[8];return r[0]=s*f+o*y+a*x,r[3]=s*m+o*_+a*b,r[6]=s*g+o*v+a*w,r[1]=l*f+c*y+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*v+h*w,r[2]=u*f+d*y+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*v+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*s)*f,e[3]=u*f,e[4]=(c*t-i*a)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(s*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*r+n*a,i[3]=t*s+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*a,i[4]=-n*s+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Pn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}Rn.prototype.isMatrix3=!0;const Dn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function In(e,t){return new Dn[e](t)}function On(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function kn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Nn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}const Bn={[Ft]:{[zt]:kn},[zt]:{[Ft]:Nn}},Un={legacyMode:!0,get workingColorSpace(){return zt},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Bn[t]&&void 0!==Bn[t][n]){const i=Bn[t][n];return e.r=i(e.r),e.g=i(e.g),e.b=i(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Fn={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},zn={r:0,g:0,b:0},Hn={h:0,s:0,l:0},Gn={h:0,s:0,l:0};function Vn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Wn(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class jn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Un.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=zt){return this.r=e,this.g=t,this.b=n,Un.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=zt){if(e=Mn(e,1),t=wn(t,0,1),n=wn(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Vn(r,i,e+1/3),this.g=Vn(r,i,e),this.b=Vn(r,i,e-1/3)}return Un.toWorkingColorSpace(this,i),this}setStyle(e,t=Ft){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,Un.toWorkingColorSpace(this,t),n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,Un.toWorkingColorSpace(this,t),n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return n(e[4]),this.setHSL(i,r,s,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=i[1],n=e.length;if(3===n)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,Un.toWorkingColorSpace(this,t),this;if(6===n)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,Un.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ft){const n=Fn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=Nn(e.r),this.g=Nn(e.g),this.b=Nn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ft){return Un.fromWorkingColorSpace(Wn(this,zn),e),wn(255*zn.r,0,255)<<16^wn(255*zn.g,0,255)<<8^wn(255*zn.b,0,255)<<0}getHexString(e=Ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=zt){Un.fromWorkingColorSpace(Wn(this,zn),t);const n=zn.r,i=zn.g,r=zn.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=On("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case ue:e.x=e.x<0?0:1;break;case de:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case he:e.y=e.y-Math.floor(e.y);break;case ue:e.y=e.y<0?0:1;break;case de:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}Kn.DEFAULT_IMAGE=null,Kn.DEFAULT_MAPPING=re,Kn.prototype.isTexture=!0;class Qn{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)a&&e>y?ey?a=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}si.prototype.isQuaternion=!0;class oi{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(li.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(li.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=a*t+s*i-o*n,c=a*n+o*t-r*i,h=a*i+r*n-s*t,u=-r*t-s*n-o*i;return this.x=l*a+u*-r+c*-o-h*-s,this.y=c*a+u*-s+h*-r-l*-o,this.z=h*a+u*-o+l*-s-c*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ai.copy(this).projectOnVector(e),this.sub(ai)}reflect(e){return this.sub(ai.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}oi.prototype.isVector3=!0;const ai=new oi,li=new si;class ci{constructor(e=new oi(1/0,1/0,1/0),t=new oi(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.length;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.count;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ui),ui.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vi),xi.subVectors(this.max,vi),pi.subVectors(e.a,vi),fi.subVectors(e.b,vi),mi.subVectors(e.c,vi),gi.subVectors(fi,pi),yi.subVectors(mi,fi),_i.subVectors(pi,mi);let t=[0,-gi.z,gi.y,0,-yi.z,yi.y,0,-_i.z,_i.y,gi.z,0,-gi.x,yi.z,0,-yi.x,_i.z,0,-_i.x,-gi.y,gi.x,0,-yi.y,yi.x,0,-_i.y,_i.x,0];return!!Mi(t,pi,fi,mi,xi)&&(t=[1,0,0,0,1,0,0,0,1],!!Mi(t,pi,fi,mi,xi)&&(bi.crossVectors(gi,yi),t=[bi.x,bi.y,bi.z],Mi(t,pi,fi,mi,xi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ui.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ui).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(hi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ci.prototype.isBox3=!0;const hi=[new oi,new oi,new oi,new oi,new oi,new oi,new oi,new oi],ui=new oi,di=new ci,pi=new oi,fi=new oi,mi=new oi,gi=new oi,yi=new oi,_i=new oi,vi=new oi,xi=new oi,bi=new oi,wi=new oi;function Mi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){wi.fromArray(e,s);const o=r.x*Math.abs(wi.x)+r.y*Math.abs(wi.y)+r.z*Math.abs(wi.z),a=t.dot(wi),l=n.dot(wi),c=i.dot(wi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Si=new ci,Ei=new oi,Ti=new oi,Ai=new oi;class Ci{constructor(e=new oi,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Si.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ai.subVectors(e,this.center);const t=Ai.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ai.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?Ti.set(0,0,1).multiplyScalar(e.radius):Ti.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ei.copy(e.center).add(Ti)),this.expandByPoint(Ei.copy(e.center).sub(Ti)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Li=new oi,Ri=new oi,Pi=new oi,Di=new oi,Ii=new oi,Oi=new oi,ki=new oi;class Ni{constructor(e=new oi,t=new oi(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Li.copy(this.direction).multiplyScalar(t).add(this.origin),Li.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ri.copy(e).add(t).multiplyScalar(.5),Pi.copy(t).sub(e).normalize(),Di.copy(this.origin).sub(Ri);const r=.5*e.distanceTo(t),s=-this.direction.dot(Pi),o=Di.dot(this.direction),a=-Di.dot(Pi),l=Di.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Pi).multiplyScalar(u).add(Ri),d}intersectSphere(e,t){Li.subVectors(e.center,this.origin);const n=Li.dot(this.direction),i=Li.dot(Li)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,s=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,s=(e.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Li)}intersectTriangle(e,t,n,i,r){Ii.subVectors(t,e),Oi.subVectors(n,e),ki.crossVectors(Ii,Oi);let s,o=this.direction.dot(ki);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Di.subVectors(this.origin,e);const a=s*this.direction.dot(Oi.crossVectors(Di,Oi));if(a<0)return null;const l=s*this.direction.dot(Ii.cross(Di));if(l<0)return null;if(a+l>o)return null;const c=-s*Di.dot(ki);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Bi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Bi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ui.setFromMatrixColumn(e,0).length(),r=1/Ui.setFromMatrixColumn(e,1).length(),s=1/Ui.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zi,e,Hi)}lookAt(e,t,n){const i=this.elements;return Wi.subVectors(e,t),0===Wi.lengthSq()&&(Wi.z=1),Wi.normalize(),Gi.crossVectors(n,Wi),0===Gi.lengthSq()&&(1===Math.abs(n.z)?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),Gi.crossVectors(n,Wi)),Gi.normalize(),Vi.crossVectors(Wi,Gi),i[0]=Gi.x,i[4]=Vi.x,i[8]=Wi.x,i[1]=Gi.y,i[5]=Vi.y,i[9]=Wi.y,i[2]=Gi.z,i[6]=Vi.z,i[10]=Wi.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],C=i[13],L=i[2],R=i[6],P=i[10],D=i[14],I=i[3],O=i[7],k=i[11],N=i[15];return r[0]=s*b+o*E+a*L+l*I,r[4]=s*w+o*T+a*R+l*O,r[8]=s*M+o*A+a*P+l*k,r[12]=s*S+o*C+a*D+l*N,r[1]=c*b+h*E+u*L+d*I,r[5]=c*w+h*T+u*R+d*O,r[9]=c*M+h*A+u*P+d*k,r[13]=c*S+h*C+u*D+d*N,r[2]=p*b+f*E+m*L+g*I,r[6]=p*w+f*T+m*R+g*O,r[10]=p*M+f*A+m*P+g*k,r[14]=p*S+f*C+m*D+g*N,r[3]=y*b+_*E+v*L+x*I,r[7]=y*w+_*T+v*R+x*O,r[11]=y*M+_*A+v*P+x*k,r[15]=y*S+_*C+v*D+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-i*l*h-r*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*s*h-n*s*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=h*m*l-f*u*l+f*a*d-o*m*d-h*a*g+o*u*g,_=p*u*l-c*m*l-p*a*d+s*m*d+c*a*g-s*u*g,v=c*f*l-p*h*l+p*o*d-s*f*d-c*o*g+s*h*g,x=p*h*a-c*f*a-p*o*u+s*f*u+c*o*m-s*h*m,b=t*y+n*_+i*v+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,e[2]=(o*m*r-f*a*r+f*i*l-n*m*l-o*i*g+n*a*g)*w,e[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=_*w,e[5]=(c*m*r-p*u*r+p*i*d-t*m*d-c*i*g+t*u*g)*w,e[6]=(p*a*r-s*m*r-p*i*l+t*m*l+s*i*g-t*a*g)*w,e[7]=(s*u*r-c*a*r+c*i*l-t*u*l-s*i*d+t*a*d)*w,e[8]=v*w,e[9]=(p*h*r-c*f*r-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(s*f*r-p*o*r+p*n*l-t*f*l-s*n*g+t*o*g)*w,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*f*i-p*h*i+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*o*i-s*f*i-p*n*a+t*f*a+s*n*m-t*o*m)*w,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=o*h,y=a*l,_=a*c,v=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+v)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(u+g))*b,i[6]=(m+y)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-y)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ui.set(i[0],i[1],i[2]).length();const s=Ui.set(i[4],i[5],i[6]).length(),o=Ui.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Fi.copy(this);const a=1/r,l=1/s,c=1/o;return Fi.elements[0]*=a,Fi.elements[1]*=a,Fi.elements[2]*=a,Fi.elements[4]*=l,Fi.elements[5]*=l,Fi.elements[6]*=l,Fi.elements[8]*=c,Fi.elements[9]*=c,Fi.elements[10]*=c,t.setFromRotationMatrix(Fi),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,s){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(s-r),h=(t+e)*a,u=(n+i)*l,d=(s+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Bi.prototype.isMatrix4=!0;const Ui=new oi,Fi=new Bi,zi=new oi(0,0,0),Hi=new oi(1,1,1),Gi=new oi,Vi=new oi,Wi=new oi,ji=new Bi,qi=new si;class Xi{constructor(e=0,t=0,n=0,i=Xi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(wn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-wn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(wn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-wn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-wn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ji.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ji,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qi.setFromEuler(this),this.setFromQuaternion(qi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xi.prototype.isEuler=!0,Xi.DefaultOrder="XYZ",Xi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ji{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){cr.subVectors(i,t),hr.subVectors(n,t),ur.subVectors(e,t);const s=cr.dot(cr),o=cr.dot(hr),a=cr.dot(ur),l=hr.dot(hr),c=hr.dot(ur),h=s*l-o*o;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,dr),dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getUV(e,t,n,i,r,s,o,a){return this.getBarycoord(e,t,n,i,dr),a.set(0,0),a.addScaledVector(r,dr.x),a.addScaledVector(s,dr.y),a.addScaledVector(o,dr.z),a}static isFrontFacing(e,t,n,i){return cr.subVectors(n,t),hr.subVectors(e,t),cr.cross(hr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return cr.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),.5*cr.cross(hr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return vr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return vr.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;pr.subVectors(i,n),fr.subVectors(r,n),gr.subVectors(e,n);const a=pr.dot(gr),l=fr.dot(gr);if(a<=0&&l<=0)return t.copy(n);yr.subVectors(e,i);const c=pr.dot(yr),h=fr.dot(yr);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(pr,s);_r.subVectors(e,r);const d=pr.dot(_r),p=fr.dot(_r);if(p>=0&&d<=p)return t.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fr,o);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return mr.subVectors(r,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(mr,o);const g=1/(m+f+u);return s=f*g,o=u*g,t.copy(n).addScaledVector(pr,s).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let xr=0;class br extends gn{constructor(){super(),Object.defineProperty(this,"id",{value:xr++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=O,this.blendDst=k,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=nn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gt,this.stencilZFail=Gt,this.stencilZPass=Gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===y;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==f&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}br.prototype.isMaterial=!0,br.fromType=function(){return null};class wr extends br{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}wr.prototype.isMeshBasicMaterial=!0;const Mr=new oi,Sr=new Ln;class Er{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(r),!1===e.ray.intersectsSphere(qr))return;if(Wr.copy(r).invert(),jr.copy(e.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===jr.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:os.clone(),object:e}}(e,t,n,i,Xr,Jr,Yr,ss);if(p){a&&(ns.fromBufferAttribute(a,c),is.fromBufferAttribute(a,h),rs.fromBufferAttribute(a,u),p.uv=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln)),l&&(ns.fromBufferAttribute(l,c),is.fromBufferAttribute(l,h),rs.fromBufferAttribute(l,u),p.uv2=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln));const e={a:c,b:h,c:u,normal:new oi,materialIndex:0};vr.getNormal(Xr,Jr,Yr,e.normal),p.face=e}return p}as.prototype.isMesh=!0;class cs extends Vr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,i,r,s,p,f,m,g,y){const _=s/m,v=p/g,x=s/2,b=p/2,w=f/2,M=m+1,S=g+1;let E=0,T=0;const A=new oi;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}ps.prototype.isShaderMaterial=!0;class fs extends lr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Bi,this.projectionMatrix=new Bi,this.projectionMatrixInverse=new Bi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}fs.prototype.isCamera=!0;class ms extends fs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*xn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*vn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*xn*Math.atan(Math.tan(.5*vn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*vn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}ms.prototype.isPerspectiveCamera=!0;const gs=90;class ys extends lr{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ms(gs,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new oi(1,0,0)),this.add(i);const r=new ms(gs,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new oi(-1,0,0)),this.add(r);const s=new ms(gs,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new oi(0,1,0)),this.add(s);const o=new ms(gs,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new oi(0,-1,0)),this.add(o);const a=new ms(gs,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new oi(0,0,1)),this.add(a);const l=new ms(gs,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new oi(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,c=e.getRenderTarget(),h=e.toneMapping,u=e.xr.enabled;e.toneMapping=Q,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=h,e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class _s extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:se,n,i,r,s,o,a,l,c),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}_s.prototype.isCubeTexture=!0;class vs extends $n{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new _s(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:_e}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new cs(5,5,5),o=new ps({name:"CubemapFromEquirect",uniforms:hs(n),vertexShader:i,fragmentShader:r,side:m,blending:v});o.uniforms.tEquirect.value=t;const a=new as(s,o),l=t.minFilter;return t.minFilter===be&&(t.minFilter=_e),new ys(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}vs.prototype.isWebGLCubeRenderTarget=!0;const xs=new oi,bs=new oi,ws=new Rn;class Ms{constructor(e=new oi(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=xs.subVectors(n,t).cross(bs.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(xs),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ws.getNormalMatrix(e),i=this.coplanarPoint(xs).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Ms.prototype.isPlane=!0;const Ss=new Ci,Es=new oi;class Ts{constructor(e=new Ms,t=new Ms,n=new Ms,i=new Ms,r=new Ms,s=new Ms){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],_=n[15];return t[0].setComponents(o-i,h-a,f-u,_-m).normalize(),t[1].setComponents(o+i,h+a,f+u,_+m).normalize(),t[2].setComponents(o+r,h+l,f+d,_+g).normalize(),t[3].setComponents(o-r,h-l,f-d,_-g).normalize(),t[4].setComponents(o-s,h-c,f-p,_-y).normalize(),t[5].setComponents(o+s,h+c,f+p,_+y).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ss.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(e){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Es.y=i.normal.y>0?e.max.y:e.min.y,Es.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Es)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Cs(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 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}\nfloat 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}\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\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; }\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 color ) { return dot( color, vec3( 0.3333 ) ); }\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};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.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}",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\tvec2 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 r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), 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_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 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, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( 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}",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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\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 )\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 )\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:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, 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#if defined( 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, 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#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\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\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_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\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 ( PHYSICALLY_CORRECT_LIGHTS )\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#else\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#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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\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 GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\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_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, 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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\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 ], geometry.normal );\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, vUv2 );\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( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\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#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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\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_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\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, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\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\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\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 = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\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 OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - 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_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, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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\tvarying vec4 vSpotShadowCoord[ 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#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\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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, vSpotShadowCoord[ 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\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\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, vUv );\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 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}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\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\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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\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;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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, vUv2 );\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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \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 + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Ps={common:{diffuse:{value:new jn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Rn},uv2Transform:{value:new Rn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ln(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new jn(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 jn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}},sprite:{diffuse:{value:new jn(16777215)},opacity:{value:1},center:{value:new Ln(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}}},Ds={basic:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.fog]),vertexShader:Rs.meshbasic_vert,fragmentShader:Rs.meshbasic_frag},lambert:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshlambert_vert,fragmentShader:Rs.meshlambert_frag},phong:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},specular:{value:new jn(1118481)},shininess:{value:30}}]),vertexShader:Rs.meshphong_vert,fragmentShader:Rs.meshphong_frag},standard:{uniforms:us([Ps.common,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.roughnessmap,Ps.metalnessmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag},toon:{uniforms:us([Ps.common,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.gradientmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshtoon_vert,fragmentShader:Rs.meshtoon_frag},matcap:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,{matcap:{value:null}}]),vertexShader:Rs.meshmatcap_vert,fragmentShader:Rs.meshmatcap_frag},points:{uniforms:us([Ps.points,Ps.fog]),vertexShader:Rs.points_vert,fragmentShader:Rs.points_frag},dashed:{uniforms:us([Ps.common,Ps.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Rs.linedashed_vert,fragmentShader:Rs.linedashed_frag},depth:{uniforms:us([Ps.common,Ps.displacementmap]),vertexShader:Rs.depth_vert,fragmentShader:Rs.depth_frag},normal:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,{opacity:{value:1}}]),vertexShader:Rs.meshnormal_vert,fragmentShader:Rs.meshnormal_frag},sprite:{uniforms:us([Ps.sprite,Ps.fog]),vertexShader:Rs.sprite_vert,fragmentShader:Rs.sprite_frag},background:{uniforms:{uvTransform:{value:new Rn},t2D:{value:null}},vertexShader:Rs.background_vert,fragmentShader:Rs.background_frag},cube:{uniforms:us([Ps.envmap,{opacity:{value:1}}]),vertexShader:Rs.cube_vert,fragmentShader:Rs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Rs.equirect_vert,fragmentShader:Rs.equirect_frag},distanceRGBA:{uniforms:us([Ps.common,Ps.displacementmap,{referencePosition:{value:new oi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Rs.distanceRGBA_vert,fragmentShader:Rs.distanceRGBA_frag},shadow:{uniforms:us([Ps.lights,Ps.fog,{color:{value:new jn(0)},opacity:{value:1}}]),vertexShader:Rs.shadow_vert,fragmentShader:Rs.shadow_frag}};function Is(e,t,n,i,r,s){const o=new jn(0);let a,l,c=!0===r?0:1,h=null,u=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,p(o,c)},render:function(n,r){let s=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const y=e.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(g=null),null===g?p(o,c):g&&g.isColor&&(p(g,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===ce)?(void 0===l&&(l=new as(new cs(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:hs(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,h===g&&u===g.version&&d===e.toneMapping||(l.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new as(new Ls(2,2),new ps({name:"BackgroundMaterial",uniforms:hs(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&u===g.version&&d===e.toneMapping||(a.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),a.layers.enableAll(),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Os(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},l=p(null);let c=l,h=!1;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){const t=[],n=[],i=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return c.attributesNum!==o||c.index!==i}(r,v,d,x),b&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const a=n.getAttributes();for(const t in a)if(a[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}c.attributes=r,c.attributesNum=o,c.index=i}(r,v,d,x)}else{const e=!0===l.wireframe;c.geometry===v.id&&c.program===d.id&&c.wireframe===e||(c.geometry=v.id,c.program=d.id,c.wireframe=e,b=!0)}null!==x&&n.update(x,34963),(b||h)&&(h=!1,function(r,s,o,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();const l=a.attributes,c=o.getAttributes(),h=s.defaultAttributeValues;for(const t in c){const i=c[t];if(i.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,o=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=s||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),y=e.getParameter(36349),_=u>0,v=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:_,floatFragmentTextures:v,floatVertexTextures:_&&v,maxSamples:s?e.getParameter(36183):0}}function Bs(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new Ms,a=new Rn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length0){const o=new vs(s.height/2);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Ds.physical={uniforms:us([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ln(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new jn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ln},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new jn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new jn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag};class Fs extends fs{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Fs.prototype.isOrthographicCamera=!0;const zs=[.125,.215,.35,.446,.526,.582],Hs=new Fs,Gs=new jn;let Vs=null;const Ws=(1+Math.sqrt(5))/2,js=1/Ws,qs=[new oi(1,1,1),new oi(-1,1,1),new oi(1,1,-1),new oi(-1,1,-1),new oi(0,Ws,js),new oi(0,Ws,-js),new oi(js,0,Ws),new oi(-js,0,Ws),new oi(Ws,js,0),new oi(-Ws,js,0)];class Xs{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Vs=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ks(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Zs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?a=zs[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,y=new Float32Array(f*p*d),_=new Float32Array(m*p*d),v=new Float32Array(g*p*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];y.set(i,f*p*e),_.set(u,m*p*e);const r=[e,e,e,e,e,e];v.set(r,g*p*e)}const x=new Vr;x.setAttribute("position",new Er(y,f)),x.setAttribute("uv",new Er(_,m)),x.setAttribute("faceIndex",new Er(v,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new oi(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new as(this._lodPlanes[0],e);this._renderer.compile(t,Hs)}_sceneToCubeUV(e,t,n,i){const r=new ms(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(Gs),a.toneMapping=Q,a.autoClear=!1;const h=new wr({name:"PMREM.Background",side:m,depthWrite:!1,depthTest:!1}),u=new as(new cs,h);let d=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(Gs),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ys(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(e,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===se||e.mapping===oe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ks()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Zs());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new as(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ys(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Hs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ey-4?i-y+4:0),4*(this._cubeSize-_),3*_,2*_),a.setRenderTarget(t),a.render(c,Hs)}}function Js(e,t,n){const i=new $n(e,t,n);return i.texture.mapping=ce,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ys(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Zs(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}function Ks(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\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",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:v,depthTest:!1,depthWrite:!1})}function Qs(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ae||s===le,a=s===se||s===oe;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new Xs(e)),i=o?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new Xs(e));const s=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $s(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function eo(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);const m=new Float32Array(p*f*4*r),g=new ei(m,p,f,r);g.type=Le,g.needsUpdate=!0;const y=4*d;for(let t=0;t0)return e;const r=t*n;let s=po[r];if(void 0===s&&(s=new Float32Array(r),po[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function vo(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function wa(e){return e.replace(ba,Ma)}function Ma(e,t){const n=Rs[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return wa(n)}const Sa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ea=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ta(e){return e.replace(Ea,Ca).replace(Sa,Aa)}function Aa(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ca(0,t,n,i)}function Ca(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(v+="\n"),x=[g,y].filter(_a).join("\n"),x.length>0&&(x+="\n")):(v=[La(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(_a).join("\n"),x=[g,La(n),"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Rs.tonemapping_pars_fragment:"",n.toneMapping!==Q?ya("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Rs.encodings_pars_fragment,ga("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_a).join("\n")),o=wa(o),o=va(o,n),o=xa(o,n),a=wa(a),a=va(a,n),a=xa(a,n),o=Ta(o),a=Ta(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+v,x=["#define varying in",n.glslVersion===fn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,M=pa(r,35633,b+v+o),S=pa(r,35632,w);if(r.attachShader(_,M),r.attachShader(_,S),void 0!==n.index0AttributeName?r.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(_).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(_,35714)){i=!1;const t=ma(r,M,"vertex"),n=ma(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:v},fragmentShader:{log:n,prefix:x}})}let E,T;return r.deleteShader(M),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new da(r,_)),E},this.getAttributes=function(){return void 0===T&&(T=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,k=s.clearcoat>0;return{isWebGL2:h,shaderID:E,shaderName:s.type,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:d,outputEncoding:null===I?e.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:Dt,map:!!s.map,matcap:!!s.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===Bt,tangentSpaceNormalMap:s.normalMapType===Nt,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===It,clearcoat:k,clearcoatMap:k&&!!s.clearcoatMap,clearcoatRoughnessMap:k&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:k&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===x,alphaMap:!!s.alphaMap,alphaTest:O,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:A,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===g,flipSided:s.side===m,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0),t.supportsVertexTextures&&a.enable(1),t.instancing&&a.enable(2),t.instancingColor&&a.enable(3),t.map&&a.enable(4),t.matcap&&a.enable(5),t.envMap&&a.enable(6),t.lightMap&&a.enable(7),t.aoMap&&a.enable(8),t.emissiveMap&&a.enable(9),t.bumpMap&&a.enable(10),t.normalMap&&a.enable(11),t.objectSpaceNormalMap&&a.enable(12),t.tangentSpaceNormalMap&&a.enable(13),t.clearcoat&&a.enable(14),t.clearcoatMap&&a.enable(15),t.clearcoatRoughnessMap&&a.enable(16),t.clearcoatNormalMap&&a.enable(17),t.displacementMap&&a.enable(18),t.specularMap&&a.enable(19),t.roughnessMap&&a.enable(20),t.metalnessMap&&a.enable(21),t.gradientMap&&a.enable(22),t.alphaMap&&a.enable(23),t.alphaTest&&a.enable(24),t.vertexColors&&a.enable(25),t.vertexAlphas&&a.enable(26),t.vertexUvs&&a.enable(27),t.vertexTangents&&a.enable(28),t.uvsVertexOnly&&a.enable(29),t.fog&&a.enable(30),e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0),t.flatShading&&a.enable(1),t.logarithmicDepthBuffer&&a.enable(2),t.skinning&&a.enable(3),t.morphTargets&&a.enable(4),t.morphNormals&&a.enable(5),t.morphColors&&a.enable(6),t.premultipliedAlpha&&a.enable(7),t.shadowMapEnabled&&a.enable(8),t.physicallyCorrectLights&&a.enable(9),t.doubleSided&&a.enable(10),t.flipSided&&a.enable(11),t.useDepthPacking&&a.enable(12),t.dithering&&a.enable(13),t.specularIntensityMap&&a.enable(14),t.specularColorMap&&a.enable(15),t.transmission&&a.enable(16),t.transmissionMap&&a.enable(17),t.thicknessMap&&a.enable(18),t.sheen&&a.enable(19),t.sheenColorMap&&a.enable(20),t.sheenRoughnessMap&&a.enable(21),t.decodeVideoTexture&&a.enable(22),t.opaque&&a.enable(23),e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Ds[t];n=ds.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Na),i.length>1&&i.sort(t||Ba),r.length>1&&r.sort(t||Ba)}}}function Fa(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Ua,e.set(t,[i])):n>=e.get(t).length?(i=new Ua,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function za(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new oi,color:new jn};break;case"SpotLight":n={position:new oi,direction:new oi,color:new jn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oi,color:new jn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oi,skyColor:new jn,groundColor:new jn};break;case"RectAreaLight":n={color:new jn,position:new oi,halfWidth:new oi,halfHeight:new oi}}return e[t.id]=n,n}}}let Ha=0;function Ga(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Va(e,t){const n=new za,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new oi);const s=new oi,o=new Bi,a=new Bi;return{setup:function(s,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,m=0,g=0,y=0;s.sort(Ga);const _=!0!==o?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ps.LTC_FLOAT_1,r.rectAreaLTC2=Ps.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ps.LTC_HALF_1,r.rectAreaLTC2=Ps.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=c;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===m&&v.numPointShadows===g&&v.numSpotShadows===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,v.directionalLength=h,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=m,v.numPointShadows=g,v.numSpotShadows=y,r.version=Ha++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(s=new Wa(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class qa extends br{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Ot,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}qa.prototype.isMeshDepthMaterial=!0;class Xa extends br{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new oi,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Ja(e,t,n){let i=new Ts;const r=new Ln,s=new Ln,o=new Qn,a=new qa({depthPacking:kt}),l=new Xa,c={},h=n.maxTextureSize,d={0:m,1:f,2:g},y=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ln},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 \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}"}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const x=new Vr;x.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new as(x,y),w=this;function M(n,i){const r=t.update(b);y.defines.VSM_SAMPLES!==n.blurSamples&&(y.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),y.uniforms.shadow_pass.value=n.map.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,y,b,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,b,null)}function S(t,n,i,r,s,o){let h=null;const u=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==u?u:!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const e=h.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=h.clone(),i[t]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=o===p?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=s),h}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===p)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let l=0,c=t.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null!==u.map||u.isPointLightShadow||this.type!==p||(u.map=new $n(r.x,r.y),u.map.texture.name=c.name+".shadowMap",u.mapPass=new $n(r.x,r.y),u.camera.updateProjectionMatrix()),null===u.map){const e={minFilter:pe,magFilter:pe,format:Ne};u.map=new $n(r.x,r.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==he.indexOf("OpenGL ES")&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),le=ce>=2);let ue=null,de={};const pe=e.getParameter(3088),fe=e.getParameter(2978),me=(new Qn).fromArray(pe),ge=(new Qn).fromArray(fe);function ye(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?An:Math.floor,s=i(r*e.width),o=i(r*e.height);void 0===m&&(m=_(s,o));const a=n?_(s,o):m;return a.width=s,a.height=o,a.getContext("2d").drawImage(e,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function x(e){return En(e.width)&&En(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==pe&&e.minFilter!==_e}function w(t){e.generateMipmap(t)}function M(n,i,r,s,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===It&&!1===o?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||t.get("EXT_color_buffer_float"),l}function S(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==pe&&e.minFilter!==_e?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function E(e){return e===pe||e===fe||e===ge?9728:9729}function T(e){const t=e.target;t.removeEventListener("dispose",T),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=g.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&C(e),0===Object.keys(r).length&&g.delete(n)}i.remove(e)}(t),t.isVideoTexture&&f.delete(t)}function A(t){const n=t.target;n.removeEventListener("dispose",A),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&r.__version!==e.version){const n=e.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void k(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}const P={[he]:10497,[ue]:33071,[de]:33648},D={[pe]:9728,[fe]:9984,[ge]:9986,[_e]:9729,[ve]:9985,[be]:9987};function I(n,s,o){if(o?(e.texParameteri(n,10242,P[s.wrapS]),e.texParameteri(n,10243,P[s.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[s.wrapR]),e.texParameteri(n,10240,D[s.magFilter]),e.texParameteri(n,10241,D[s.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),s.wrapS===ue&&s.wrapT===ue||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,E(s.magFilter)),e.texParameteri(n,10241,E(s.minFilter)),s.minFilter!==pe&&s.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const o=t.get("EXT_texture_filter_anisotropic");if(s.type===Le&&!1===t.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Re&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function O(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&C(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function k(t,i,r){let o=3553;i.isDataArrayTexture&&(o=35866),i.isData3DTexture&&(o=32879);const l=O(t,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),c.version!==c.__currentVersion||!0===l){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=function(e){return!a&&(e.wrapS!==ue||e.wrapT!==ue||e.minFilter!==pe&&e.minFilter!==_e)}(i)&&!1===x(i.image);let u=v(i.image,r,!1,h);u=H(i,u);const d=x(u)||a,p=s.convert(i.format,i.encoding);let f,m=s.convert(i.type),g=M(i.internalFormat,p,m,i.encoding,i.isVideoTexture);I(o,i,d);const y=i.mipmaps,_=a&&!0!==i.isVideoTexture,E=void 0===t.__version||!0===l,T=S(i,u,d);if(i.isDepthTexture)g=6402,a?g=i.type===Le?36012:i.type===Ce?33190:i.type===Ie?35056:33189:i.type===Le&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Fe&&6402===g&&i.type!==Te&&i.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Te,m=s.convert(i.type)),i.format===ze&&6402===g&&(g=34041,i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ie,m=s.convert(i.type))),E&&(_?n.texStorage2D(3553,1,g,u.width,u.height):n.texImage2D(3553,0,g,u.width,u.height,0,p,m,null));else if(i.isDataTexture)if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e>=1,t>>=1}}else if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,n){const i=e.encoding,r=e.format,s=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===mn||i!==Dt&&(i===It?!1===a?!0===t.has("EXT_sRGB")&&r===Ne?(e.format=mn,e.minFilter=_e,e.generateMipmaps=!1):n=Xn.sRGBToLinear(n):r===Ne&&s===Me||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const e=L;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(t,r){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;const o=O(t,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===o){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,o=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=r||o?o?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=H(i,h[e]);const u=h[0],d=x(u)||a,p=s.convert(i.format,i.encoding),f=s.convert(i.type),m=M(i.internalFormat,p,f,i.encoding),g=a&&!0!==i.isVideoTexture,y=void 0===t.__version;let _,E=S(i,u,d);if(I(34067,i,d),r){g&&y&&n.texStorage2D(34067,E,m,u.width,u.height);for(let e=0;e<6;e++){_=h[e].mipmaps;for(let t=0;t<_.length;t++){const r=_[t];i.format!==Ne?null!==p?g?n.compressedTexSubImage2D(34069+e,t,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+e,t,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+e,t,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+e,t,m,r.width,r.height,0,p,f,r.data)}}}else{_=i.mipmaps,g&&y&&(_.length>0&&E++,n.texStorage2D(34067,E,m,h[0].width,h[0].height));for(let e=0;e<6;e++)if(o){g?n.texSubImage2D(34069+e,0,0,0,h[e].width,h[e].height,p,f,h[e].data):n.texImage2D(34069+e,0,m,h[e].width,h[e].height,0,p,f,h[e].data);for(let t=0;t<_.length;t++){const i=_[t].image[e].image;g?n.texSubImage2D(34069+e,t+1,0,0,i.width,i.height,p,f,i.data):n.texImage2D(34069+e,t+1,m,i.width,i.height,0,p,f,i.data)}}else{g?n.texSubImage2D(34069+e,0,0,0,p,f,h[e]):n.texImage2D(34069+e,0,m,p,f,h[e]);for(let t=0;t<_.length;t++){const i=_[t];g?n.texSubImage2D(34069+e,t+1,0,0,p,f,i.image[e]):n.texImage2D(34069+e,t+1,m,p,f,i.image[e])}}}b(i,d)&&w(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){const r=i.get(e);void 0!==t&&N(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&U(e)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",A),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=x(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;t0&&!1===z(t)){c.__webglMultisampledFramebuffer=e.createFramebuffer(),c.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),o=M(l.internalFormat,i,r,l.encoding),a=F(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(c.__webglDepthRenderbuffer=e.createRenderbuffer(),B(c.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),I(34067,l,p);for(let e=0;e<6;e++)N(c.__webglFramebuffer[e],t,l,36064,34069+e);b(l,p)&&w(34067),n.unbindTexture()}else if(d){const e=t.texture;for(let r=0,s=e.length;r0&&!1===z(t)){const r=t.width,s=t.height;let o=16384;const a=[36064],l=t.stencilBuffer?33306:36096;t.depthBuffer&&a.push(l);const c=i.get(t),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(e.invalidateFramebuffer(36008,[l]),e.invalidateFramebuffer(36009,[l])),e.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),p&&e.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=N,this.useMultisampledRTT=z}function Ka(e,t,n){const i=n.isWebGL2;return{convert:function(n,r=null){let s;if(n===Me)return 5121;if(n===Pe)return 32819;if(n===De)return 32820;if(n===Se)return 5120;if(n===Ee)return 5122;if(n===Te)return 5123;if(n===Ae)return 5124;if(n===Ce)return 5125;if(n===Le)return 5126;if(n===Re)return i?5131:(s=t.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(n===Oe)return 6406;if(n===Ne)return 6408;if(n===Be)return 6409;if(n===Ue)return 6410;if(n===Fe)return 6402;if(n===ze)return 34041;if(n===He)return 6403;if(n===ke)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===mn)return s=t.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(n===Ge)return 36244;if(n===Ve)return 33319;if(n===We)return 33320;if(n===je)return 36249;if(n===qe||n===Xe||n===Je||n===Ye)if(r===It){if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(n===qe)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=t.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(n===qe)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ze||n===Ke||n===Qe||n===$e){if(s=t.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(n===Ze)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ke)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qe)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$e)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===et)return s=t.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===tt||n===nt){if(s=t.get("WEBGL_compressed_texture_etc"),null===s)return null;if(n===tt)return r===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===nt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(n===it||n===rt||n===st||n===ot||n===at||n===lt||n===ct||n===ht||n===ut||n===dt||n===pt||n===ft||n===mt||n===gt){if(s=t.get("WEBGL_compressed_texture_astc"),null===s)return null;if(n===it)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===st)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ot)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===at)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ct)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ht)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ut)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ft)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===yt){if(s=t.get("EXT_texture_compression_bptc"),null===s)return null;if(n===yt)return r===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Ie?i?34042:(s=t.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}Xa.prototype.isMeshDistanceMaterial=!0;class Qa extends ms{constructor(e=[]){super(),this.cameras=e}}Qa.prototype.isArrayCamera=!0;class $a extends lr{constructor(){super(),this.type="Group"}}$a.prototype.isGroup=!0;const el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $a,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $a,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new oi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new oi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $a,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new oi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new oi),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==o&&(i=t.getPose(e.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el))),l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const e=new $a;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}const r=l.joints[i.jointName];null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class nl extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){if((c=void 0!==c?c:Fe)!==Fe&&c!==ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Fe&&(n=Te),void 0===n&&c===ze&&(n=Ie),super(null,i,r,s,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==a?a:pe,this.flipY=!1,this.generateMipmaps=!1}}nl.prototype.isDepthTexture=!0;class il extends gn{constructor(e,t){super();const n=this;let i=null,r=1,s=null,o="local-floor",a=null,l=null,c=null,h=null,u=null,d=null;const p=t.getContextAttributes();let f=null,m=null;const g=[],y=new Map,_=new ms;_.layers.enable(1),_.viewport=new Qn;const v=new ms;v.layers.enable(2),v.viewport=new Qn;const x=[_,v],b=new Qa;b.layers.enable(1),b.layers.enable(2);let w=null,M=null;function S(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function E(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),w=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,m=null,P.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function T(e){const t=i.inputSources;for(let e=0;e0&&(n.alphaTest.value=i.alphaTest);const r=t.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const t=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*t}let s,o;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(e,i):i.isMeshToonMaterial?(n(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(n(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(n(e,i),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===m&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o)):i.isMeshMatcapMaterial?(n(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?n(e,i):i.isMeshDistanceMaterial?(n(e,i),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?n(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function sl(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=On("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let d=null,p=null;const y=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Dt,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1;const v=this;let x=!1,b=0,w=0,M=null,S=-1,E=null;const T=new Qn,A=new Qn;let C=null,L=t.width,R=t.height,P=1,D=null,I=null;const O=new Qn(0,0,L,R),k=new Qn(0,0,L,R);let N=!1;const B=new Ts;let U=!1,F=!1,z=null;const H=new Bi,G=new Ln,V=new oi,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===M?P:1}let q,X,J,Y,Z,K,$,ee,te,ne,ie,re,se,oe,ae,le,ce,he,ue,de,pe,fe,me,ge=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){const i=X.isWebGL2;null===z&&(z=new $n(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Re:Me,minFilter:be,samples:i&&!0===o?4:0})),v.getDrawingBufferSize(G),i?z.setSize(G.x,G.y):z.setSize(An(G.x),An(G.y));const r=v.getRenderTarget();v.setRenderTarget(z),v.clear();const s=v.toneMapping;v.toneMapping=Q,Ie(e,t,n),v.toneMapping=s,K.updateMultisampleRenderTarget(z),K.updateRenderTargetMipmap(z),v.setRenderTarget(r)}(r,t,n),i&&J.viewport(T.copy(i)),r.length>0&&Ie(r,t,n),s.length>0&&Ie(s,t,n),a.length>0&&Ie(a,t,n),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ie(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?_[_.length-1]:null,y.pop(),d=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(e,t,n){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=n;const i=Z.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=Z.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){M=e,b=t,w=n;let i=!0;if(e){const t=Z.get(e);void 0!==t.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?K.setupRenderTarget(e):t.__hasExternalTextures&&K.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(e){const n=e.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const i=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?Z.get(e).__webglMultisampledFramebuffer:i,T.copy(e.viewport),A.copy(e.scissor),C=e.scissorTest}else T.copy(O).multiplyScalar(P).floor(),A.copy(k).multiplyScalar(P).floor(),C=N;if(J.bindFramebuffer(36160,r)&&X.drawBuffers&&i&&J.drawBuffers(e,r),J.viewport(T),J.scissor(A),J.setScissorTest(C),s){const i=Z.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(o){const i=Z.get(e.texture),r=t||0;ge.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){J.bindFramebuffer(36160,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==Ne&&fe.convert(a)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Re&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(l===Me||fe.convert(l)===ge.getParameter(35738)||l===Le&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ge.readPixels(t,n,i,r,fe.convert(a),fe.convert(l),s)}finally{const e=null!==M?Z.get(M).__webglFramebuffer:null;J.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);K.setTexture2D(t,0),ge.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);K.setTexture2D(n,0),ge.pixelStorei(37440,n.flipY),ge.pixelStorei(37441,n.premultiplyAlpha),ge.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,i,e.x,e.y,r,s,o,a,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ge.texSubImage2D(3553,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ge.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isData3DTexture)K.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(i,0),h=35866}ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment);const u=ge.getParameter(3314),d=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),m=ge.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ge.pixelStorei(3314,g.width),ge.pixelStorei(32878,g.height),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ge.compressedTexSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,g.data)):ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g),ge.pixelStorei(3314,u),ge.pixelStorei(32878,d),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,m),0===r&&i.generateMipmaps&&ge.generateMipmap(h),J.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),J.unbindTexture()},this.resetState=function(){b=0,w=0,M=null,J.reset(),me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sl.prototype.isWebGLRenderer=!0;class ol extends sl{}ol.prototype.isWebGL1Renderer=!0;class al{constructor(e,t=25e-5){this.name="",this.color=new jn(e),this.density=t}clone(){return new al(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}al.prototype.isFogExp2=!0;class ll{constructor(e,t=1,n=1e3){this.name="",this.color=new jn(e),this.near=t,this.far=n}clone(){return new ll(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ll.prototype.isFog=!0;class cl extends lr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}cl.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:a,point:ml.clone(),uv:vr.getUV(ml,bl,wl,Ml,Sl,El,Tl,new Ln),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Cl(e,t,n,i,r,s){_l.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(vl.x=s*_l.x-r*_l.y,vl.y=r*_l.x+s*_l.y):vl.copy(_l),e.copy(t),e.x+=vl.x,e.y+=vl.y,e.applyMatrix4(xl)}Al.prototype.isSprite=!0;const Ll=new oi,Rl=new oi;class Pl extends lr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){Ll.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);const n=Ll.distanceTo(Rl)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;ia)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}tc.prototype.isLine=!0;const nc=new oi,ic=new oi;class rc extends tc{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dc(e,t,n,i,r,s,o){const a=lc.distanceSqToPoint(e);if(ar.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}uc.prototype.isPoints=!0;class pc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.minFilter=void 0!==s?s:_e,this.magFilter=void 0!==r?r:_e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}pc.prototype.isVideoTexture=!0;class fc extends Kn{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=pe,this.minFilter=pe,this.generateMipmaps=!1,this.needsUpdate=!0}}fc.prototype.isFramebufferTexture=!0;class mc extends Kn{constructor(e,t,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}mc.prototype.isCompressedTexture=!0;class gc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.needsUpdate=!0}}gc.prototype.isCanvasTexture=!0;class yc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new Ln:new oi);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oi,i=[],r=[],s=[],o=new oi,a=new Bi;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new oi)}r[0]=new oi,s[0]=new oi;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(wn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(wn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _c extends yc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new Ln,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(bc.subVectors(i[0],i[1]).add(i[0]),o=bc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Tc(o,a.x,l.x,c.x,h.x),Tc(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Fc extends Vr{constructor(e=[new Ln(0,.5),new Ln(.5,0),new Ln(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=wn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new oi,u=new Ln,d=new oi,p=new oi,f=new oi;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),a.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){const d=n+r*c*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*f,s.push(h.x,h.y,h.z),u.x=r/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*f;l.push(i,c,d)}}for(let n=0;n0&&y(!0),t>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(d,2))}static fromJSON(e){return new Gc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vc extends Gc{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Vc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wc extends Vr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Wc(e.vertices,e.indices,e.radius,e.details)}}class jc extends Wc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new jc(e.radius,e.detail)}}const qc=new oi,Xc=new oi,Jc=new oi,Yc=new vr;class Zc extends Vr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(vn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e0)for(s=t;s=t;s-=i)o=vh(s,e[s],e[s+1],o);return o&&ph(o,o.next)&&(xh(o),o=o.next),o}function $c(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!ph(i,i.next)&&0!==dh(i.prev,i,i.next))i=i.next;else{if(xh(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function eh(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=lh(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?nh(e,i,r,s):th(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),xh(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?eh(e=ih($c(e),t,n),t,n,i,r,s,2):2===o&&rh(e,t,n,i,r,s):eh($c(e),t,n,i,r,s,1);break}}function th(e){const t=e.prev,n=e,i=e.next;if(dh(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(hh(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&dh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function nh(e,t,n,i){const r=e.prev,s=e,o=e.next;if(dh(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=lh(a,l,t,n,i),d=lh(c,h,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ih(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!ph(r,s)&&fh(r,i,i.next,s)&&yh(r,s)&&yh(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),xh(i),xh(i.next),i=e=s),i=i.next}while(i!==e);return $c(i)}function rh(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&uh(o,e)){let a=_h(o,e);return o=$c(o,o.next),a=$c(a,a.next),eh(o,t,n,i,r,s),void eh(a,t,n,i,r,s)}e=e.next}o=o.next}while(o!==e)}function sh(e,t){return e.x-t.x}function oh(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&hh(rs.x||n.x===s.x&&ah(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}(e,t)){const n=_h(t,e);$c(t,t.next),$c(n,n.next)}}function ah(e,t){return dh(e.prev,e,t.prev)<0&&dh(t.next,e,e.next)<0}function lh(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ch(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function uh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&fh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(yh(e,t)&&yh(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(dh(e.prev,e,t.prev)||dh(e,t.prev,t))||ph(e,t)&&dh(e.prev,e,e.next)>0&&dh(t.prev,t,t.next)>0)}function dh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ph(e,t){return e.x===t.x&&e.y===t.y}function fh(e,t,n,i){const r=gh(dh(e,t,n)),s=gh(dh(e,t,i)),o=gh(dh(n,i,e)),a=gh(dh(n,i,t));return r!==s&&o!==a||!(0!==r||!mh(e,n,t))||!(0!==s||!mh(e,i,t))||!(0!==o||!mh(n,e,i))||!(0!==a||!mh(n,t,i))}function mh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function gh(e){return e>0?1:e<0?-1:0}function yh(e,t){return dh(e.prev,e,e.next)<0?dh(e,t,e.next)>=0&&dh(e,e.prev,t)>=0:dh(e,t,e.prev)<0||dh(e,e.next,t)<0}function _h(e,t){const n=new bh(e.i,e.x,e.y),i=new bh(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function vh(e,t,n,i){const r=new bh(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function xh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class wh{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return eh(s,o,n,a,l,p),o}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function Sh(e,t){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=t.x-a/u,f=t.y+o/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-a*l);i=p+o*m-e.x,r=f+a*m-e.y;const g=i*i+r*r;if(g<=2)return new Ln(i,r);s=Math.sqrt(g/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Ln(i/s,r/s)}const P=[];for(let e=0,t=T.length,n=t-1,i=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,t=T.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e0)&&d.push(t,r,l),(e!==n-1||a0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Gh.prototype.isMeshPhysicalMaterial=!0;class Vh extends br{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new jn(16777215),this.specular=new jn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}Vh.prototype.isMeshPhongMaterial=!0;class Wh extends br{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new jn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}Wh.prototype.isMeshToonMaterial=!0;class jh extends br{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}jh.prototype.isMeshNormalMaterial=!0;class qh extends br{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}qh.prototype.isMeshLambertMaterial=!0;class Xh extends br{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new jn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}Xh.prototype.isMeshMatcapMaterial=!0;class Jh extends Yl{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Jh.prototype.isLineDashedMaterial=!0;const Yh={ShadowMaterial:Fh,SpriteMaterial:pl,RawShaderMaterial:zh,ShaderMaterial:ps,PointsMaterial:oc,MeshPhysicalMaterial:Gh,MeshStandardMaterial:Hh,MeshPhongMaterial:Vh,MeshToonMaterial:Wh,MeshNormalMaterial:jh,MeshLambertMaterial:qh,MeshDepthMaterial:qa,MeshDistanceMaterial:Xa,MeshBasicMaterial:wr,MeshMatcapMaterial:Xh,LineDashedMaterial:Jh,LineBasicMaterial:Yl,Material:br};br.fromType=function(e){return new Yh[e]};const Zh={arraySlice:function(e,t,n){return Zh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Zh.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),d=Zh.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new si).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let e=0;e=r)break e;{const o=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=Zh.arraySlice(n,r,s),this.values=Zh.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&Zh.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Zh.arraySlice(this.times),t=Zh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Mt,r=e.length-1;let s=1;for(let o=1;o0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=Zh.arraySlice(e,0,s),this.values=Zh.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=Zh.arraySlice(this.times,0),t=Zh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tu.prototype.TimeBufferType=Float32Array,tu.prototype.ValueBufferType=Float32Array,tu.prototype.DefaultInterpolation=wt;class nu extends tu{}nu.prototype.ValueTypeName="bool",nu.prototype.ValueBufferType=Array,nu.prototype.DefaultInterpolation=bt,nu.prototype.InterpolantFactoryMethodLinear=void 0,nu.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends tu{}iu.prototype.ValueTypeName="color";class ru extends tu{}ru.prototype.ValueTypeName="number";class su extends Kh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)si.slerpFlat(r,0,s,l-o,s,l,a);return r}}class ou extends tu{InterpolantFactoryMethodLinear(e){return new su(this.times,this.values,this.getValueSize(),e)}}ou.prototype.ValueTypeName="quaternion",ou.prototype.DefaultInterpolation=wt,ou.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends tu{}au.prototype.ValueTypeName="string",au.prototype.ValueBufferType=Array,au.prototype.DefaultInterpolation=bt,au.prototype.InterpolantFactoryMethodLinear=void 0,au.prototype.InterpolantFactoryMethodSmooth=void 0;class lu extends tu{}lu.prototype.ValueTypeName="vector";class cu{constructor(e,t=-1,n,i=At){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hu(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tu.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Zh.flattenJSON(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==mu[e])return void mu[e].push({onLoad:t,onProgress:n,onError:i});mu[e]=[],mu[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=mu[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{uu.add(e,t);const n=mu[e];delete mu[e];for(let e=0,i=n.length;e{const n=mu[e];if(void 0===n)throw this.manager.itemError(e),t;delete mu[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class yu extends fu{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new gu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new jn).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Ln).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new oi).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new Qn).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Rn).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Bi).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Ln).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ln).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Vu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){const n=new du(t);r=new vu(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new vu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){si.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;si.multiplyQuaternionsFlat(e,s,e,t,e,n),si.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const bd=new RegExp("[\\[\\]\\.:\\/]","g"),wd="[^\\[\\]\\.:\\/]",Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sd=/((?:WC+[\/:])*)/.source.replace("WC",wd),Ed=/(WCOD+)?/.source.replace("WCOD",Md),Td=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",wd),Ad=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",wd),Cd=new RegExp("^"+Sd+Ed+Td+Ad+"$"),Ld=["material","materials","bones"];class Rd{constructor(e,t,n){this.path=t,this.parsedPath=n||Rd.parseTrackName(t),this.node=Rd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rd.Composite(e,t,n):new Rd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(bd,"")}static parseTrackName(e){const t=Cd.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Ld.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Rd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Pd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:St,endingEnd:St};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case Ct:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);break;case At:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===xt;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(n===_t){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Et,i.endingEnd=Et):(i.endingStart=e?this.zeroSlopeAtStart?Et:St:Tt,i.endingEnd=t?this.zeroSlopeAtEnd?Et:St:Tt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}class Id extends gn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new xd(Rd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Gd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Vd.prototype.isBox2=!0;const Wd=new oi,jd=new oi;class qd{constructor(e=new oi,t=new oi){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Wd.subVectors(e,this.start),jd.subVectors(this.end,this.start);const n=jd.dot(jd);let i=jd.dot(Wd)/n;return t&&(i=wn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Xd=new oi;class Jd extends lr{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new Vr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{vp.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(vp,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Mp extends rc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Vr;n.setAttribute("position",new Or(t,3)),n.setAttribute("color",new Or([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Yl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new jn,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Sp{constructor(){this.type="ShapePath",this.color=new jn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(e){const t=[];for(let n=0,i=e.length;nNumber.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const r=wh.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],l=new Kc,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1,t=0;for(let e=0,t=d.length;e0&&!1===e&&(m=u)}for(let e=0,t=d.length;e65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=wn(e,-65504,65504),Ap[0]=e;const t=Cp[0],n=t>>23&511;return Lp[n]+((8388607&t)>>Rp[n])}static fromHalfFloat(e){const t=e>>10;return Cp[0]=Pp[Ip[t]+(1023&e)]+Dp[t],Ap[0]}}const Tp=new ArrayBuffer(4),Ap=new Float32Array(Tp),Cp=new Uint32Array(Tp),Lp=new Uint32Array(512),Rp=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Lp[e]=0,Lp[256|e]=32768,Rp[e]=24,Rp[256|e]=24):t<-14?(Lp[e]=1024>>-t-14,Lp[256|e]=1024>>-t-14|32768,Rp[e]=-t-1,Rp[256|e]=-t-1):t<=15?(Lp[e]=t+15<<10,Lp[256|e]=t+15<<10|32768,Rp[e]=13,Rp[256|e]=13):t<128?(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=24,Rp[256|e]=24):(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=13,Rp[256|e]=13)}const Pp=new Uint32Array(2048),Dp=new Uint32Array(64),Ip=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;0==(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,Pp[e]=t|n}for(let e=1024;e<2048;++e)Pp[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Dp[e]=e<<23;Dp[31]=1199570944,Dp[32]=2147483648;for(let e=33;e<63;++e)Dp[e]=2147483648+(e-32<<23);Dp[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(Ip[e]=1024);const Op=0,kp=1,Np=0,Bp=1,Up=2;function Fp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function zp(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}class Hp extends uc{constructor(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(e,t)}}class Gp extends Al{constructor(e){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(e)}}class Vp extends uc{constructor(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(e,t)}}class Wp extends oc{constructor(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class jp extends oc{constructor(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class qp extends oc{constructor(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class Xp extends oi{constructor(e,t,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(e,t,n)}}class Jp extends Er{constructor(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(e,t),this.setUsage(sn)}}class Yp extends Tr{constructor(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(e,t)}}class Zp extends Ar{constructor(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(e,t)}}class Kp extends Cr{constructor(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(e,t)}}class Qp extends Lr{constructor(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(e,t)}}class $p extends Rr{constructor(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(e,t)}}class ef extends Pr{constructor(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(e,t)}}class tf extends Dr{constructor(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(e,t)}}class nf extends Or{constructor(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(e,t)}}class rf extends kr{constructor(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(e,t)}}yc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(yc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Uc.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)};class sf extends Mp{constructor(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(e)}}class of extends gp{constructor(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(e,t)}}class af extends rc{constructor(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new Zc(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}sp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Qd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};class lf extends rc{constructor(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new Nh(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}fu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Vu.extractUrlBase(e)},fu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};class cf extends gu{constructor(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(e)}}class hf extends bu{constructor(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(e)}}Vd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Vd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Vd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Vd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},ci.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ci.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ci.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ci.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ci.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Xi.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Ci.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ts.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},qd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Rn.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Rn.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Rn.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Rn.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Bi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Bi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Bi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new oi).setFromMatrixColumn(this,3)},Bi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Bi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Bi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Bi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Bi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Bi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Bi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Bi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Bi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Bi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Bi.prototype.makeFrustum=function(e,t,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,s)},Bi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ms.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},si.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},si.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Ni.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Ni.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Ni.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},vr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},vr.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},vr.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},vr.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},vr.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},vr.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),vr.getBarycoord(e,t,n,i,r)},vr.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),vr.getNormal(e,t,n,i)},Kc.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Kc.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Eh(this,e)},Kc.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rh(this,e)},Ln.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ln.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Ln.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},oi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},oi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},oi.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},oi.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},oi.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},oi.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},oi.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},oi.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},oi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Qn.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Qn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},lr.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},lr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},lr.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},lr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},lr.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(lr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),as.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(as.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Lt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},ms.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Mu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Er.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===sn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(sn)}}}),Er.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},Er.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Er.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vr.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},Vr.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Er(arguments[1],arguments[2])))},Vr.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},Vr.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Vr.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Vr.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},Vr.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Vr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Eh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Eh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Eh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},cl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Od.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(br.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new jn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(ps.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),sl.prototype.clearTarget=function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},sl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},sl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},sl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},sl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},sl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},sl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},sl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},sl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},sl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},sl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},sl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},sl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},sl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},sl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},sl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},sl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},sl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},sl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},sl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},sl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},sl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},sl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},sl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},sl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(sl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?It:Dt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ja.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});class uf extends vs{constructor(e,t,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(e,n)}}function df(){console.error("THREE.CanvasRenderer has been removed")}function pf(){console.error("THREE.JSONLoader has been removed.")}Object.defineProperties($n.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),pd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new $u).load(e,(function(e){t.setBuffer(e)})),this},vd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ys.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ys.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},Xn.crossOrigin=void 0,Xn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new wu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new xu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Xn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const ff={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function mf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}class gf extends Vr{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}}class yf extends Vr{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}}function _f(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function vf(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function xf(){console.error("THREE.ImmediateRenderObject has been removed.")}class bf extends $n{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class wf extends ei{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class Mf extends ni{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i)},365:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(477);const r={type:"change"},s={type:"start"},o={type:"end"};class a extends i.EventDispatcher{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new i.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",X),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),l=a.NONE},this.update=function(){const t=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),o=s.clone().invert(),m=new i.Vector3,g=new i.Quaternion,y=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(s),h.setFromVector3(t),n.autoRotate&&l===a.NONE&&A(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(h.theta+=u.theta*n.dampingFactor,h.phi+=u.phi*n.dampingFactor):(h.theta+=u.theta,h.phi+=u.phi);let i=n.minAzimuthAngle,_=n.maxAzimuthAngle;return isFinite(i)&&isFinite(_)&&(i<-Math.PI?i+=y:i>Math.PI&&(i-=y),_<-Math.PI?_+=y:_>Math.PI&&(_-=y),h.theta=i<=_?Math.max(i,Math.min(_,h.theta)):h.theta>(i+_)/2?Math.max(i,h.theta):Math.min(_,h.theta)),h.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=d,h.radius=Math.max(n.minDistance,Math.min(n.maxDistance,h.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(h),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),p.set(0,0,0)),d=1,!!(f||m.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c)&&(n.dispatchEvent(r),m.copy(n.object.position),g.copy(n.object.quaternion),f=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",q),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",X)};const n=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,h=new i.Spherical,u=new i.Spherical;let d=1;const p=new i.Vector3;let f=!1;const m=new i.Vector2,g=new i.Vector2,y=new i.Vector2,_=new i.Vector2,v=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,S=[],E={};function T(){return Math.pow(.95,n.zoomSpeed)}function A(e){u.theta-=e}function C(e){u.phi-=e}const L=function(){const e=new i.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),R=function(){const e=new i.Vector3;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),P=function(){const e=new i.Vector3;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;e.copy(s).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*t*o/r.clientHeight,n.object.matrix),R(2*i*o/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function D(e){n.object.isPerspectiveCamera?d/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){n.object.isPerspectiveCamera?d*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function k(e){_.set(e.clientX,e.clientY)}function N(){if(1===S.length)m.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);m.set(e,t)}}function B(){if(1===S.length)_.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);_.set(e,t)}}function U(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function F(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g)}function z(e){if(1===S.length)v.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v)}function H(e){const t=K(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);w.set(0,s),M.set(0,Math.pow(w.y/b.y,n.zoomSpeed)),D(M.y),b.copy(w)}function G(e){!1!==n.enabled&&(0===S.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",W)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(Z(e),S.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;N(),l=a.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;B(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(),n.enablePan&&B(),l=a.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(),n.enableRotate&&N(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),l=a.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;k(e),l=a.PAN}else{if(!1===n.enableRotate)return;O(e),l=a.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),l=a.ROTATE}else{if(!1===n.enablePan)return;k(e),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e))}function V(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),l){case a.TOUCH_ROTATE:if(!1===n.enableRotate)return;F(e),n.update();break;case a.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case a.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&H(e),n.enablePan&&z(e)}(e),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&H(e),n.enableRotate&&F(e)}(e),n.update();break;default:l=a.NONE}}(e):function(e){if(!1!==n.enabled)switch(l){case a.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g),n.update()}(e);break;case a.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,b),M.y>0?D(T()):M.y<0&&I(T()),b.copy(w),n.update()}(e);break;case a.PAN:if(!1===n.enablePan)return;!function(e){v.set(e.clientX,e.clientY),x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v),n.update()}(e)}}(e))}function W(e){Y(e),0===S.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W)),n.dispatchEvent(o),l=a.NONE}function j(e){Y(e)}function q(e){!1!==n.enabled&&!1!==n.enableZoom&&l===a.NONE&&(e.preventDefault(),n.dispatchEvent(s),function(e){e.deltaY<0?I(T()):e.deltaY>0&&D(T()),n.update()}(e),n.dispatchEvent(o))}function X(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:P(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:P(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:P(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:P(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function Y(e){delete E[e.pointerId];for(let t=0;t{"use strict";n.d(t,{G:()=>s});var i=n(477);class r extends i.DataTextureLoader{constructor(e){super(e)}parse(e){e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let t=0;const n=new Uint8Array(e),r={id_length:n[t++],colormap_type:n[t++],image_type:n[t++],colormap_index:n[t++]|n[t++]<<8,colormap_length:n[t++]|n[t++]<<8,colormap_size:n[t++],origin:[n[t++]|n[t++]<<8,n[t++]|n[t++]<<8],width:n[t++]|n[t++]<<8,height:n[t++]|n[t++]<<8,pixel_size:n[t++],flags:n[t++]};!function(e){switch(e.image_type){case 1:case 9:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let s=!1,o=!1,a=!1;switch(r.image_type){case 9:s=!0,o=!0;break;case 1:o=!0;break;case 10:s=!0;break;case 2:break;case 11:s=!0,a=!0;break;case 3:a=!0}const l=new Uint8Array(r.width*r.height*4),c=function(e,t,n,i,r){let s,o;const a=n.pixel_size>>3,l=n.width*n.height*a;if(t&&(o=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;s=new Uint8Array(l);let o=0;const c=new Uint8Array(a);for(;o>4){default:case 2:o=0,c=1,u=t,l=0,h=1,d=n;break;case 0:o=0,c=1,u=t,l=n-1,h=-1,d=-1;break;case 3:o=t-1,c=-1,u=-1,l=0,h=1,d=n;break;case 1:o=t-1,c=-1,u=-1,l=n-1,h=-1,d=-1}if(a)switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d++)c=l[d],e[4*(h+p*u)+0]=c,e[4*(h+p*u)+1]=c,e[4*(h+p*u)+2]=c,e[4*(h+p*u)+3]=255}(e,l,h,d,o,c,u,i);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=2)e[4*(c+d*h)+0]=l[u+0],e[4*(c+d*h)+1]=l[u+0],e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+3]=l[u+1]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l,c){const h=c;let u,d,p,f=0;const m=r.width;for(p=t;p!==i;p+=n)for(d=s;d!==a;d+=o,f++)u=l[f],e[4*(d+m*p)+3]=255,e[4*(d+m*p)+2]=h[3*u+0],e[4*(d+m*p)+1]=h[3*u+1],e[4*(d+m*p)+0]=h[3*u+2]}(e,l,h,d,o,c,u,i,s);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d+=2)c=l[d+0]+(l[d+1]<<8),e[4*(h+p*u)+0]=(31744&c)>>7,e[4*(h+p*u)+1]=(992&c)>>2,e[4*(h+p*u)+2]=(31&c)<<3,e[4*(h+p*u)+3]=32768&c?0:255}(e,l,h,d,o,c,u,i);break;case 24:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=3)e[4*(c+d*h)+3]=255,e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2]}(e,l,h,d,o,c,u,i);break;case 32:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=4)e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2],e[4*(c+d*h)+3]=l[u+3]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(l,r.width,r.height,c.pixel_data,c.palettes),{data:l,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:i.LinearMipmapLinearFilter}}}class s extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===s.path?i.LoaderUtils.extractUrlBase(e):s.path,a=new i.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e,t){function n(e,t){const n=[],i=e.childNodes;for(let e=0,r=i.length;e0&&t.push(new i.VectorKeyframeTrack(r+".position",s,o)),a.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",s,a)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",s,l)),t}function S(e,t,n){let i,r,s,o=!0;for(r=0,s=e.length;r=0;){const i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t>>0));switch(n=n.toLowerCase(),n){case"tga":t=Xe;break;default:t=qe}return t}(s);if(void 0!==t){const r=t.load(s),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===c(o.technique)){const e=o.technique;r.wrapS=e.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,r.wrapT=e.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping;return null!==n&&(r.encoding=n),r}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",s),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}s.name=e.name||"";const a=r.parameters;for(const e in a){const t=a[e];switch(e){case"diffuse":t.color&&s.color.fromArray(t.color),t.texture&&(s.map=o(t.texture,i.sRGBEncoding));break;case"specular":t.color&&s.specular&&s.specular.fromArray(t.color),t.texture&&(s.specularMap=o(t.texture));break;case"bump":t.texture&&(s.normalMap=o(t.texture));break;case"ambient":t.texture&&(s.lightMap=o(t.texture,i.sRGBEncoding));break;case"shininess":t.float&&s.shininess&&(s.shininess=t.float);break;case"emission":t.color&&s.emissive&&s.emissive.fromArray(t.color),t.texture&&(s.emissiveMap=o(t.texture,i.sRGBEncoding))}}s.color.convertSRGBToLinear(),s.specular&&s.specular.convertSRGBToLinear(),s.emissive&&s.emissive.convertSRGBToLinear();let l=a.transparent,h=a.transparency;if(void 0===h&&l&&(h={float:1}),void 0===l&&h&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&h)if(l.data.texture)s.transparent=!0;else{const e=l.data.color;switch(l.opaque){case"A_ONE":s.opacity=e[3]*h.float;break;case"RGB_ZERO":s.opacity=1-e[0]*h.float;break;case"A_ZERO":s.opacity=1-e[3]*h.float;break;case"RGB_ONE":s.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}s.opacity<1&&(s.transparent=!0)}if(void 0!==r.extra&&void 0!==r.extra.technique){const e=r.extra.technique;for(const t in e){const n=e[t];switch(t){case"double_sided":s.side=1===n?i.DoubleSide:i.FrontSide;break;case"bump":s.normalMap=o(n.texture),s.normalScale=new i.Vector2(1,1)}}}return s}function K(e){return f(Qe.materials[e],Z)}function Q(e){for(let t=0;t0?n+s:n;t.inputs[o]={id:e,offset:r},t.stride=Math.max(t.stride,r+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=a(i.textContent);break;case"p":t.p=a(i.textContent)}}return t}function he(e){let t=0;for(let n=0,i=e.length;n0&&t0&&d.setAttribute("position",new i.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),a.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),h.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(h,4)),u.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(u,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function pe(e,t,n,i,r=!1){const s=e.p,o=e.stride,a=e.vcount;function l(e){let t=s[e+n]*h;const o=t+h;for(;t4)for(let t=1,i=n-2;t<=i;t++){const n=e+o*t,i=e+o*(t+1);l(e+0*o),l(n),l(i)}e+=o*n}}else for(let e=0,t=s.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;nr.limits.max||t{"use strict";n.d(t,{v:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===this.path?i.LoaderUtils.extractUrlBase(e):this.path,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,o={};for(let e=0;e=0?t.substring(0,s):t;a=a.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},o[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const a=new s(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class s{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:i.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:i.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const i=e[n],r={};t[n]=r;for(const e in i){let t=!0,n=i[e];const s=e.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(r[s]=n)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(e,n){if(r[e])return;const s=t.getTextureParams(n,r),o=t.loadTexture((a=t.baseUrl,"string"!=typeof(l=s.url)||""===l?"":/^https?:\/\//i.test(l)?l:a+l));var a,l;o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(o.encoding=i.sRGBEncoding),r[e]=o}for(const e in n){const t=n[e];let o;if(""!==t)switch(e.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ks":r.specular=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ke":r.emissive=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"map_kd":s("map",t);break;case"map_ks":s("specularMap",t);break;case"map_ke":s("emissiveMap",t);break;case"norm":s("normalMap",t);break;case"map_bump":case"bump":s("bumpMap",t);break;case"map_d":s("alphaMap",t),r.transparent=!0;break;case"ns":r.shininess=parseFloat(t);break;case"d":o=parseFloat(t),o<1&&(r.opacity=o,r.transparent=!0);break;case"tr":o=parseFloat(t),this.options&&this.options.invertTrProperty&&(o=1-o),o>0&&(r.opacity=1-o,r.transparent=!0)}}return this.materials[e]=new i.MeshPhongMaterial(r),this.materials[e]}getTextureParams(e,t){const n={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const o=void 0!==this.manager?this.manager:i.DefaultLoadingManager;let a=o.getHandler(e);null===a&&(a=new i.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(e,n,r,s);return void 0!==t&&(l.mapping=t),l}}},476:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new i.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(s.parse(n))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e){function t(e,t,n){for(let i=0,r=e.length;i>5&31)/31,o=(e>>10&31)/31):(r=l,s=c,o=h)}for(let l=1;l<=3;l++){const c=n+12*l,h=3*e*3+3*(l-1);f[h]=t.getFloat32(c,!0),f[h+1]=t.getFloat32(c+4,!0),f[h+2]=t.getFloat32(c+8,!0),m[h]=i,m[h+1]=u,m[h+2]=p,d&&(a[h]=r,a[h+1]=s,a[h+2]=o)}}return p.setAttribute("position",new i.BufferAttribute(f,3)),p.setAttribute("normal",new i.BufferAttribute(m,3)),d&&(p.setAttribute("color",new i.BufferAttribute(a,3)),p.hasColors=!0,p.alpha=u),p}(n):function(e){const t=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g;let s=0;const o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),l=new RegExp("normal"+o+o+o,"g"),c=[],h=[],u=new i.Vector3;let d,p=0,f=0,m=0;for(;null!==(d=n.exec(e));){f=m;const e=d[0];for(;null!==(d=r.exec(e));){let e=0,t=0;const n=d[0];for(;null!==(d=l.exec(n));)u.x=parseFloat(d[1]),u.y=parseFloat(d[2]),u.z=parseFloat(d[3]),t++;for(;null!==(d=a.exec(n));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),h.push(u.x,u.y,u.z),e++,m++;1!==t&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==e&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}const n=f,i=m-f;t.addGroup(n,i,p),p++}return t.setAttribute("position",new i.Float32BufferAttribute(c,3)),t.setAttribute("normal",new i.Float32BufferAttribute(h,3)),t}("string"!=typeof(r=e)?i.LoaderUtils.decodeText(new Uint8Array(r)):r);var r}}},140:(e,t,n)=>{"use strict";n.d(t,{qf:()=>r});var i=n(477);function r(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),o=new Set(Object.keys(e[0].morphAttributes)),a={},l={},c=e[0].morphTargetsRelative,h=new i.BufferGeometry;let u=0;for(let i=0;i{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Viewer:()=>Viewer,THREE:()=>three__WEBPACK_IMPORTED_MODULE_3__,msgpack:()=>msgpack});var three__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(140),wwobjloader2__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(973),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(976),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(23),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(476),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(365),msgpack=__webpack_require__(676),dat=__webpack_require__(376).ZP;__webpack_require__(583);const extensionCodec=new msgpack.ExtensionCodec;function merge_geometries(e,t=!1){let n=[],i=[],r=e.matrix.clone();!function e(t,r){let s=r.clone().multiply(t.matrix);"Mesh"===t.type&&(t.geometry.applyMatrix4(s),i.push(t.geometry),n.push(t.material));for(let n of t.children)e(n,s)}(e,r);let s=null;return 1==i.length?(s=i[0],t&&(s.material=n[0])):i.length>1?(s=(0,three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__.qf)(i,!0),t&&(s.material=n)):s=new three__WEBPACK_IMPORTED_MODULE_3__.BufferGeometry,s}function handle_special_texture(e){if("_text"==e.type){let t=document.createElement("canvas");t.width=256,t.height=256;let n=t.getContext("2d");n.textAlign="center";let i=e.font_size;for(n.font=i+"px "+e.font_face;n.measureText(e.text).width>t.width;)i--,n.font=i+"px "+e.font_face;n.fillText(e.text,t.width/2,t.height/2);let r=new three__WEBPACK_IMPORTED_MODULE_3__.CanvasTexture(t);return r.uuid=e.uuid,r}return null}function handle_special_geometry(e){if("_meshfile"==e.type&&(console.warn("_meshfile is deprecated. Please use _meshfile_geometry for geometries and _meshfile_object for objects with geometry and material"),e.type="_meshfile_geometry"),"_meshfile_geometry"==e.type){if("obj"==e.format){let t=merge_geometries((new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe).parse(e.data+"\n"));return t.uuid=e.uuid,t}if("dae"==e.format){let t=merge_geometries((new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G).parse(e.data).scene);return t.uuid=e.uuid,t}if("stl"==e.format){let t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer);return t.uuid=e.uuid,t}return console.error("Unsupported mesh type:",e),null}return null}extensionCodec.register({type:18,encode:e=>(console.error("Uint8Array encode not implemented"),null),decode:e=>{const t=new Uint8Array(e.byteLength);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Uint32Array encode not implemented"),null),decode:e=>{const t=new Uint32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Float32Array encode not implemented"),null),decode:e=>{const t=new Float32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;evoid 0!==e.resources[t]?e.resources[t]:t)),"obj"==e.format){let s=new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe(i);if(e.mtl_library){let t=new three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__.v(i).parse(e.mtl_library+"\n",""),n=wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.eW.addMaterialsFromMtlLoader(t);s.setMaterials(n),this.onTextureLoad()}t=merge_geometries(s.parse(e.data+"\n",r),!0),t.uuid=e.uuid,n=t.material}else if("dae"==e.format){let s=new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G(i);s.onTextureLoad=this.onTextureLoad,t=merge_geometries(s.parse(e.data,r).scene,!0),t.uuid=e.uuid,n=t.material}else{if("stl"!=e.format)return console.error("Unsupported mesh type:",e),null;t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer,r),t.uuid=e.uuid,n=t.material}let s=new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(t,n);return s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userjson&&(s.userjson=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),s}return super.parseObject(e,t,n)}}class SceneNode{constructor(e,t,n){this.object=e,this.folder=t,this.children={},this.controllers=[],this.on_update=n,this.create_controls();for(let e of this.object.children)this.add_child(e)}add_child(e){let t=this.folder.addFolder(e.name),n=new SceneNode(e,t,this.on_update);return this.children[e.name]=n,n}create_child(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Group;return t.name=e,this.object.add(t),this.add_child(t)}find(e){if(0==e.length)return this;{let t=e[0],n=this.children[t];return void 0===n&&(n=this.create_child(t)),n.find(e.slice(1))}}create_controls(){for(let e of this.controllers)this.folder.remove(e);if(this.controllers=[],void 0!==this.vis_controller&&this.folder.domElement.removeChild(this.vis_controller.domElement),this.vis_controller=new dat.controllers.BooleanController(this.object,"visible"),this.vis_controller.onChange((()=>this.on_update())),this.folder.domElement.prepend(this.vis_controller.domElement),this.vis_controller.domElement.style.height="0",this.vis_controller.domElement.style.float="right",this.vis_controller.domElement.classList.add("meshcat-visibility-checkbox"),this.vis_controller.domElement.children[0].addEventListener("change",(e=>{e.target.checked?this.folder.domElement.classList.remove("meshcat-hidden-scene-element"):this.folder.domElement.classList.add("meshcat-hidden-scene-element")})),this.object.isLight){let e=this.folder.add(this.object,"intensity").min(0).step(.01);if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.castShadow){let e=this.folder.add(this.object,"castShadow");if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.shadow){let e=this.folder.add(this.object.shadow,"radius").min(0).step(.05).max(3);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(void 0!==this.object.distance){let e=this.folder.add(this.object,"distance").min(0).step(.1).max(100);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(this.object.isCamera){let e=this.folder.add(this.object,"zoom").min(0).step(.1);e.onChange((()=>{this.on_update()})),this.controllers.push(e)}}set_property(e,t){if("position"===e)this.object.position.set(t[0],t[1],t[2]);else if("quaternion"===e)this.object.quaternion.set(t[0],t[1],t[2],t[3]);else if("scale"===e)this.object.scale.set(t[0],t[1],t[2]);else if("color"===e){function e(t,n){if(t.material){t.material.color.setRGB(n[0],n[1],n[2]);let e=n[3];t.material.opacity=e,t.material.transparent=1!=e}for(let i of t.children)e(i,n)}e(this.object,t)}else this.object[e]="top_color"==e||"bottom_color"==e?t.map((e=>255*e)):t;this.vis_controller.updateDisplay(),this.controllers.forEach((e=>e.updateDisplay()))}set_transform(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;t.fromArray(e),t.decompose(this.object.position,this.object.quaternion,this.object.scale)}set_object(e){let t=this.object.parent;this.dispose_recursive(),this.object.parent.remove(this.object),this.object=e,t.add(e),this.create_controls()}dispose_recursive(){for(let e of Object.keys(this.children))this.children[e].dispose_recursive();dispose(this.object)}delete(e){if(0==e.length)console.error("Can't delete an empty path");else{let t=this.find(e.slice(0,e.length-1)),n=e[e.length-1],i=t.children[n];void 0!==i&&(i.dispose_recursive(),t.object.remove(i.object),remove_folders(i.folder),t.folder.removeFolder(i.folder),delete t.children[n])}}}function remove_folders(e){for(let t of Object.keys(e.__folders)){let n=e.__folders[t];remove_folders(n),dat.dom.dom.unbind(window,"resize",n.__resizeHandler),e.removeFolder(n)}}function dispose(e){if(e&&(e.geometry&&e.geometry.dispose(),e.material))if(Array.isArray(e.material))for(let t of e.material)t.map&&t.map.dispose(),t.dispose();else e.material.map&&e.material.map.dispose(),e.material.dispose()}function create_default_scene(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.Scene;return e.name="Scene",e.rotateX(-Math.PI/2),e}function download_data_uri(e,t){let n=document.createElement("a");n.download=e,n.href=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function download_file(e,t,n){n=n||"text/plain";let i=new Blob([t],{type:n}),r=document.createElement("a");document.body.appendChild(r),r.download=e,r.href=window.URL.createObjectURL(i),r.onclick=function(e){let t=this;setTimeout((function(){window.URL.revokeObjectURL(t.href)}),1500)},r.click(),r.remove()}class Animator{constructor(e){this.viewer=e,this.folder=this.viewer.gui.addFolder("Animations"),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer,this.loader=new three__WEBPACK_IMPORTED_MODULE_3__.ObjectLoader,this.clock=new three__WEBPACK_IMPORTED_MODULE_3__.Clock,this.actions=[],this.playing=!1,this.time=0,this.time_scrubber=null,this.setup_capturer("png"),this.duration=0}setup_capturer(e){this.capturer=new window.CCapture({format:e,name:"meshcat_"+String(Date.now())}),this.capturer.format=e}play(){this.clock.start();for(let e of this.actions)e.play();this.playing=!0}record(){this.reset(),this.play(),this.recording=!0,this.capturer.start()}pause(){this.clock.stop(),this.playing=!1,this.recording&&(this.stop_capture(),this.save_capture())}stop_capture(){this.recording=!1,this.capturer.stop(),this.viewer.animate()}save_capture(){this.capturer.save(),"png"===this.capturer.format?alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.png \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4"):"jpg"===this.capturer.format&&alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.jpg \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4")}display_progress(e){this.time=e,null!==this.time_scrubber&&this.time_scrubber.updateDisplay()}seek(e){this.actions.forEach((t=>{t.time=Math.max(0,Math.min(t._clip.duration,e))})),this.mixer.update(0),this.viewer.set_dirty()}reset(){for(let e of this.actions)e.reset();this.display_progress(0),this.mixer.update(0),this.setup_capturer(this.capturer.format),this.viewer.set_dirty()}clear(){remove_folders(this.folder),this.mixer.stopAllAction(),this.actions=[],this.duration=0,this.display_progress(0),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer}load(e,t){this.clear(),this.folder.open();let n=this.folder.addFolder("default");n.open(),n.add(this,"play"),n.add(this,"pause"),n.add(this,"reset"),this.time_scrubber=n.add(this,"time",0,1e9,.001),this.time_scrubber.onChange((e=>this.seek(e))),n.add(this.mixer,"timeScale").step(.01).min(0);let i=n.addFolder("Recording");i.add(this,"record"),i.add({format:"png"},"format",["png","jpg"]).onChange((e=>{this.setup_capturer(e)})),void 0===t.play&&(t.play=!0),void 0===t.loopMode&&(t.loopMode=three__WEBPACK_IMPORTED_MODULE_3__.LoopRepeat),void 0===t.repetitions&&(t.repetitions=1),void 0===t.clampWhenFinished&&(t.clampWhenFinished=!0),this.duration=0,this.progress=0;for(let n of e){let e=this.viewer.scene_tree.find(n.path).object,i=three__WEBPACK_IMPORTED_MODULE_3__.AnimationClip.parse(n.clip);i.uuid=three__WEBPACK_IMPORTED_MODULE_3__.MathUtils.generateUUID();let r=this.mixer.clipAction(i,e);r.clampWhenFinished=t.clampWhenFinished,r.setLoop(t.loopMode,t.repetitions),this.actions.push(r),this.duration=Math.max(this.duration,i.duration)}this.time_scrubber.min(0),this.time_scrubber.max(this.duration),this.reset(),t.play&&this.play()}update(){if(this.playing){if(this.mixer.update(this.clock.getDelta()),this.viewer.set_dirty(),0!=this.duration){let e=this.actions.reduce(((e,t)=>Math.max(e,t.time)),0);this.display_progress(e)}else this.display_progress(0);if(this.actions.every((e=>e.paused))){this.pause();for(let e of this.actions)e.reset()}}}after_render(){this.recording&&this.capturer.capture(this.viewer.renderer.domElement)}}function gradient_texture(e,t){var n=new Uint8Array(8);for(let i=0;i<3;++i)n[i]=t[i],n[4+i]=e[i];n[3]=n[7]=255;var i=new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(n,1,2,three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);return i.magFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,i.encoding=three__WEBPACK_IMPORTED_MODULE_3__.LinearEncoding,i.matrixAutoUpdate=!1,i.matrix.set(.5,0,.25,0,.5,.25,0,0,1),i.needsUpdate=!0,i}class Viewer{constructor(e,t,n){this.dom_element=e,void 0===n?(this.renderer=new three__WEBPACK_IMPORTED_MODULE_3__.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=three__WEBPACK_IMPORTED_MODULE_3__.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.renderer.setPixelRatio(window.devicePixelRatio),this.scene=create_default_scene(),this.gui_controllers={},this.keydown_callbacks={},this.create_scene_tree(),this.add_default_scene_elements(),this.set_dirty(),this.create_camera(),this.num_messages_received=0,window.onload=e=>this.set_3d_pane_size(),window.addEventListener("resize",(e=>this.set_3d_pane_size()),!1),window.addEventListener("keydown",(e=>{this.on_keydown(e)})),requestAnimationFrame((()=>this.set_3d_pane_size())),(t||void 0===t)&&this.animate()}on_keydown(e){if(e.code in this.keydown_callbacks)for(const t of this.keydown_callbacks[e.code])t.callback(e)}hide_background(){this.scene.background=null,this.set_dirty()}show_background(){var e=this.scene_tree.find(["Background"]).object.top_color,t=this.scene_tree.find(["Background"]).object.bottom_color;this.scene.background=gradient_texture(e,t),this.set_dirty()}set_dirty(){this.needs_render=!0}create_camera(){let e=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;e.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],e.toArray());let t=new three__WEBPACK_IMPORTED_MODULE_3__.PerspectiveCamera(75,1,.01,100);this.set_camera(t),this.set_object(["Cameras","default","rotated"],t),t.position.set(3,1,0)}create_default_spot_light(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.SpotLight(16777215,.8);return e.position.set(1.5,1.5,2),e.castShadow=!1,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024,e.shadow.camera.near=.5,e.shadow.camera.far=50,e.shadow.bias=-.001,e}add_default_scene_elements(){var e=this.create_default_spot_light();this.set_object(["Lights","SpotLight"],e),this.set_property(["Lights","SpotLight"],"visible",!1);var t=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);t.position.set(1.5,1.5,2),t.castShadow=!1,t.distance=10,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,t.shadow.camera.near=.5,t.shadow.camera.far=10,t.shadow.bias=-.001,this.set_object(["Lights","PointLightNegativeX"],t);var n=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);n.position.set(-1.5,-1.5,2),n.castShadow=!1,n.distance=10,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,n.shadow.camera.near=.5,n.shadow.camera.far=10,n.shadow.bias=-.001,this.set_object(["Lights","PointLightPositiveX"],n);var i=new three__WEBPACK_IMPORTED_MODULE_3__.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new three__WEBPACK_IMPORTED_MODULE_3__.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var s=new three__WEBPACK_IMPORTED_MODULE_3__.GridHelper(20,40);s.rotateX(Math.PI/2),this.set_object(["Grid"],s);var o=new three__WEBPACK_IMPORTED_MODULE_3__.AxesHelper(.5);this.set_object(["Axes"],o)}create_scene_tree(){this.gui&&this.gui.destroy(),this.gui=new dat.GUI({autoPlace:!1}),this.dom_element.parentElement.appendChild(this.gui.domElement),this.gui.domElement.style.position="absolute",this.gui.domElement.style.right=0,this.gui.domElement.style.top=0;let e=this.gui.addFolder("Scene");e.open(),this.scene_tree=new SceneNode(this.scene,e,(()=>this.set_dirty()));let t=this.gui.addFolder("Save / Load / Capture");t.add(this,"save_scene"),t.add(this,"load_scene"),t.add(this,"save_image"),this.animator=new Animator(this),this.gui.close(),this.set_property(["Background"],"top_color",[135/255,206/255,250/255]),this.set_property(["Background"],"bottom_color",[25/255,25/255,112/255]),this.scene_tree.find(["Background"]).on_update=()=>{this.scene_tree.find(["Background"]).object.visible?this.show_background():this.hide_background()},this.show_background()}set_3d_pane_size(e,t){void 0===e&&(e=this.dom_element.offsetWidth),void 0===t&&(t=this.dom_element.offsetHeight),"OrthographicCamera"==this.camera.type?this.camera.right=this.camera.left+e*(this.camera.top-this.camera.bottom)/t:this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.set_dirty()}render(){this.controls.update(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.animator.after_render(),this.needs_render=!1}animate(){requestAnimationFrame((()=>this.animate())),this.animator.update(),this.needs_render&&this.render()}capture_image(e,t){let n=this.dom_element.offsetWidth,i=this.dom_element.offsetHeight;this.set_3d_pane_size(e,t),this.render();let r=this.renderer.domElement.toDataURL();return this.set_3d_pane_size(n,i),r}save_image(){download_data_uri("meshcat.png",this.capture_image())}set_camera(e){this.camera=e,this.controls=new three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__.z(e,this.dom_element),this.controls.enableKeys=!1,this.controls.screenSpacePanning=!0,this.controls.addEventListener("start",(()=>{this.set_dirty()})),this.controls.addEventListener("change",(()=>{this.set_dirty()}))}set_camera_target(e){this.controls.target.set(e[0],e[1],e[2])}set_camera_from_json(e){(new ExtensibleObjectLoader).parse(e,(e=>{this.set_camera(e)}))}set_transform(e,t){this.scene_tree.find(e).set_transform(t)}set_object(e,t){this.scene_tree.find(e.concat([""])).set_object(t)}set_object_from_json(e,t){let n=new ExtensibleObjectLoader;n.onTextureLoad=()=>{this.set_dirty()},n.parse(t,(t=>{void 0!==t.geometry&&"BufferGeometry"==t.geometry.type?void 0!==t.geometry.attributes.normal&&0!==t.geometry.attributes.normal.count||t.geometry.computeVertexNormals():t.type.includes("Camera")&&(this.set_camera(t),this.set_3d_pane_size()),t.castShadow=!0,t.receiveShadow=!0,this.set_object(e,t),this.set_dirty()}))}delete_path(e){0==e.length?console.error("Deleting the entire scene is not implemented"):this.scene_tree.delete(e)}set_property(e,t,n){this.scene_tree.find(e).set_property(t,n),"Background"===e[0]&&this.scene_tree.find(e).on_update()}set_animation(e,t){t=t||{},this.animator.load(e,t)}set_control(name,callback,value,min,max,step,keycode1,keycode2){let my_callback=eval(callback),handler={};if(name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value){function e(e,t,n){if(null!=t){let i={name,callback:()=>{value=e.gui_controllers[name].getValue();let t=Math.min(Math.max(value+n,min),max);e.gui_controllers[name].setValue(t)}};t in e.keydown_callbacks?e.keydown_callbacks[t].push(i):e.keydown_callbacks[t]=[i]}}handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(my_callback),e(this,keycode1,-step),e(this,keycode2,+step)}else if(handler[name]=my_callback,this.gui_controllers[name]=this.gui.add(handler,name),this.gui_controllers[name].domElement.parentElement.querySelector(".property-name").style.width="100%",null!=keycode1){let e={name,callback:my_callback};keycode1 in this.keydown_callbacks?this.keydown_callbacks[keycode1].push(e):this.keydown_callbacks[keycode1]=[e]}}set_control_value(e,t,n=!0){e in this.gui_controllers&&this.gui_controllers[e]instanceof dat.controllers.NumberController&&(n?this.gui_controllers[e].setValue(t):(this.gui_controllers[e].object[e]=t,this.gui_controllers[e].updateDisplay()))}delete_control(e){e in this.gui_controllers&&(this.gui.remove(this.gui_controllers[e]),delete this.gui_controllers[e]);for(let t in this.keydown_callbacks){let n=this.keydown_callbacks[t].length;for(;n--;)this.keydown_callbacks[t][n].name==e&&this.keydown_callbacks[t].splice(n,1)}}handle_command(e){if("set_transform"==e.type){let t=split_path(e.path);this.set_transform(t,e.matrix)}else if("delete"==e.type){let t=split_path(e.path);this.delete_path(t)}else if("set_object"==e.type){let t=split_path(e.path);this.set_object_from_json(t,e.object)}else if("set_property"==e.type){let t=split_path(e.path);this.set_property(t,e.property,e.value)}else if("set_animation"==e.type)e.animations.forEach((e=>{e.path=split_path(e.path)})),this.set_animation(e.animations,e.options);else if("set_target"==e.type)this.set_camera_target(e.value);else if("set_control"==e.type)this.set_control(e.name,e.callback,e.value,e.min,e.max,e.step,e.keycode1,e.keycode2);else if("set_control_value"==e.type)this.set_control_value(e.name,e.value,e.invoke_callback);else if("delete_control"==e.type)this.delete_control(e.name);else if("capture_image"==e.type){let t=e.xres||1920,n=e.yres||1080;t/=this.renderer.getPixelRatio(),n/=this.renderer.getPixelRatio();let i=this.capture_image(t,n);this.connection.send(JSON.stringify({type:"img",data:i}))}else"save_image"==e.type&&this.save_image();this.set_dirty()}decode(e){return msgpack.decode(new Uint8Array(e.data),{extensionCodec})}handle_command_bytearray(e){let t=msgpack.decode(e,{extensionCodec});this.handle_command(t)}handle_command_message(e){this.num_messages_received++;let t=this.decode(e);this.handle_command(t)}connect(e){void 0===e&&(e=`ws://${location.host}`),"https:"==location.protocol&&(e=e.replace("ws:","wss:")),this.connection=new WebSocket(e),this.connection.binaryType="arraybuffer",this.connection.onmessage=e=>this.handle_command_message(e),this.connection.onclose=function(e){console.log("onclose:",e)}}save_scene(){download_file("scene.json",JSON.stringify(this.scene.toJSON()))}load_scene_from_json(e){let t=new ExtensibleObjectLoader;t.onTextureLoad=()=>{this.set_dirty()},this.scene_tree.dispose_recursive(),this.scene=t.parse(e),this.show_background(),this.create_scene_tree();let n=this.scene_tree.find(["Cameras","default","rotated",""]);n.object.isCamera?this.set_camera(n.object):this.create_camera()}handle_load_file(e){let t=e.files[0];if(!t)return;let n=new FileReader,i=this;n.onload=function(e){let t=this.result,n=JSON.parse(t);i.load_scene_from_json(n)},n.readAsText(t)}load_scene(){let e=document.createElement("input");e.type="file",document.body.appendChild(e);let t=this;e.addEventListener("change",(function(){console.log(this,t),t.handle_load_file(this)}),!1),e.click(),e.remove()}}function split_path(e){return e.split("/").filter((e=>e.length>0))}let style=document.createElement("style");style.appendChild(document.createTextNode("")),document.head.appendChild(style),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input {\n float: right;\n }"),style.sheet.insertRule("\n .meshcat-hidden-scene-element li .meshcat-visibility-checkbox {\n opacity: 0.25;\n pointer-events: none;\n }"),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input[type=checkbox] {\n height: 16px;\n width: 16px;\n display:inline-block;\n padding: 0 0 0 0px;\n }")})(),__webpack_exports__})()})); \ No newline at end of file From 956b73f6a96c707372b7f4c55905a30fc6f0411f Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Wed, 14 Dec 2022 16:16:23 +0000 Subject: [PATCH 5/5] Update main.min.js --- dist/main.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/main.min.js b/dist/main.min.js index ed7665a..a9bf17e 100644 --- a/dist/main.min.js +++ b/dist/main.min.js @@ -1,2 +1,2 @@ /*! For license information please see main.min.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MeshCat=t():e.MeshCat=t()}(self,(function(){return(()=>{var __webpack_modules__={583:(e,t,n)=>{var i;e=n.nmd(e),function(){if(void 0!==e.exports)var r=n(617),s=n(549),o=n(468);var a={function:!0,object:!0};function l(e){return e&&e.Object===Object?e:null}parseFloat,parseInt;var c=a[typeof t]&&t&&!t.nodeType?t:void 0,h=a.object&&e&&!e.nodeType?e:void 0,u=(h&&h.exports,l(c&&h&&"object"==typeof n.g&&n.g)),d=l(a[typeof self]&&self),p=l(a[typeof window]&&window),f=l(a[typeof this]&&this);function m(e){return String("0000000"+e).slice(-7)}u||p!==(f&&f.window)&&p||d||f||Function("return this")(),"gc"in window||(window.gc=function(){}),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),r=i.length,s=new Uint8Array(r),o=0;o=c.frameLimit||c.timeLimit&&e>=c.timeLimit)&&(H(),W());var t=new Date(null);t.setSeconds(e),c.motionBlurFrames>2?_.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+t.toISOString().substr(11,8):_.textContent="CCapture "+c.format+" | "+d+" frames | "+t.toISOString().substr(11,8)}(),j("Frame: "+d+" "+p);for(var s=0;s=h[s].triggerTime&&(G(h[s].callback),h.splice(s,1));for(s=0;s=u[s].triggerTime&&(G(u[s].callback),u[s].triggerTime+=u[s].time);f.forEach((function(e){G(e,n-g)})),f=[]}function W(e){e||(e=function(e){return s(e,l.filename+l.extension,l.mimeType),!1}),l.save(e)}function j(e){t&&console.log(e)}return{start:function(){!function(){function e(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),z.push(this)),this._hookedTime+c.startTime}j("Capturer start"),i=window.Date.now(),n=i+c.startTime,o=window.performance.now(),r=o+c.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(e,t){var i={callback:e,time:t,triggerTime:n+t};return h.push(i),j("Timeout set to "+i.time),i},window.clearTimeout=function(e){for(var t=0;t2?(function(e){A.width===e.width&&A.height===e.height||(A.width=e.width,A.height=e.height,E=new Uint16Array(A.height*A.width*4),C.fillStyle="#0",C.fillRect(0,0,A.width,A.height))}(e),function(e){C.drawImage(e,0,0),T=C.getImageData(0,0,A.width,A.height);for(var t=0;t=.5*c.motionBlurFrames?function(){for(var e=T.data,t=0;t0&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(e){this.filename=this.baseFilename+"-part-"+m(this.part),s(e,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+m(this.part),this.step()}.bind(this)):this.step()},b.prototype.save=function(e){this.videoWriter.complete().then(e)},b.prototype.dispose=function(e){this.frames=[]},w.prototype=Object.create(y.prototype),w.prototype.start=function(){this.encoder.start(this.settings)},w.prototype.add=function(e){this.encoder.add(e)},w.prototype.save=function(e){this.callback=e,this.encoder.end()},w.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},M.prototype=Object.create(y.prototype),M.prototype.add=function(e){this.stream||(this.stream=e.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(e){this.chunks.push(e.data)}.bind(this)),this.step()},M.prototype.save=function(e){this.mediaRecorder.onstop=function(t){var n=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],e(n)}.bind(this),this.mediaRecorder.stop()},S.prototype=Object.create(y.prototype),S.prototype.add=function(e){this.sizeSet||(this.encoder.setOption("width",e.width),this.encoder.setOption("height",e.height),this.sizeSet=!0),this.canvas.width=e.width,this.canvas.height=e.height,this.ctx.drawImage(e,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},S.prototype.save=function(e){this.callback=e,this.encoder.render()},(p||d||{}).CCapture=E,void 0===(i=function(){return E}.call(t,n,t,e))||(e.exports=i)}()},549:e=>{void 0!==e.exports&&(e.exports=function(e,t,n){var i,r,s,o=window,a="application/octet-stream",l=n||a,c=e,h=document,u=h.createElement("a"),d=function(e){return String(e)},p=o.Blob||o.MozBlob||o.WebKitBlob||d,f=o.MSBlobBuilder||o.WebKitBlobBuilder||o.BlobBuilder,m=t||"download";if("true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(e){for(var t=e.split(/[:;,]/),n=t[1],i=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=i.length,s=0,o=new Uint8Array(r);s{e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=void 0,o=0;o0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,o,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){var i=e("./TypedNeuQuant.js"),r=e("./LZWEncoder.js");function s(){this.page=-1,this.pages=[],this.newPage()}s.pageSize=4096,s.charMap={};for(var o=0;o<256;o++)s.charMap[o]=String.fromCharCode(o);function a(e,t){this.width=~~e,this.height=~~t,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new s}s.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(s.pageSize),this.cursor=0},s.prototype.getData=function(){for(var e="",t=0;t=s.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=e},s.prototype.writeUTFBytes=function(e){for(var t=e.length,n=0;n=0&&(this.dispose=e)},a.prototype.setRepeat=function(e){this.repeat=e},a.prototype.setTransparent=function(e){this.transparent=e},a.prototype.addFrame=function(e){this.image=e,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},a.prototype.finish=function(){this.out.writeByte(59)},a.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},a.prototype.setDither=function(e){!0===e&&(e="FloydSteinberg"),this.dither=e},a.prototype.setGlobalPalette=function(e){this.globalPalette=e},a.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},a.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},a.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new i(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},a.prototype.indexPixels=function(e){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var n=0,i=0;i=0&&b+h=0&&w+c>16,(65280&e)>>8,255&e,t)},a.prototype.findClosestRGB=function(e,t,n,i){if(null===this.colorTab)return-1;if(this.neuQuant&&!i)return this.neuQuant.lookupRGB(e,t,n);for(var r=0,s=16777216,o=this.colorTab.length,a=0,l=0;a=0&&(t=7&this.dispose),t<<=2,this.out.writeByte(0|t|e),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},a.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},a.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},a.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},a.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},a.prototype.writePixels=function(){new r(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},a.prototype.stream=function(){return this.out},t.exports=a},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(e,t,n){var i=5003,r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var o,a,l,c,h,u,d=Math.max(2,s),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,y=0,_=!1;function v(e,t){p[a++]=e,a>=254&&w(t)}function x(e){b(i),y=h+2,_=!0,E(h,e)}function b(e){for(var t=0;t0&&(e.writeByte(a),e.writeBytes(p,0,a),a=0)}function M(e){return(1<0?o|=e<=8;)v(255&o,t),o>>=8,g-=8;if((y>l||_)&&(_?(l=M(n_bits=c),_=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),e==u){for(;g>0;)v(255&o,t),o>>=8,g-=8;w(t)}}this.encode=function(n){n.writeByte(d),remaining=e*t,curPixel=0,function(e,t){var n,r,s,o,d,p;for(c=e,_=!1,n_bits=c,l=M(n_bits),u=1+(h=1<=0){d=5003-s,0===s&&(d=1);do{if((s-=d)<0&&(s+=5003),f[s]===n){o=m[s];continue e}}while(f[s]>=0)}E(o,t),o=r,y<4096?(m[s]=y++,f[s]=n):x(t)}else o=m[s];E(o,t),E(u,t)}(d+1,n),n.writeByte(0)}}},{}],4:[function(e,t,n){var i=256,r=1024,s=1<<18;t.exports=function(e,t){var n,o,a,l,c;function h(e,t,i,s,o){n[t][0]-=e*(n[t][0]-i)/r,n[t][1]-=e*(n[t][1]-s)/r,n[t][2]-=e*(n[t][2]-o)/r}function u(e,t,r,o,a){for(var l,h,u=Math.abs(t-e),d=Math.min(t+e,i),p=t+1,f=t-1,m=1;pu;)h=c[m++],pu&&((l=n[f--])[0]-=h*(l[0]-r)/s,l[1]-=h*(l[1]-o)/s,l[2]-=h*(l[2]-a)/s)}function d(e,t,r){var s,o,c,h,u,d=~(1<<31),p=d,f=-1,m=f;for(s=0;s>12))>10,l[s]-=u,a[s]+=u<<10;return l[f]+=64,a[f]-=65536,m}this.buildColormap=function(){(function(){var e,t;for(n=[],o=new Int32Array(256),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),e=0;e>6;for(v<=1&&(v=0),n=0;n=p&&(x-=p),0===g&&(g=1),++n%g==0)for(y-=y/f,(v=(_-=_/30)>>6)<=1&&(v=0),l=0;l>=4,n[e][1]>>=4,n[e][2]>>=4,n[e][3]=e}(),function(){var e,t,r,s,a,l,c=0,h=0;for(e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)o[t]=255}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)u=c?u=i:(u++,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)=0&&((l=t-(a=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)t;0<=t?++e:--e)n.push(null);return n}.call(this),t=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(e=0,n=t;0<=n?en;0<=n?++e:--e)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},i.prototype.abort=function(){for(var e;null!=(e=this.activeWorkers.shift());)this.log("killing active worker"),e.terminate();return this.running=!1,this.emit("abort")},i.prototype.spawnWorkers=function(){var e,t,n,i;return e=Math.min(this.options.workers,this.frames.length),function(){n=[];for(var i=t=this.freeWorkers.length;t<=e?ie;t<=e?i++:i--)n.push(i);return n}.apply(this).forEach((i=this,function(e){var t;return i.log("spawning worker "+e),(t=new Worker(i.options.workerScript)).onmessage=function(e){return i.activeWorkers.splice(i.activeWorkers.indexOf(t),1),i.freeWorkers.push(t),i.frameFinished(e.data)},i.freeWorkers.push(t)})),e},i.prototype.frameFinished=function(e){var t,n;if(this.log("frame "+e.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[e.index]=e,!0===this.options.globalPalette&&(this.options.globalPalette=e.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(t=1,n=this.freeWorkers.length;1<=n?tn;1<=n?++t:--t)this.renderNextFrame();return o.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m;for(a=0,r=0,l=(p=this.imageParts).length;r=this.frames.length))return e=this.frames[this.nextFrame++],n=this.freeWorkers.shift(),t=this.getTask(e),this.log("starting frame "+(t.index+1)+" of "+this.frames.length),this.activeWorkers.push(n),n.postMessage(t)},i.prototype.getContextData=function(e){return e.getImageData(0,0,this.options.width,this.options.height).data},i.prototype.getImageData=function(e){var t;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(t=this._canvas.getContext("2d")).setFill=this.options.background,t.fillRect(0,0,this.options.width,this.options.height),t.drawImage(e,0,0),this.getContextData(t)},i.prototype.getTask=function(e){var t,n;if(n={index:t=this.frames.indexOf(e),last:t===this.frames.length-1,delay:e.delay,dispose:e.dispose,transparent:e.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===r.name},null!=e.data)n.data=e.data;else if(null!=e.context)n.data=this.getContextData(e.context);else{if(null==e.image)throw new Error("Invalid frame");n.data=this.getImageData(e.image)}return n},i.prototype.log=function(){var e;if(e=1<=arguments.length?a.call(arguments,0):[],this.options.debug)return console.log.apply(console,e)},i}(i)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(e,t,n){var i,r;i=e("./GIFEncoder.js"),r=function(e){var t,n,r,s;return t=new i(e.width,e.height),0===e.index?t.writeHeader():t.firstFrame=!1,t.setTransparent(e.transparent),t.setDispose(e.dispose),t.setRepeat(e.repeat),t.setDelay(e.delay),t.setQuality(e.quality),t.setDither(e.dither),t.setGlobalPalette(e.globalPalette),t.addFrame(e.data),e.last&&t.finish(),!0===e.globalPalette&&(e.globalPalette=t.getGlobalPalette()),r=t.stream(),e.data=r.pages,e.cursor=r.cursor,e.pageSize=r.constructor.pageSize,e.canTransfer?(s=function(){var t,i,r,s;for(s=[],t=0,i=(r=e.data).length;t{!function(){"use strict";var e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];function t(e){var t,n=new Uint8Array(e);for(t=0;t>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];switch(a.length%4){case 1:a+="=";break;case 2:a+="=="}return a}}(),function(){"use strict";var e,t=window.utils;e=[{field:"fileName",length:100},{field:"fileMode",length:8},{field:"uid",length:8},{field:"gid",length:8},{field:"fileSize",length:12},{field:"mtime",length:12},{field:"checksum",length:8},{field:"type",length:1},{field:"linkName",length:100},{field:"ustar",length:8},{field:"owner",length:32},{field:"group",length:32},{field:"majorNumber",length:8},{field:"minorNumber",length:8},{field:"filenamePrefix",length:155},{field:"padding",length:12}],window.header={},window.header.structure=e,window.header.format=function(n,i){var r=t.clean(512),s=0;return e.forEach((function(e){var t,i,o=n[e.field]||"";for(t=0,i=o.length;ti&&(t.push({blocks:r,length:n}),r=[],n=0),r.push(e),n+=e.headerLength+e.inputLength})),t.push({blocks:r,length:n}),t.forEach((function(t){var n=new Uint8Array(t.length),i=0;t.blocks.forEach((function(e){n.set(e.header,i),i+=e.headerLength,n.set(e.input,i),i+=e.inputLength})),e.push(n)})),e.push(new Uint8Array(1024)),new Blob(e,{type:"octet/stream"})},s.prototype.clear=function(){this.written=0,this.out=i.clean(t)},void 0!==e.exports?e.exports=s:window.Tar=s}()},376:(e,t,n)=>{"use strict";function i(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),s=Math.round(e.b),o=e.a,a=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+s+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+s+","+o+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+s+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+s+","+o+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+",a:"+o+"}":"unknown format"}n.d(t,{ZP:()=>he});var r=Array.prototype.forEach,s=Array.prototype.slice,o={BREAK:{},extend:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=s.call(arguments);return function(){for(var t=s.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(r&&e.forEach&&e.forEach===r)e.forEach(t,n);else if(e.length===e.length+0){var i,s=void 0;for(s=0,i=e.length;s1?o.toArray(arguments):arguments[0];return o.each(a,(function(t){if(t.litmus(e))return o.each(t.conversions,(function(t,n){if(l=t.read(e),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=t,o.BREAK})),o.BREAK})),c},u=void 0,d={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),s=n*(1-t),o=n*(1-r*t),a=n*(1-(1-r)*t),l=[[n,a,s],[o,n,s],[s,n,a],[s,o,n],[a,s,n],[n,s,o]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),s=r-i,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=e===r?(t-n)/s:t===r?2+(n-e)/s:4+(e-t)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(u=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var P=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=i||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,o.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=R(r.__impliedStep),r}return y(t,e),m(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=R(e),this}}]),t}(w),D=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function h(){T.unbind(window,"mousemove",c),T.unbind(window,"mouseup",h),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"change",(function(){var e=parseFloat(s.__input.value);o.isNaN(e)||s.setValue(e)})),T.bind(r.__input,"blur",(function(){l()})),T.bind(r.__input,"mousedown",(function(e){T.bind(window,"mousemove",c),T.bind(window,"mouseup",h),a=e.clientY})),T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P);function I(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var O=function(e){function t(e,n,i,r,s){f(this,t);var o=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:s})),a=o;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(I(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function c(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(I(t,n.left,n.right,a.__min,a.__max))}function u(){T.unbind(window,"touchmove",h),T.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),T.bind(o.__background,"mousedown",(function(e){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(e)})),T.bind(o.__background,"touchstart",(function(e){1===e.touches.length&&(T.bind(window,"touchmove",h),T.bind(window,"touchend",u),h(e))})),T.addClass(o.__background,"slider"),T.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P),k=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,T.bind(r.__button,"click",(function(e){return e.preventDefault(),s.fire(),!1})),T.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return y(t,e),m(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(w),N=function(e){function t(e,n){f(this,t);var i=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new v(i.getValue()),i.__temp=new v(0);var r=i;i.domElement=document.createElement("div"),T.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",T.bind(i.__input,"keydown",(function(e){13===e.keyCode&&p.call(this)})),T.bind(i.__input,"blur",p),T.bind(i.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(r.__selector,"drag")}))})),T.bind(i.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(r.__selector,"drag")}))}));var s,a=document.createElement("div");function l(e){g(e),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",u),T.bind(window,"touchend",u)}function c(e){y(e),T.bind(window,"mousemove",y),T.bind(window,"touchmove",y),T.bind(window,"mouseup",d),T.bind(window,"touchend",d)}function u(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",u),T.unbind(window,"touchend",u),m()}function d(){T.unbind(window,"mousemove",y),T.unbind(window,"touchmove",y),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var e=h(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function m(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function g(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,s=n.clientY,o=(i-t.left)/(t.right-t.left),a=1-(s-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function y(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return o.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),o.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),o.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),o.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),o.extend(a.style,{width:"100%",height:"100%",background:"none"}),U(a,"top","rgba(0,0,0,0)","#000"),o.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=i.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(i.__saturation_field,"mousedown",l),T.bind(i.__saturation_field,"touchstart",l),T.bind(i.__field_knob,"mousedown",l),T.bind(i.__field_knob,"touchstart",l),T.bind(i.__hue_field,"mousedown",c),T.bind(i.__hue_field,"touchstart",c),i.__saturation_field.appendChild(a),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=h(this.getValue());if(!1!==e){var t=!1;o.each(v.COMPONENTS,(function(n){if(!o.isUndefined(e[n])&&!o.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&o.extend(this.__color.__state,e)}o.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;o.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,U(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),o.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(w),B=["-moz-","-o-","-webkit-","-ms-",""];function U(e,t,n,i){e.style.background="",o.each(B,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var F='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',z=function(e,t){var n=e[t];return o.isArray(arguments[2])||o.isObject(arguments[2])?new C(e,t,arguments[2]):o.isNumber(n)?o.isNumber(arguments[2])&&o.isNumber(arguments[3])?o.isNumber(arguments[4])?new O(e,t,arguments[2],arguments[3],arguments[4]):new O(e,t,arguments[2],arguments[3]):o.isNumber(arguments[4])?new D(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new D(e,t,{min:arguments[2],max:arguments[3]}):o.isString(n)?new L(e,t):o.isFunction(n)?new k(e,t,""):o.isBoolean(n)?new A(e,t):null},H=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},G=function(){function e(){f(this,e),this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;T.bind(this.backgroundElement,"click",(function(){t.hide()}))}return m(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",T.unbind(e.domElement,"webkitTransitionEnd",t),T.unbind(e.domElement,"transitionend",t),T.unbind(e.domElement,"oTransitionEnd",t)};T.bind(this.domElement,"webkitTransitionEnd",t),T.bind(this.domElement,"transitionend",t),T.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if("undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var V="Default",W=function(){try{return!!window.localStorage}catch(e){return!1}}(),j=void 0,q=!0,X=void 0,J=!1,Y=[],Z=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=o.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=o.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),o.isUndefined(i.load)?i.load={preset:V}:i.preset&&(i.load.preset=i.preset),o.isUndefined(i.parent)&&i.hideable&&Y.push(this),i.resizable=o.isUndefined(i.parent)&&i.resizable,i.autoPlace&&o.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,s=W&&"true"===localStorage.getItem(ne(0,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:i,factoryArgs:[o.toArray(arguments)]})}if(o.isArray(t)||o.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof O){var i=new D(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});o.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),T.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof D){var r=function(t){if(o.isNumber(n.__min)&&o.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=te(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(i),r&&s.listen(),s}return t};n.min=o.compose(r,n.min),n.max=o.compose(r,n.max)}else n instanceof A?(T.bind(t,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof k?(T.bind(t,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(t,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(t,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof N&&(T.addClass(t,"color"),n.updateDisplay=o.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=o.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&$(e.getRoot(),!0),t}),n.setValue)}(e,c,r),e.__controllers.push(r),r}function ne(e,t){return document.location.href+"."+t}function ie(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function re(e,t){t.style.display=e.useLocalStorage?"block":"none"}function se(e){var t=e.__save_row=document.createElement("li");T.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),T.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",T.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",T.addClass(i,"button"),T.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",T.addClass(r,"button"),T.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",T.addClass(s,"button"),T.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?o.each(e.load.remembered,(function(t,n){ie(e,n,n===e.preset)})):ie(e,V,!1),T.bind(a,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=le(this)),e.folders={},o.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=le(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=le(this,!0)),this.load.remembered[e]=le(this),this.preset=e,ie(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){o.each(this.__controllers,(function(t){this.getRoot().load.remembered?ee(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),o.each(this.__folders,(function(e){e.revert(e)})),e||$(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&ce(this.__listening)},updateDisplay:function(){o.each(this.__controllers,(function(e){e.updateDisplay()})),o.each(this.__folders,(function(e){e.updateDisplay()}))}});const he={color:{Color:v,math:d,interpret:h},controllers:{Controller:w,BooleanController:A,OptionController:C,StringController:L,NumberController:P,NumberControllerBox:D,NumberControllerSlider:O,FunctionController:k,ColorController:N},dom:{dom:T},gui:{GUI:Z},GUI:Z}},973:(e,t,n)=>{"use strict";n.d(t,{eW:()=>S,oe:()=>x});var i=n(477);class r{static addMaterial(e,t,n,i,r){let s;t.name=n,i?(e[n]=t,r&&console.info('Material with name "'+n+'" was forcefully overridden.')):(s=e[n],s?s.uuid!=s.uuid&&r&&console.log('Same material name "'+s.name+'" different uuid ['+s.uuid+"|"+t.uuid+"]"):(e[n]=t,r&&console.info('Material with name "'+n+'" was added.')))}static getMaterialsJSON(e){const t={};let n;for(const i in e)n=e[i],"function"==typeof n.toJSON&&(t[i]=n.toJSON());return t}static cloneMaterial(e,t,n){let i;if(t){let s=t.materialNameOrg;s=null!=s?s:"";const o=e[s];o?(i=o.clone(),Object.assign(i,t.materialProperties),r.addMaterial(e,i,t.materialProperties.name,!0)):n&&console.info('Requested material "'+s+'" is not available!')}return i}}class s{static buildThreeConst(){return"const EventDispatcher = THREE.EventDispatcher;\nconst BufferGeometry = THREE.BufferGeometry;\nconst BufferAttribute = THREE.BufferAttribute;\nconst Box3 = THREE.Box3;\nconst Sphere = THREE.Sphere;\nconst Texture = THREE.Texture;\nconst MaterialLoader = THREE.MaterialLoader;\n"}static buildUglifiedThreeMapping(){return s.buildUglifiedNameAssignment((function(){return i.BufferGeometry}),"BufferGeometry",/_BufferGeometry/,!1)+s.buildUglifiedNameAssignment((function(){return i.BufferAttribute}),"BufferAttribute",/_BufferAttribute/,!1)+s.buildUglifiedNameAssignment((function(){return i.Box3}),"Box3",/_Box3/,!1)+s.buildUglifiedNameAssignment((function(){return i.Sphere}),"Sphere",/_Sphere/,!1)+s.buildUglifiedNameAssignment((function(){return i.Texture}),"Texture",/_Texture/,!1)+s.buildUglifiedNameAssignment((function(){return i.MaterialLoader}),"MaterialLoader",/_MaterialLoader/,!1)}static buildUglifiedThreeWtmMapping(){return s.buildUglifiedNameAssignment((function(){return o}),"DataTransport",/_DataTransport/,!0)+s.buildUglifiedNameAssignment((function(){return l}),"GeometryTransport",/_GeometryTransport/,!0)+s.buildUglifiedNameAssignment((function(){return c}),"MeshTransport",/_MeshTransport/,!0)+s.buildUglifiedNameAssignment((function(){return a}),"MaterialsTransport",/_MaterialsTransport/,!0)+s.buildUglifiedNameAssignment((function(){return r}),"MaterialUtils",/_MaterialUtils/,!0)}static buildUglifiedNameAssignment(e,t,n,i){let r=e.toString();r=r.replace(n,"").replace(/[\r\n]+/gm,""),r=r.replace(/.*return/,"").replace(/\}/,"").replace(/;/gm,"");const s=r.trim();let o="";return s!==t&&(o="const "+(i?t:s)+" = "+(i?s:t)+";\n"),o}}class o{constructor(e,t){this.main={cmd:void 0!==e?e:"unknown",id:void 0!==t?t:0,type:"DataTransport",progress:0,buffers:{},params:{}},this.transferables=[]}loadData(e){return this.main.cmd=e.cmd,this.main.id=e.id,this.main.type="DataTransport",this.setProgress(e.progress),this.setParams(e.params),e.buffers&&Object.entries(e.buffers).forEach((([e,t])=>{this.main.buffers[e]=t})),this}getCmd(){return this.main.cmd}getId(){return this.main.id}setParams(e){return null!=e&&(this.main.params=e),this}getParams(){return this.main.params}setProgress(e){return this.main.progress=e,this}addBuffer(e,t){return this.main.buffers[e]=t,this}getBuffer(e){return this.main.buffers[e]}package(e){for(let t of Object.values(this.main.buffers))if(null!=t){const n=e?t.slice(0):t;this.transferables.push(n)}return this}getMain(){return this.main}getTransferables(){return this.transferables}postMessage(e){return e.postMessage(this.main,this.transferables),this}}class a extends o{constructor(e,t){super(e,t),this.main.type="MaterialsTransport",this.main.materials={},this.main.multiMaterialNames={},this.main.cloneInstructions=[]}loadData(e){super.loadData(e),this.main.type="MaterialsTransport",Object.assign(this.main,e);const t=new i.MaterialLoader;return Object.entries(this.main.materials).forEach((([e,n])=>{this.main.materials[e]=t.parse(n)})),this}_cleanMaterial(e){return Object.entries(e).forEach((([t,n])=>{(n instanceof i.Texture||null===n)&&(e[t]=void 0)})),e}addBuffer(e,t){return super.addBuffer(e,t),this}setParams(e){return super.setParams(e),this}setMaterials(e){return null!=e&&Object.keys(e).length>0&&(this.main.materials=e),this}getMaterials(){return this.main.materials}cleanMaterials(){let e,t={};for(let n of Object.values(this.main.materials))"function"==typeof n.clone&&(e=n.clone(),t[e.name]=this._cleanMaterial(e));return this.setMaterials(t),this}package(e){return super.package(e),this.main.materials=r.getMaterialsJSON(this.main.materials),this}hasMultiMaterial(){return Object.keys(this.main.multiMaterialNames).length>0}getSingleMaterial(){return Object.keys(this.main.materials).length>0?Object.entries(this.main.materials)[0][1]:null}processMaterialTransport(e,t){for(let n=0;n{n[t]=e[i]}));else{const t=this.getSingleMaterial();null!==t&&(n=e[t.name],n||(n=t))}return n}}class l extends o{constructor(e,t){super(e,t),this.main.type="GeometryTransport",this.main.geometryType=0,this.main.geometry={},this.main.bufferGeometry=null}loadData(e){return super.loadData(e),this.main.type="GeometryTransport",this.setGeometry(e.geometry,e.geometryType)}getGeometryType(){return this.main.geometryType}setParams(e){return super.setParams(e),this}setGeometry(e,t){return this.main.geometry=e,this.main.geometryType=t,e instanceof i.BufferGeometry&&(this.main.bufferGeometry=e),this}package(e){super.package(e);const t=this.main.geometry.getAttribute("position"),n=this.main.geometry.getAttribute("normal"),i=this.main.geometry.getAttribute("uv"),r=this.main.geometry.getAttribute("color"),s=this.main.geometry.getAttribute("skinIndex"),o=this.main.geometry.getAttribute("skinWeight"),a=this.main.geometry.getIndex();return this._addBufferAttributeToTransferable(t,e),this._addBufferAttributeToTransferable(n,e),this._addBufferAttributeToTransferable(i,e),this._addBufferAttributeToTransferable(r,e),this._addBufferAttributeToTransferable(s,e),this._addBufferAttributeToTransferable(o,e),this._addBufferAttributeToTransferable(a,e),this}reconstruct(e){if(this.main.bufferGeometry instanceof i.BufferGeometry)return this;this.main.bufferGeometry=new i.BufferGeometry;const t=this.main.geometry;this._assignAttribute(t.attributes.position,"position",e),this._assignAttribute(t.attributes.normal,"normal",e),this._assignAttribute(t.attributes.uv,"uv",e),this._assignAttribute(t.attributes.color,"color",e),this._assignAttribute(t.attributes.skinIndex,"skinIndex",e),this._assignAttribute(t.attributes.skinWeight,"skinWeight",e);const n=t.index;if(null!=n){const t=e?n.array.slice(0):n.array;this.main.bufferGeometry.setIndex(new i.BufferAttribute(t,n.itemSize,n.normalized))}const r=t.boundingBox;null!==r&&(this.main.bufferGeometry.boundingBox=Object.assign(new i.Box3,r));const s=t.boundingSphere;return null!==s&&(this.main.bufferGeometry.boundingSphere=Object.assign(new i.Sphere,s)),this.main.bufferGeometry.uuid=t.uuid,this.main.bufferGeometry.name=t.name,this.main.bufferGeometry.type=t.type,this.main.bufferGeometry.groups=t.groups,this.main.bufferGeometry.drawRange=t.drawRange,this.main.bufferGeometry.userData=t.userData,this}getBufferGeometry(){return this.main.bufferGeometry}_addBufferAttributeToTransferable(e,t){if(null!=e){const n=t?e.array.slice(0):e.array;this.transferables.push(n.buffer)}return this}_assignAttribute(e,t,n){if(e){const r=n?e.array.slice(0):e.array;this.main.bufferGeometry.setAttribute(t,new i.BufferAttribute(r,e.itemSize,e.normalized))}return this}}class c extends l{constructor(e,t){super(e,t),this.main.type="MeshTransport",this.main.materialsTransport=new a}loadData(e){return super.loadData(e),this.main.type="MeshTransport",this.main.meshName=e.meshName,this.main.materialsTransport=(new a).loadData(e.materialsTransport.main),this}setParams(e){return super.setParams(e),this}setMaterialsTransport(e){return e instanceof a&&(this.main.materialsTransport=e),this}getMaterialsTransport(){return this.main.materialsTransport}setMesh(e,t){return this.main.meshName=e.name,super.setGeometry(e.geometry,t),this}package(e){return super.package(e),null!==this.main.materialsTransport&&this.main.materialsTransport.package(e),this}reconstruct(e){return super.reconstruct(e),this}}class h{static serializePrototype(e,t,n,i){let r,s=[],o="";i?(o=e.toString()+"\n\n",r=t):r=e;for(let e in r){let t=r[e],n=t.toString();"function"==typeof t&&s.push("\t"+e+": "+n+",\n\n")}o+=n+(i?".prototype":"")+" = {\n\n";for(let e=0;e0){let n;for(const i in e)n=e[i],r.addMaterial(this.materials,n,i,!0===t)}}getMaterials(){return this.materials}getMaterial(e){return this.materials[e]}clearMaterials(){this.materials={}}}class p{static comRouting(e,t,n,i,r){let s=t.data;"init"===s.cmd?null!=n?n[i](e,s.workerId,s.config):i(e,s.workerId,s.config):"execute"===s.cmd&&(null!=n?n[r](e,s.workerId,s.config):r(e,s.workerId,s.config))}}class f{constructor(e){this.taskTypes=new Map,this.verbose=!1,this.maxParallelExecutions=e||4,this.actualExecutionCount=0,this.storedExecutions=[],this.teardown=!1}setVerbose(e){return this.verbose=e,this}setMaxParallelExecutions(e){return this.maxParallelExecutions=e,this}getMaxParallelExecutions(){return this.maxParallelExecutions}supportsTaskType(e){return this.taskTypes.has(e)}registerTaskType(e,t,n,i,r,s){let o=!this.supportsTaskType(e);if(o){let o=new m(e,this.maxParallelExecutions,r,this.verbose);o.setFunctions(t,n,i),o.setDependencyDescriptions(s),this.taskTypes.set(e,o)}return o}registerTaskTypeModule(e,t){let n=!this.supportsTaskType(e);if(n){let n=new m(e,this.maxParallelExecutions,!1,this.verbose);n.setWorkerModule(t),this.taskTypes.set(e,n)}return n}async initTaskType(e,t,n){let i=this.taskTypes.get(e);if(i)if(i.status.initStarted)for(;!i.status.initComplete;)await this._wait(10);else i.status.initStarted=!0,i.isWorkerModule()?await i.createWorkerModules().then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e))):await i.loadDependencies().then((()=>i.createWorkers())).then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e)))}async _wait(e){return new Promise((t=>{setTimeout(t,e)}))}async enqueueForExecution(e,t,n,i){return new Promise(((r,s)=>{this.storedExecutions.push(new g(e,t,n,r,s,i)),this._depleteExecutions()}))}_depleteExecutions(){let e=0;for(;this.actualExecutionCount{i.onmessage=n=>{"assetAvailable"===n.data.cmd?t.assetAvailableFunction instanceof Function&&t.assetAvailableFunction(n.data):e(n)},i.onerror=n,i.postMessage({cmd:"execute",workerId:i.getId(),config:t.config},t.transferables)})).then((e=>{n.returnAvailableTask(i),t.resolve(e.data),this.actualExecutionCount--,this._depleteExecutions()})).catch((e=>{t.reject("Execution error: "+e)}))):e++}}dispose(){this.teardown=!0;for(let e of this.taskTypes.values())e.dispose();return this}}class m{constructor(e,t,n,i){this.taskType=e,this.fallback=n,this.verbose=!0===i,this.initialised=!1,this.functions={init:null,execute:null,comRouting:null,dependencies:{descriptions:[],code:[]},workerModuleUrl:null},this.workers={code:[],instances:new Array(t),available:[]},this.status={initStarted:!1,initComplete:!1}}getTaskType(){return this.taskType}setFunctions(e,t,n){this.functions.init=e,this.functions.execute=t,this.functions.comRouting=n,void 0!==this.functions.comRouting&&null!==this.functions.comRouting||(this.functions.comRouting=p.comRouting),this._addWorkerCode("init",this.functions.init.toString()),this._addWorkerCode("execute",this.functions.execute.toString()),this._addWorkerCode("comRouting",this.functions.comRouting.toString()),this.workers.code.push('self.addEventListener( "message", message => comRouting( self, message, null, init, execute ), false );')}_addWorkerCode(e,t){t.startsWith("function")?this.workers.code.push("const "+e+" = "+t+";\n\n"):this.workers.code.push("function "+t+";\n\n")}setDependencyDescriptions(e){e&&e.forEach((e=>{this.functions.dependencies.descriptions.push(e)}))}setWorkerModule(e){this.functions.workerModuleUrl=new URL(e,window.location.href)}isWorkerModule(){return null!==this.functions.workerModuleUrl}async loadDependencies(){let e=[],t=new i.FileLoader;t.setResponseType("arraybuffer");for(let n of this.functions.dependencies.descriptions){if(n.url){let i=new URL(n.url,window.location.href);e.push(t.loadAsync(i.href,(e=>{this.verbose&&console.log(e)})))}n.code&&e.push(new Promise((e=>e(n.code))))}this.verbose&&console.log("Task: "+this.getTaskType()+": Waiting for completion of loading of all dependencies."),this.functions.dependencies.code=await Promise.all(e)}async createWorkers(){let e;if(this.fallback)for(let t=0;t{let s;if(i.onmessage=e=>{this.verbose&&console.log("Init Complete: "+e.data.id),n(e)},i.onerror=r,t){s=[];for(let e=0;e0}returnAvailableTask(e){this.workers.available.push(e)}dispose(){for(let e of this.workers.instances)e.terminate()}}class g{constructor(e,t,n,i,r,s){this.taskType=e,this.config=t,this.assetAvailableFunction=n,this.resolve=i,this.reject=r,this.transferables=s}}class y extends Worker{constructor(e,t,n){super(t,n),this.id=e}getId(){return this.id}}class _{constructor(e,t,n){this.id=e,this.functions={init:t,execute:n}}getId(){return this.id}postMessage(e,t){let n=this,i={postMessage:function(e){n.onmessage({data:e})}};p.comRouting(i,{data:e},null,n.functions.init,n.functions.execute)}terminate(){}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class x extends i.Loader{constructor(e){super(e),this.parser=new b,this.materialStore=new d(!0),this.parser.materials=this.materialStore.getMaterials()}setLogging(e,t){return this.parser.logging.enabled=!0===e,this.parser.logging.debug=!0===t,this}setMaterialPerSmoothingGroup(e){return this.parser.aterialPerSmoothingGroup=!0===e,this}setUseOAsMesh(e){return this.parser.useOAsMesh=!0===e,this}setUseIndices(e){return this.parser.useIndices=!0===e,this}setDisregardNormals(e){return this.parser.disregardNormals=!0===e,this}setModelName(e){return e&&(this.parser.modelName=e),this}getModelName(){return this.parser.modelName}setBaseObject3d(e){return this.parser.baseObject3d=null==e?this.parser.baseObject3d:e,this}setMaterials(e){return this.materialStore.addMaterials(e,!1),this.parser.materials=this.materialStore.getMaterials(),this}setCallbackOnProgress(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onProgress=e),this}setCallbackOnError(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onError=e),this}setCallbackOnLoad(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onLoad=e),this}setCallbackOnMeshAlter(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onMeshAlter=e),this}load(e,t,n,r,s){if(!(null!=t&&t instanceof Function)){const e="onLoad is not a function! Aborting...";throw this.parser._onError(e),e}this.setCallbackOnLoad(t);const o=this;null!=r&&r instanceof Function||(r=function(e){let t=e;e.currentTarget&&null!==e.currentTarget.statusText&&(t="Error occurred while downloading!\nurl: "+e.currentTarget.responseURL+"\nstatus: "+e.currentTarget.statusText),o.parser._onError(t)}),e||r("An invalid url was provided. Unable to continue!");const a=new URL(e,window.location.href).href;let l=a;const c=a.split("/");if(c.length>2){l=c[c.length-1];let e=c.slice(0,c.length-1).join("/")+"/";void 0!==e&&(this.path=e)}if(null==n||!(n instanceof Function)){let t=0,i=0;n=function(n){if(n.lengthComputable&&(i=n.loaded/n.total,i>t)){t=i;const n='Download of "'+e+'": '+(100*i).toFixed(2)+"%";o.parser._onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(s);const h=new i.FileLoader(this.manager);h.setPath(this.path||this.resourcePath),h.setResponseType("arraybuffer"),h.load(l,(function(e){o.parse(e)}),n,r)}parse(e){if(this.parser.logging.enabled&&console.info("Using OBJLoader2 version: "+x.OBJLOADER2_VERSION),null==e)throw"Provided content is not a valid ArrayBuffer or String. Unable to continue parsing";return this.parser.logging.enabled&&console.time("OBJLoader parse: "+this.modelName),e instanceof ArrayBuffer||e instanceof Uint8Array?(this.parser.logging.enabled&&console.info("Parsing arrayBuffer..."),this.parser._execute(e)):"string"==typeof e||e instanceof String?(this.parser.logging.enabled&&console.info("Parsing text..."),this.parser._executeLegacy(e)):this.parser._onError("Provided content was neither of type String nor Uint8Array! Aborting..."),this.parser.logging.enabled&&console.timeEnd("OBJLoader parse: "+this.modelName),this.parser.baseObject3d}}v(x,"OBJLOADER2_VERSION","4.0.0-dev");class b{constructor(){this.logging={enabled:!1,debug:!1},this.usedBefore=!1,this._init(),this.callbacks={onLoad:null,onError:null,onProgress:null,onMeshAlter:null}}_init(){this.contentRef=null,this.legacyMode=!1,this.materials={},this.baseObject3d=new i.Object3D,this.modelName="noname",this.materialPerSmoothingGroup=!1,this.useOAsMesh=!1,this.useIndices=!1,this.disregardNormals=!1,this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],this.objectId=0,this.rawMesh={objectName:"",groupName:"",activeMtlName:"",mtllibName:"",faceType:-1,subGroups:[],subGroupInUse:null,smoothingGroup:{splitMaterials:!1,normalized:-1,real:-1},counts:{doubleIndicesCount:0,faceCount:0,mtlCount:0,smoothingGroupCount:0}},this.inputObjectCount=1,this.outputObjectCount=1,this.globalCounts={vertices:0,faces:0,doubleIndicesCount:0,lineByte:0,currentByte:0,totalBytes:0}}_resetRawMesh(){this.rawMesh.subGroups=[],this.rawMesh.subGroupInUse=null,this.rawMesh.smoothingGroup.normalized=-1,this.rawMesh.smoothingGroup.real=-1,this._pushSmoothingGroup(1),this.rawMesh.counts.doubleIndicesCount=0,this.rawMesh.counts.faceCount=0,this.rawMesh.counts.mtlCount=0,this.rawMesh.counts.smoothingGroupCount=0}_configure(){if(this.usedBefore=!0,this._pushSmoothingGroup(1),this.logging.enabled){const e=Object.keys(this.materials);let t="OBJLoader2 Parser configuration:"+(e.length>0?"\n\tmaterialNames:\n\t\t- "+e.join("\n\t\t- "):"\n\tmaterialNames: None")+"\n\tmaterialPerSmoothingGroup: "+this.materialPerSmoothingGroup+"\n\tuseOAsMesh: "+this.useOAsMesh+"\n\tuseIndices: "+this.useIndices+"\n\tdisregardNormals: "+this.disregardNormals;null!==this.callbacks.onProgress&&(t+="\n\tcallbacks.onProgress: "+this.callbacks.onProgress.name),null!==this.callbacks.onError&&(t+="\n\tcallbacks.onError: "+this.callbacks.onError.name),null!==this.callbacks.onMeshAlter&&(t+="\n\tcallbacks.onMeshAlter: "+this.callbacks.onMeshAlter.name),null!==this.callbacks.onLoad&&(t+="\n\tcallbacks.onLoad: "+this.callbacks.onLoad.name),console.info(t)}}_execute(e){this.logging.enabled&&console.time("OBJLoader2Parser.execute"),this._configure();const t=new Uint8Array(e);this.contentRef=t;const n=t.byteLength;this.globalCounts.totalBytes=n;const i=new Array(128);let r,s=0,o=0,a="",l=0;for(;l0&&(i[s++]=a),a="";break;case 47:a.length>0&&(i[s++]=a),o++,a="";break;case 10:this._processLine(i,s,o,a,l),a="",s=0,o=0;break;case 13:break;default:a+=String.fromCharCode(r)}this._processLine(i,s,o,a,l),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.execute")}_executeLegacy(e){this.logging.enabled&&console.time("OBJLoader2Parser.executeLegacy"),this._configure(),this.legacyMode=!0,this.contentRef=e;const t=e.length;this.globalCounts.totalBytes=t;const n=new Array(128);let i,r=0,s=0,o="",a=0;for(;a0&&(n[r++]=o),o="";break;case"/":o.length>0&&(n[r++]=o),s++,o="";break;case"\n":this._processLine(n,r,s,o,a),o="",r=0,s=0;break;case"\r":break;default:o+=i}this._processLine(n,r,o,s),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.executeLegacy")}_processLine(e,t,n,i,r){if(this.globalCounts.lineByte=this.globalCounts.currentByte,this.globalCounts.currentByte=r,t<1)return;i.length>0&&(e[t++]=i);const s=function(e,t,n,i){let r="";if(i>n){let s;if(t)for(s=n;s4&&(this.colors.push(parseFloat(e[4])),this.colors.push(parseFloat(e[5])),this.colors.push(parseFloat(e[6])));break;case"vt":this.uvs.push(parseFloat(e[1])),this.uvs.push(parseFloat(e[2]));break;case"vn":this.normals.push(parseFloat(e[1])),this.normals.push(parseFloat(e[2])),this.normals.push(parseFloat(e[3]));break;case"f":if(o=t-1,0===n)for(this._checkFaceType(0),l=2,a=o;l0?s-1:s+r.vertices.length/3),a=r.colors.length>0?o:null;const l=i.vertices;if(l.push(r.vertices[o++]),l.push(r.vertices[o++]),l.push(r.vertices[o]),null!==a){const e=i.colors;e.push(r.colors[a++]),e.push(r.colors[a++]),e.push(r.colors[a])}if(t){const e=parseInt(t);let n=2*(e>0?e-1:e+r.uvs.length/2);const s=i.uvs;s.push(r.uvs[n++]),s.push(r.uvs[n])}if(n&&!r.disregardNormals){const e=parseInt(n);let t=3*(e>0?e-1:e+r.normals.length/3);const s=i.normals;s.push(r.normals[t++]),s.push(r.normals[t++]),s.push(r.normals[t])}};if(this.useIndices){this.disregardNormals&&(n=void 0);const r=e+(t?"_"+t:"_n")+(n?"_"+n:"_n");let o=i.indexMappings[r];null==o?(o=this.rawMesh.subGroupInUse.vertices.length/3,s(),i.indexMappings[r]=o,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(o)}else s();this.rawMesh.counts.faceCount++}_createRawMeshReport(e){return"Input Object number: "+e+"\n\tObject name: "+this.rawMesh.objectName+"\n\tGroup name: "+this.rawMesh.groupName+"\n\tMtllib name: "+this.rawMesh.mtllibName+"\n\tVertex count: "+this.vertices.length/3+"\n\tNormal count: "+this.normals.length/3+"\n\tUV count: "+this.uvs.length/2+"\n\tSmoothingGroup count: "+this.rawMesh.counts.smoothingGroupCount+"\n\tMaterial count: "+this.rawMesh.counts.mtlCount+"\n\tReal MeshOutputGroup count: "+this.rawMesh.subGroups.length}_finalizeRawMesh(){const e=[];let t,n,i=0,r=0,s=0,o=0,a=0,l=0;for(const c in this.rawMesh.subGroups)if(t=this.rawMesh.subGroups[c],t.vertices.length>0){if(n=t.indices,n.length>0&&r>0)for(let e=0;e0&&(c={name:""!==this.rawMesh.groupName?this.rawMesh.groupName:this.rawMesh.objectName,subGroups:e,absoluteVertexCount:i,absoluteIndexCount:s,absoluteColorCount:o,absoluteNormalCount:a,absoluteUvCount:l,faceCount:this.rawMesh.counts.faceCount,doubleIndicesCount:this.rawMesh.counts.doubleIndicesCount}),c}_processCompletedMesh(){const e=this._finalizeRawMesh(),t=null!==e;if(t){this.colors.length>0&&this.colors.length!==this.vertices.length&&this._onError("Vertex Colors were detected, but vertex count and color count do not match!"),this.logging.enabled&&this.logging.debug&&console.debug(this._createRawMeshReport(this.inputObjectCount)),this.inputObjectCount++,this._buildMesh(e);const t=this.globalCounts.currentByte/this.globalCounts.totalBytes;this._onProgress("Completed [o: "+this.rawMesh.objectName+" g:"+this.rawMesh.groupName+"] Total progress: "+(100*t).toFixed(2)+"%"),this._resetRawMesh()}return t}_buildMesh(e){const t=e.subGroups;this.globalCounts.vertices+=e.absoluteVertexCount/3,this.globalCounts.faces+=e.faceCount,this.globalCounts.doubleIndicesCount+=e.doubleIndicesCount;const n=new i.BufferGeometry,s=new Float32Array(e.absoluteVertexCount),o=e.absoluteIndexCount>0?new Uint32Array(e.absoluteIndexCount):null,a=e.absoluteColorCount>0?new Float32Array(e.absoluteColorCount):null,l=e.absoluteNormalCount>0?new Float32Array(e.absoluteNormalCount):null,c=e.absoluteUvCount>0?new Float32Array(e.absoluteUvCount):null;let h;n.setAttribute("position",new i.BufferAttribute(s,3,!1)),null!=l&&n.setAttribute("normal",new i.BufferAttribute(l,3,!1)),null!=c&&n.setAttribute("uv",new i.BufferAttribute(c,2,!1)),null!=a&&n.setAttribute("color",new i.BufferAttribute(a,3,!1)),null!==o&&n.setIndex(new i.BufferAttribute(o,1,!1));let u=0,d=0,p=0,f=0,m=0,g=0,y=0;const _=t.length>1,v=[],x=null!==a;let b,w,M,S,E,T=0;const A={cloneInstructions:[],multiMaterialNames:{},modelName:this.modelName,progress:this.globalCounts.currentByte/this.globalCounts.totalBytes,geometryType:this.rawMesh.faceType<4?0:6===this.rawMesh.faceType?2:1,objectId:this.objectId};for(const e in t)if(t.hasOwnProperty(e)){if(h=t[e],E=h.materialName,b=0===h.smoothingGroup,this.rawMesh.faceType<4?(S=E,x&&(S+="_vertexColor"),b&&(S+="_flat")):S=6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",w=this.materials[E],M=this.materials[S],null==w&&null==M&&(S=x?"defaultVertexColorMaterial":"defaultMaterial",M=this.materials[S],this.logging.enabled&&console.info('object_group "'+h.objectName+"_"+h.groupName+'" was defined with unresolvable material "'+E+'"! Assigning "'+S+'".')),null==M){const e={materialNameOrg:E,materialProperties:{name:S,vertexColors:x?2:0,flatShading:b}};M=r.cloneMaterial(this.materials,e,this.logging.enabled&&this.logging.debug),A.cloneInstructions.push(e)}if(_&&(y=this.useIndices?h.indices.length:h.vertices.length/3,n.addGroup(g,y,T),M=this.materials[S],v[T]=M,A.multiMaterialNames[T]=M.name,g+=y,T++),s.set(h.vertices,u),u+=h.vertices.length,null!==o&&(o.set(h.indices,d),d+=h.indices.length),null!==a&&(a.set(h.colors,p),p+=h.colors.length),null!==l&&(l.set(h.normals,f),f+=h.normals.length),null!==c&&(c.set(h.uvs,m),m+=h.uvs.length),this.logging.enabled&&this.logging.debug){let e="";T>0&&(e="\n\t\tmaterialIndex: "+T);const t="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+h.groupName+"\n\t\tIndex: "+h.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+h.materialName+"\n\t\tsmoothingGroup: "+h.smoothingGroup+e+"\n\t\tobjectName: "+h.objectName+"\n\t\t#vertices: "+h.vertices.length/3+"\n\t\t#indices: "+h.indices.length+"\n\t\t#colors: "+h.colors.length/3+"\n\t\t#uvs: "+h.uvs.length/2+"\n\t\t#normals: "+h.normals.length/3;console.debug(t)}}let C;this.outputObjectCount++,null==n.getAttribute("normal")&&n.computeVertexNormals();const L=_?v:M;C=0===A.geometryType?new i.Mesh(n,L):1===A.geometryType?new i.LineSegments(n,L):new i.Points(n,L),C.name=e.name,this._onAssetAvailable(C,A)}_finalizeParsing(){if(this.logging.enabled&&console.info("Global output object count: "+this.outputObjectCount),this._processCompletedMesh()&&this.logging.enabled){const e="Overall counts: \n\tVertices: "+this.globalCounts.vertices+"\n\tFaces: "+this.globalCounts.faces+"\n\tMultiple definitions: "+this.globalCounts.doubleIndicesCount;console.info(e)}this._onLoad()}_onProgress(e){if(null!==this.callbacks.onProgress)this.callbacks.onProgress(e);else{const t=e||"";this.logging.enabled&&this.logging.debug&&console.log(t)}}_onError(e){null!==this.callbacks.onError?this.callbacks.onError(e):this.logging.enabled&&this.logging.debug&&console.error(e)}_onAssetAvailable(e,t){this._onMeshAlter(e,t),this.baseObject3d.add(e)}_onMeshAlter(e){null!==this.callbacks.onMeshAlter&&this.callbacks.onMeshAlter(e,this.baseObject3d)}_onLoad(){null!==this.callbacks.onLoad&&this.callbacks.onLoad(this.baseObject3d,this.objectId)}static buildUglifiedMapping(){return s.buildUglifiedNameAssignment((function(){return b}),"OBJLoader2Parser",/_OBJLoader2Parser/,!0)}}class w{static buildStandardWorkerDependencies(e){return[{url:e},{code:s.buildThreeConst()},{code:w.buildThreeExtraConst()},{code:"\n\n"},{code:s.buildUglifiedThreeMapping()},{code:w.buildUglifiedThreeExtraMapping()},{code:"\n\n"},{code:h.serializeClass(o)},{code:h.serializeClass(l)},{code:h.serializeClass(c)},{code:h.serializeClass(a)},{code:h.serializeClass(r)},{code:h.serializeClass(b)},{code:h.serializeClass(u)},{code:s.buildUglifiedThreeWtmMapping()},{code:"\n\n"},{code:b.buildUglifiedMapping()},{code:"\n\n"}]}static buildThreeExtraConst(){return"const MathUtils = THREE.MathUtils;\nconst Material = THREE.Material;\nconst Object3D = THREE.Object3D;\nconst Mesh = THREE.Mesh;\n"}static buildUglifiedThreeExtraMapping(){return s.buildUglifiedNameAssignment((function(){return i.MathUtils}),"MathUtils",/_MathUtils/,!1)+s.buildUglifiedNameAssignment((function(){return i.Material}),"Material",/_Material/,!1)+s.buildUglifiedNameAssignment((function(){return i.Object3D}),"Object3D",/_Object3D/,!1)+s.buildUglifiedNameAssignment((function(){return i.Mesh}),"Mesh",/_Mesh/,!1)}static init(e,t,n){const i=(new a).loadData(n);e.obj2={parser:new b,buffer:null,materials:i.getMaterials()},e.obj2.parser._onMeshAlter=(t,n)=>{const i=new a;if(i.main.multiMaterialNames=n.multiMaterialNames,0===Object.keys(i.main.multiMaterialNames).length){const e=t.material;r.addMaterial(i.main.materials,e,e.name,!1,!1)}i.main.cloneInstructions=n.cloneInstructions,i.cleanMaterials(),new c("assetAvailable",n.objectId).setProgress(n.progress).setParams({modelName:n.modelName}).setMesh(t,n.geometryType).setMaterialsTransport(i).postMessage(e)},e.obj2.parser.callbacks.onLoad=()=>{new o("execComplete",e.obj2.parser.objectId).postMessage(e)},e.obj2.parser.callbacks.onProgress=t=>{e.obj2.parser.logging.debug&&console.debug("WorkerRunner: progress: "+t)},u.applyProperties(e.obj2.parser,i.getParams(),!1);const s=i.getBuffer("modelData");null!=s&&(e.obj2.buffer=s),new o("init",t).postMessage(e)}static execute(e,t,n){e.obj2.parser.usedBefore&&e.obj2.parser._init(),e.obj2.parser.materials=e.obj2.materials;const i=(new o).loadData(n);u.applyProperties(e.obj2.parser,i.getParams(),!1);const r=i.getBuffer("modelData");null!=r&&(e.obj2.buffer=r),e.obj2.buffer&&(e.obj2.parser.objectId=i.getId(),e.obj2.parser._execute(e.obj2.buffer))}}class M extends x{constructor(e){super(e),this.preferJsmWorker=!1,this.urls={jsmWorker:new URL(M.DEFAULT_JSM_WORKER_PATH,window.location.href),threejs:new URL(M.DEFAULT_JSM_THREEJS_PATH,window.location.href)},this.workerTaskManager=null,this.taskName="tmOBJLoader2"}setWorkerTaskManager(e,t){return this.workerTaskManager=e,t&&(this.taskName=t),this}setJsmWorker(e,t){if(this.preferJsmWorker=!0===e,!(null!=t&&t instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.jsmWorker=t,this}setThreejsLocation(e){if(!(null!=e&&e instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.threejs=e,this}setTerminateWorkerOnLoad(e){return this.terminateWorkerOnLoad=!0===e,this}async _buildWorkerCode(e){null!==this.workerTaskManager&&this.workerTaskManager instanceof f||(this.parser.logging.debug&&console.log("Needed to create new WorkerTaskManager"),this.workerTaskManager=new f(1),this.workerTaskManager.setVerbose(this.parser.logging.enabled&&this.parser.logging.debug)),this.workerTaskManager.supportsTaskType(this.taskName)||(this.preferJsmWorker?this.workerTaskManager.registerTaskTypeModule(this.taskName,this.urls.jsmWorker):this.workerTaskManager.registerTaskType(this.taskName,w.init,w.execute,null,!1,w.buildStandardWorkerDependencies(this.urls.threejs)),await this.workerTaskManager.initTaskType(this.taskName,e.getMain()))}load(e,t,n,i,r){const s=this;x.prototype.load.call(this,e,(function(e,n){"OBJLoader2ParallelDummy"===e.name?s.parser.logging.enabled&&s.parser.logging.debug&&console.debug("Received dummy answer from OBJLoader2Parallel#parse"):t(e,n)}),n,i,r)}parse(e){this.parser.logging.enabled&&console.info("Using OBJLoader2Parallel version: "+M.OBJLOADER2_PARALLEL_VERSION);const t=(new o).setParams({logging:{enabled:this.parser.logging.enabled,debug:this.parser.logging.debug}});this._buildWorkerCode(t).then((()=>{this.parser.logging.debug&&console.log("OBJLoader2Parallel init was performed"),this._executeWorkerParse(e)})).catch((e=>console.error(e)));let n=new i.Object3D;return n.name="OBJLoader2ParallelDummy",n}_executeWorkerParse(e){const t=new o("execute",Math.floor(Math.random()*Math.floor(65536)));t.setParams({modelName:this.parser.modelName,useIndices:this.parser.useIndices,disregardNormals:this.parser.disregardNormals,materialPerSmoothingGroup:this.parser.materialPerSmoothingGroup,useOAsMesh:this.parser.useOAsMesh,materials:r.getMaterialsJSON(this.materialStore.getMaterials())}).addBuffer("modelData",e).package(!1),this.workerTaskManager.enqueueForExecution(this.taskName,t.getMain(),(e=>this._onLoad(e)),t.getTransferables()).then((e=>{this._onLoad(e),this.terminateWorkerOnLoad&&this.workerTaskManager.dispose()})).catch((e=>console.error(e)))}_onLoad(e){let t=e.cmd;if("assetAvailable"===t){let t;if("MeshTransport"===e.type?t=(new c).loadData(e).reconstruct(!1):console.error("Received unknown asset.type: "+e.type),t){let e,n=t.getMaterialsTransport().processMaterialTransport(this.materialStore.getMaterials(),this.parser.logging.enabled);null===n&&(n=new i.MeshStandardMaterial({color:16711680})),e=0===t.getGeometryType()?new i.Mesh(t.getBufferGeometry(),n):1===t.getGeometryType()?new i.LineSegments(t.getBufferGeometry(),n):new i.Points(t.getBufferGeometry(),n),this.parser._onMeshAlter(e),this.parser.baseObject3d.add(e)}}else if("execComplete"===t){let t;"DataTransport"===e.type?(t=(new o).loadData(e),t instanceof o&&null!==this.parser.callbacks.onLoad&&this.parser.callbacks.onLoad(this.parser.baseObject3d,t.getId())):console.error("Received unknown asset.type: "+e.type)}else console.error("Received unknown command: "+t)}}v(M,"OBJLOADER2_PARALLEL_VERSION",x.OBJLOADER2_VERSION),v(M,"DEFAULT_JSM_WORKER_PATH","/src/loaders/tmOBJLoader2.js"),v(M,"DEFAULT_JSM_THREEJS_PATH","/node_modules/three/build/three.min.js");class S{static link(e,t){"function"==typeof t.setMaterials&&t.setMaterials(S.addMaterialsFromMtlLoader(e),!0)}static addMaterialsFromMtlLoader(e){let t={};return void 0!==e.preload&&e.preload instanceof Function&&(e.preload(),t=e.materials),t}}},676:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DataViewIndexOutOfBoundsError:()=>H,DecodeError:()=>x,Decoder:()=>W,EXT_TIMESTAMP:()=>b,Encoder:()=>R,ExtData:()=>_,ExtensionCodec:()=>C,decode:()=>q,decodeArrayStream:()=>ee,decodeAsync:()=>$,decodeMulti:()=>X,decodeMultiStream:()=>te,decodeStream:()=>ne,decodeTimestampExtension:()=>T,decodeTimestampToTimeSpec:()=>E,encode:()=>D,encodeDateToTimeSpec:()=>M,encodeTimeSpecToTimestamp:()=>w,encodeTimestampExtension:()=>S});var i,r,s,o=4294967295;function a(e,t,n){var i=Math.floor(n/4294967296),r=n;e.setUint32(t,i),e.setUint32(t+4,r)}function l(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var c=("undefined"==typeof process||"never"!==(null===(i=null===process||void 0===process?void 0:process.env)||void 0===i?void 0:i.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function h(e){for(var t=e.length,n=0,i=0;i=55296&&r<=56319&&i65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var m,g=c?new TextDecoder:null,y=c?"undefined"!=typeof process&&"force"!==(null===(s=null===process||void 0===process?void 0:process.env)||void 0===s?void 0:s.TEXT_DECODER)?200:0:o,_=function(e,t){this.type=e,this.data=t},v=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e){function t(n){var i=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(i,r),Object.defineProperty(i,"name",{configurable:!0,enumerable:!1,value:t.name}),i}return v(t,e),t}(Error),b=-1;function w(e){var t,n=e.sec,i=e.nsec;if(n>=0&&i>=0&&n<=17179869183){if(0===i&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var s=n/4294967296,o=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,i<<2|3&s),t.setUint32(4,o),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,i),a(t,4,n),r}function M(e){var t=e.getTime(),n=Math.floor(t/1e3),i=1e6*(t-1e3*n),r=Math.floor(i/1e9);return{sec:n+r,nsec:i-1e9*r}}function S(e){return e instanceof Date?w(M(e)):null}function E(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:l(t,4),nsec:t.getUint32(0)};default:throw new x("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}function T(e){var t=E(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:S,decode:T},C=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,i=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=i;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=i}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>d){var t=h(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),p(e,this.bytes,this.pos),this.pos+=t}else t=h(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var i=e.length,r=n,s=0;s>6&31|192;else{if(o>=55296&&o<=56319&&s>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=63&o|128}else t[r++]=o}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=L(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var i=0,r=e;i0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var i=0,r=this.caches[n-1];i=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)},e.prototype.decode=function(e,t,n){var i=this.find(e,t,n);if(null!=i)return this.hit++,i;this.miss++;var r=f(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,r),r},e}(),k=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof B?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},F=new DataView(new ArrayBuffer(0)),z=new Uint8Array(F.buffer),H=function(){try{F.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),G=new H("Insufficient data"),V=new O,W=function(){function e(e,t,n,i,r,s,a,l){void 0===e&&(e=C.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=o),void 0===i&&(i=o),void 0===r&&(r=o),void 0===s&&(s=o),void 0===a&&(a=o),void 0===l&&(l=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=r,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=l,this.totalPos=0,this.pos=0,this.view=F,this.bytes=z,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=L(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=L(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=L(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return k(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,i,r,s,o,a,l;return s=this,o=void 0,l=function(){var s,o,a,l,c,h,u,d;return k(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=N(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{o=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return l=p.sent(),i={error:l},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(i)throw i.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw h=(c=this).headByte,u=c.pos,d=c.totalPos,new RangeError("Insufficient data in parsing ".concat(I(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{r(l.next(e))}catch(e){t(e)}}function i(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(n,i)}r((l=l.apply(s,o||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return U(this,arguments,(function(){var n,i,r,s,o,a,l,c,h;return k(this,(function(u){switch(u.label){case 0:n=t,i=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),r=N(e),u.label=2;case 2:return[4,B(r.next())];case 3:if((s=u.sent()).done)return[3,12];if(o=s.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),n&&(i=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof H))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return l=u.sent(),c={error:l},[3,19];case 14:return u.trys.push([14,,17,18]),s&&!s.done&&(h=r.return)?[4,B(h.call(r))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(c)throw c.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(i=e-128)){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){if(0!=(i=e-144)){this.pushArrayState(i),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(i=this.readU16())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(221===e){if(0!==(i=this.readU32())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(222===e){if(0!==(i=this.readU16())){this.pushMapState(i),this.complete();continue e}t={}}else if(223===e){if(0!==(i=this.readU32())){this.pushMapState(i),this.complete();continue e}t={}}else if(196===e){var i=this.lookU8();t=this.decodeBinary(i,1)}else if(197===e)i=this.lookU16(),t=this.decodeBinary(i,2);else if(198===e)i=this.lookU32(),t=this.decodeBinary(i,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)i=this.lookU8(),t=this.decodeExtension(i,1);else if(200===e)i=this.lookU16(),t=this.decodeExtension(i,2);else{if(201!==e)throw new x("Unrecognized type byte: ".concat(I(e)));i=this.lookU32(),t=this.decodeExtension(i,4)}this.complete();for(var r=this.stack;r.length>0;){var s=r[r.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;r.pop(),t=s.array}else{if(1===s.type){if(void 0,"string"!=(o=typeof t)&&"number"!==o)throw new x("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new x("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}r.pop(),t=s.map}}return t}var o},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new x("Unrecognized array type byte: ".concat(I(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new x("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new x("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new x("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthy?function(e,t,n){var i=e.subarray(t,t+n);return g.decode(i)}(this.bytes,r,e):f(this.bytes,r,e),this.pos+=t+e,i},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new x("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw G;var n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new x("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=l(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),j={};function q(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function X(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var J=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Y?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function Q(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,i,r;return J(this,(function(s){switch(s.label){case 0:t=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Y(t.read())];case 3:return n=s.sent(),i=n.done,r=n.value,i?[4,Y(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return K(r),[4,Y(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function $(e,t){return void 0===t&&(t=j),n=this,i=void 0,s=function(){var n;return function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]{"use strict";n.r(t),n.d(t,{ACESFilmicToneMapping:()=>ne,AddEquation:()=>E,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>Ct,AdditiveBlending:()=>b,AlphaFormat:()=>Oe,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>nn,AmbientLight:()=>Uu,AmbientLightProbe:()=>td,AnimationClip:()=>cu,AnimationLoader:()=>yu,AnimationMixer:()=>Id,AnimationObjectGroup:()=>Pd,AnimationUtils:()=>Zh,ArcCurve:()=>vc,ArrayCamera:()=>Qa,ArrowHelper:()=>wp,Audio:()=>pd,AudioAnalyser:()=>vd,AudioContext:()=>Qu,AudioListener:()=>dd,AudioLoader:()=>$u,AxesHelper:()=>Mp,AxisHelper:()=>sf,BackSide:()=>m,BasicDepthPacking:()=>Ot,BasicShadowMap:()=>h,BinaryTextureLoader:()=>hf,Bone:()=>Ul,BooleanKeyframeTrack:()=>nu,BoundingBoxHelper:()=>of,Box2:()=>Vd,Box3:()=>ci,Box3Helper:()=>yp,BoxBufferGeometry:()=>cs,BoxGeometry:()=>cs,BoxHelper:()=>gp,BufferAttribute:()=>Er,BufferGeometry:()=>Vr,BufferGeometryLoader:()=>ju,ByteType:()=>Se,Cache:()=>uu,Camera:()=>fs,CameraHelper:()=>pp,CanvasRenderer:()=>df,CanvasTexture:()=>gc,CapsuleBufferGeometry:()=>zc,CapsuleGeometry:()=>zc,CatmullRomCurve3:()=>Ec,CineonToneMapping:()=>te,CircleBufferGeometry:()=>Hc,CircleGeometry:()=>Hc,ClampToEdgeWrapping:()=>ue,Clock:()=>od,Color:()=>jn,ColorKeyframeTrack:()=>iu,ColorManagement:()=>Un,CompressedTexture:()=>mc,CompressedTextureLoader:()=>_u,ConeBufferGeometry:()=>Vc,ConeGeometry:()=>Vc,CubeCamera:()=>ys,CubeReflectionMapping:()=>se,CubeRefractionMapping:()=>oe,CubeTexture:()=>_s,CubeTextureLoader:()=>xu,CubeUVReflectionMapping:()=>ce,CubicBezierCurve:()=>Lc,CubicBezierCurve3:()=>Rc,CubicInterpolant:()=>Qh,CullFaceBack:()=>a,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>o,Curve:()=>yc,CurvePath:()=>Bc,CustomBlending:()=>S,CustomToneMapping:()=>ie,CylinderBufferGeometry:()=>Gc,CylinderGeometry:()=>Gc,Cylindrical:()=>Hd,Data3DTexture:()=>ni,DataArrayTexture:()=>ei,DataTexture:()=>Fl,DataTexture2DArray:()=>wf,DataTexture3D:()=>Mf,DataTextureLoader:()=>bu,DataUtils:()=>Ep,DecrementStencilOp:()=>jt,DecrementWrapStencilOp:()=>Xt,DefaultLoadingManager:()=>pu,DepthFormat:()=>Fe,DepthStencilFormat:()=>ze,DepthTexture:()=>nl,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>hp,DiscreteInterpolant:()=>eu,DodecahedronBufferGeometry:()=>jc,DodecahedronGeometry:()=>jc,DoubleSide:()=>g,DstAlphaFactor:()=>N,DstColorFactor:()=>U,DynamicBufferAttribute:()=>Jp,DynamicCopyUsage:()=>un,DynamicDrawUsage:()=>sn,DynamicReadUsage:()=>ln,EdgesGeometry:()=>Zc,EdgesHelper:()=>af,EllipseCurve:()=>_c,EqualDepth:()=>j,EqualStencilFunc:()=>Kt,EquirectangularReflectionMapping:()=>ae,EquirectangularRefractionMapping:()=>le,Euler:()=>Xi,EventDispatcher:()=>gn,ExtrudeBufferGeometry:()=>Eh,ExtrudeGeometry:()=>Eh,FaceColors:()=>Bp,FileLoader:()=>gu,FlatShading:()=>y,Float16BufferAttribute:()=>Ir,Float32Attribute:()=>nf,Float32BufferAttribute:()=>Or,Float64Attribute:()=>rf,Float64BufferAttribute:()=>kr,FloatType:()=>Le,Fog:()=>ll,FogExp2:()=>al,Font:()=>vf,FontLoader:()=>_f,FramebufferTexture:()=>fc,FrontSide:()=>f,Frustum:()=>Ts,GLBufferAttribute:()=>Nd,GLSL1:()=>pn,GLSL3:()=>fn,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>tn,GreaterStencilFunc:()=>$t,GridHelper:()=>sp,Group:()=>$a,HalfFloatType:()=>Re,HemisphereLight:()=>Su,HemisphereLightHelper:()=>rp,HemisphereLightProbe:()=>ed,IcosahedronBufferGeometry:()=>Ah,IcosahedronGeometry:()=>Ah,ImageBitmapLoader:()=>Zu,ImageLoader:()=>vu,ImageUtils:()=>Xn,ImmediateRenderObject:()=>xf,IncrementStencilOp:()=>Wt,IncrementWrapStencilOp:()=>qt,InstancedBufferAttribute:()=>Vl,InstancedBufferGeometry:()=>Wu,InstancedInterleavedBuffer:()=>kd,InstancedMesh:()=>Jl,Int16Attribute:()=>Qp,Int16BufferAttribute:()=>Lr,Int32Attribute:()=>ef,Int32BufferAttribute:()=>Pr,Int8Attribute:()=>Yp,Int8BufferAttribute:()=>Tr,IntType:()=>Ae,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>dl,Interpolant:()=>Kh,InterpolateDiscrete:()=>bt,InterpolateLinear:()=>wt,InterpolateSmooth:()=>Mt,InvertStencilOp:()=>Jt,JSONLoader:()=>pf,KeepStencilOp:()=>Gt,KeyframeTrack:()=>tu,LOD:()=>Pl,LatheBufferGeometry:()=>Fc,LatheGeometry:()=>Fc,Layers:()=>Ji,LensFlare:()=>mf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>Qt,LessStencilFunc:()=>Zt,Light:()=>Mu,LightProbe:()=>Hu,Line:()=>tc,Line3:()=>qd,LineBasicMaterial:()=>Yl,LineCurve:()=>Pc,LineCurve3:()=>Dc,LineDashedMaterial:()=>Jh,LineLoop:()=>sc,LinePieces:()=>kp,LineSegments:()=>rc,LineStrip:()=>Op,LinearEncoding:()=>Dt,LinearFilter:()=>_e,LinearInterpolant:()=>$h,LinearMipMapLinearFilter:()=>we,LinearMipMapNearestFilter:()=>xe,LinearMipmapLinearFilter:()=>be,LinearMipmapNearestFilter:()=>ve,LinearSRGBColorSpace:()=>zt,LinearToneMapping:()=>$,Loader:()=>fu,LoaderUtils:()=>Vu,LoadingManager:()=>du,LoopOnce:()=>_t,LoopPingPong:()=>xt,LoopRepeat:()=>vt,LuminanceAlphaFormat:()=>Ue,LuminanceFormat:()=>Be,MOUSE:()=>r,Material:()=>br,MaterialLoader:()=>Gu,Math:()=>Cn,MathUtils:()=>Cn,Matrix3:()=>Rn,Matrix4:()=>Bi,MaxEquation:()=>L,Mesh:()=>as,MeshBasicMaterial:()=>wr,MeshDepthMaterial:()=>qa,MeshDistanceMaterial:()=>Xa,MeshFaceMaterial:()=>Fp,MeshLambertMaterial:()=>qh,MeshMatcapMaterial:()=>Xh,MeshNormalMaterial:()=>jh,MeshPhongMaterial:()=>Vh,MeshPhysicalMaterial:()=>Gh,MeshStandardMaterial:()=>Hh,MeshToonMaterial:()=>Wh,MinEquation:()=>C,MirroredRepeatWrapping:()=>de,MixOperation:()=>Z,MultiMaterial:()=>zp,MultiplyBlending:()=>M,MultiplyOperation:()=>Y,NearestFilter:()=>pe,NearestMipMapLinearFilter:()=>ye,NearestMipMapNearestFilter:()=>me,NearestMipmapLinearFilter:()=>ge,NearestMipmapNearestFilter:()=>fe,NeverDepth:()=>H,NeverStencilFunc:()=>Yt,NoBlending:()=>v,NoColorSpace:()=>Ut,NoColors:()=>Np,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>At,NormalBlending:()=>x,NotEqualDepth:()=>J,NotEqualStencilFunc:()=>en,NumberKeyframeTrack:()=>ru,Object3D:()=>lr,ObjectLoader:()=>qu,ObjectSpaceNormalMap:()=>Bt,OctahedronBufferGeometry:()=>Ch,OctahedronGeometry:()=>Ch,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>B,OneMinusDstColorFactor:()=>F,OneMinusSrcAlphaFactor:()=>k,OneMinusSrcColorFactor:()=>I,OrthographicCamera:()=>Fs,PCFShadowMap:()=>u,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>Xs,ParametricGeometry:()=>gf,Particle:()=>Gp,ParticleBasicMaterial:()=>jp,ParticleSystem:()=>Vp,ParticleSystemMaterial:()=>qp,Path:()=>Uc,PerspectiveCamera:()=>ms,Plane:()=>Ms,PlaneBufferGeometry:()=>Ls,PlaneGeometry:()=>Ls,PlaneHelper:()=>_p,PointCloud:()=>Hp,PointCloudMaterial:()=>Wp,PointLight:()=>ku,PointLightHelper:()=>ep,Points:()=>uc,PointsMaterial:()=>oc,PolarGridHelper:()=>op,PolyhedronBufferGeometry:()=>Wc,PolyhedronGeometry:()=>Wc,PositionalAudio:()=>_d,PropertyBinding:()=>Rd,PropertyMixer:()=>xd,QuadraticBezierCurve:()=>Ic,QuadraticBezierCurve3:()=>Oc,Quaternion:()=>si,QuaternionKeyframeTrack:()=>ou,QuaternionLinearInterpolant:()=>su,REVISION:()=>i,RGBADepthPacking:()=>kt,RGBAFormat:()=>Ne,RGBAIntegerFormat:()=>je,RGBA_ASTC_10x10_Format:()=>ft,RGBA_ASTC_10x5_Format:()=>ut,RGBA_ASTC_10x6_Format:()=>dt,RGBA_ASTC_10x8_Format:()=>pt,RGBA_ASTC_12x10_Format:()=>mt,RGBA_ASTC_12x12_Format:()=>gt,RGBA_ASTC_4x4_Format:()=>it,RGBA_ASTC_5x4_Format:()=>rt,RGBA_ASTC_5x5_Format:()=>st,RGBA_ASTC_6x5_Format:()=>ot,RGBA_ASTC_6x6_Format:()=>at,RGBA_ASTC_8x5_Format:()=>lt,RGBA_ASTC_8x6_Format:()=>ct,RGBA_ASTC_8x8_Format:()=>ht,RGBA_BPTC_Format:()=>yt,RGBA_ETC2_EAC_Format:()=>nt,RGBA_PVRTC_2BPPV1_Format:()=>$e,RGBA_PVRTC_4BPPV1_Format:()=>Qe,RGBA_S3TC_DXT1_Format:()=>Xe,RGBA_S3TC_DXT3_Format:()=>Je,RGBA_S3TC_DXT5_Format:()=>Ye,RGBFormat:()=>ke,RGB_ETC1_Format:()=>et,RGB_ETC2_Format:()=>tt,RGB_PVRTC_2BPPV1_Format:()=>Ke,RGB_PVRTC_4BPPV1_Format:()=>Ze,RGB_S3TC_DXT1_Format:()=>qe,RGFormat:()=>Ve,RGIntegerFormat:()=>We,RawShaderMaterial:()=>zh,Ray:()=>Ni,Raycaster:()=>Bd,RectAreaLight:()=>Fu,RedFormat:()=>He,RedIntegerFormat:()=>Ge,ReinhardToneMapping:()=>ee,RepeatWrapping:()=>he,ReplaceStencilOp:()=>Vt,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>Lh,RingGeometry:()=>Lh,SRGBColorSpace:()=>Ft,Scene:()=>cl,SceneUtils:()=>ff,ShaderChunk:()=>Rs,ShaderLib:()=>Ds,ShaderMaterial:()=>ps,ShadowMaterial:()=>Fh,Shape:()=>Kc,ShapeBufferGeometry:()=>Rh,ShapeGeometry:()=>Rh,ShapePath:()=>Sp,ShapeUtils:()=>wh,ShortType:()=>Ee,Skeleton:()=>Gl,SkeletonHelper:()=>Qd,SkinnedMesh:()=>Bl,SmoothShading:()=>_,Source:()=>Jn,Sphere:()=>Ci,SphereBufferGeometry:()=>Ph,SphereGeometry:()=>Ph,Spherical:()=>zd,SphericalHarmonics3:()=>zu,SplineCurve:()=>kc,SpotLight:()=>Ru,SpotLightHelper:()=>Jd,Sprite:()=>Al,SpriteMaterial:()=>pl,SrcAlphaFactor:()=>O,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>D,StaticCopyUsage:()=>hn,StaticDrawUsage:()=>rn,StaticReadUsage:()=>an,StereoCamera:()=>sd,StreamCopyUsage:()=>dn,StreamDrawUsage:()=>on,StreamReadUsage:()=>cn,StringKeyframeTrack:()=>au,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>s,TangentSpaceNormalMap:()=>Nt,TetrahedronBufferGeometry:()=>Dh,TetrahedronGeometry:()=>Dh,TextGeometry:()=>yf,Texture:()=>Kn,TextureLoader:()=>wu,TorusBufferGeometry:()=>Ih,TorusGeometry:()=>Ih,TorusKnotBufferGeometry:()=>Oh,TorusKnotGeometry:()=>Oh,Triangle:()=>vr,TriangleFanDrawMode:()=>Pt,TriangleStripDrawMode:()=>Rt,TrianglesDrawMode:()=>Lt,TubeBufferGeometry:()=>kh,TubeGeometry:()=>kh,UVMapping:()=>re,Uint16Attribute:()=>$p,Uint16BufferAttribute:()=>Rr,Uint32Attribute:()=>tf,Uint32BufferAttribute:()=>Dr,Uint8Attribute:()=>Zp,Uint8BufferAttribute:()=>Ar,Uint8ClampedAttribute:()=>Kp,Uint8ClampedBufferAttribute:()=>Cr,Uniform:()=>Od,UniformsLib:()=>Ps,UniformsUtils:()=>ds,UnsignedByteType:()=>Me,UnsignedInt248Type:()=>Ie,UnsignedIntType:()=>Ce,UnsignedShort4444Type:()=>Pe,UnsignedShort5551Type:()=>De,UnsignedShortType:()=>Te,VSMShadowMap:()=>p,Vector2:()=>Ln,Vector3:()=>oi,Vector4:()=>Qn,VectorKeyframeTrack:()=>lu,Vertex:()=>Xp,VertexColors:()=>Up,VideoTexture:()=>pc,WebGL1Renderer:()=>ol,WebGL3DRenderTarget:()=>ii,WebGLArrayRenderTarget:()=>ti,WebGLCubeRenderTarget:()=>vs,WebGLMultipleRenderTargets:()=>ri,WebGLMultisampleRenderTarget:()=>bf,WebGLRenderTarget:()=>$n,WebGLRenderTargetCube:()=>uf,WebGLRenderer:()=>sl,WebGLUtils:()=>Ka,WireframeGeometry:()=>Nh,WireframeHelper:()=>lf,WrapAroundEnding:()=>Tt,XHRLoader:()=>cf,ZeroCurvatureEnding:()=>St,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Et,ZeroStencilOp:()=>Ht,_SRGBAFormat:()=>mn,sRGBEncoding:()=>It});const i="140",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,a=1,l=2,c=3,h=0,u=1,d=2,p=3,f=0,m=1,g=2,y=1,_=2,v=0,x=1,b=2,w=3,M=4,S=5,E=100,T=101,A=102,C=103,L=104,R=200,P=201,D=202,I=203,O=204,k=205,N=206,B=207,U=208,F=209,z=210,H=0,G=1,V=2,W=3,j=4,q=5,X=6,J=7,Y=0,Z=1,K=2,Q=0,$=1,ee=2,te=3,ne=4,ie=5,re=300,se=301,oe=302,ae=303,le=304,ce=306,he=1e3,ue=1001,de=1002,pe=1003,fe=1004,me=1004,ge=1005,ye=1005,_e=1006,ve=1007,xe=1007,be=1008,we=1008,Me=1009,Se=1010,Ee=1011,Te=1012,Ae=1013,Ce=1014,Le=1015,Re=1016,Pe=1017,De=1018,Ie=1020,Oe=1021,ke=1022,Ne=1023,Be=1024,Ue=1025,Fe=1026,ze=1027,He=1028,Ge=1029,Ve=1030,We=1031,je=1033,qe=33776,Xe=33777,Je=33778,Ye=33779,Ze=35840,Ke=35841,Qe=35842,$e=35843,et=36196,tt=37492,nt=37496,it=37808,rt=37809,st=37810,ot=37811,at=37812,lt=37813,ct=37814,ht=37815,ut=37816,dt=37817,pt=37818,ft=37819,mt=37820,gt=37821,yt=36492,_t=2200,vt=2201,xt=2202,bt=2300,wt=2301,Mt=2302,St=2400,Et=2401,Tt=2402,At=2500,Ct=2501,Lt=0,Rt=1,Pt=2,Dt=3e3,It=3001,Ot=3200,kt=3201,Nt=0,Bt=1,Ut="",Ft="srgb",zt="srgb-linear",Ht=0,Gt=7680,Vt=7681,Wt=7682,jt=7683,qt=34055,Xt=34056,Jt=5386,Yt=512,Zt=513,Kt=514,Qt=515,$t=516,en=517,tn=518,nn=519,rn=35044,sn=35048,on=35040,an=35045,ln=35049,cn=35041,hn=35046,un=35050,dn=35042,pn="100",fn="300 es",mn=1035;class gn{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+yn[e>>16&255]+yn[e>>24&255]+"-"+yn[255&t]+yn[t>>8&255]+"-"+yn[t>>16&15|64]+yn[t>>24&255]+"-"+yn[63&n|128]+yn[n>>8&255]+"-"+yn[n>>16&255]+yn[n>>24&255]+yn[255&i]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function wn(e,t,n){return Math.max(t,Math.min(n,e))}function Mn(e,t){return(e%t+t)%t}function Sn(e,t,n){return(1-n)*e+n*t}function En(e){return 0==(e&e-1)&&0!==e}function Tn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function An(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Cn=Object.freeze({__proto__:null,DEG2RAD:vn,RAD2DEG:xn,generateUUID:bn,clamp:wn,euclideanModulo:Mn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Sn,damp:function(e,t,n,i){return Sn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Mn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_n=e);let t=_n+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*vn},radToDeg:function(e){return e*xn},isPowerOfTwo:En,ceilPowerOfTwo:Tn,floorPowerOfTwo:An,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),u=s((t-i)/2),d=o((t-i)/2),p=s((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}},denormalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}});class Ln{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ln.prototype.isVector2=!0;class Rn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],x=i[2],b=i[5],w=i[8];return r[0]=s*f+o*y+a*x,r[3]=s*m+o*_+a*b,r[6]=s*g+o*v+a*w,r[1]=l*f+c*y+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*v+h*w,r[2]=u*f+d*y+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*v+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*s)*f,e[3]=u*f,e[4]=(c*t-i*a)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(s*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*r+n*a,i[3]=t*s+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*a,i[4]=-n*s+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Pn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}Rn.prototype.isMatrix3=!0;const Dn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function In(e,t){return new Dn[e](t)}function On(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function kn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Nn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}const Bn={[Ft]:{[zt]:kn},[zt]:{[Ft]:Nn}},Un={legacyMode:!0,get workingColorSpace(){return zt},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Bn[t]&&void 0!==Bn[t][n]){const i=Bn[t][n];return e.r=i(e.r),e.g=i(e.g),e.b=i(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Fn={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},zn={r:0,g:0,b:0},Hn={h:0,s:0,l:0},Gn={h:0,s:0,l:0};function Vn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Wn(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class jn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Un.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=zt){return this.r=e,this.g=t,this.b=n,Un.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=zt){if(e=Mn(e,1),t=wn(t,0,1),n=wn(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Vn(r,i,e+1/3),this.g=Vn(r,i,e),this.b=Vn(r,i,e-1/3)}return Un.toWorkingColorSpace(this,i),this}setStyle(e,t=Ft){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,Un.toWorkingColorSpace(this,t),n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,Un.toWorkingColorSpace(this,t),n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return n(e[4]),this.setHSL(i,r,s,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=i[1],n=e.length;if(3===n)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,Un.toWorkingColorSpace(this,t),this;if(6===n)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,Un.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ft){const n=Fn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=Nn(e.r),this.g=Nn(e.g),this.b=Nn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ft){return Un.fromWorkingColorSpace(Wn(this,zn),e),wn(255*zn.r,0,255)<<16^wn(255*zn.g,0,255)<<8^wn(255*zn.b,0,255)<<0}getHexString(e=Ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=zt){Un.fromWorkingColorSpace(Wn(this,zn),t);const n=zn.r,i=zn.g,r=zn.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=On("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case ue:e.x=e.x<0?0:1;break;case de:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case he:e.y=e.y-Math.floor(e.y);break;case ue:e.y=e.y<0?0:1;break;case de:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}Kn.DEFAULT_IMAGE=null,Kn.DEFAULT_MAPPING=re,Kn.prototype.isTexture=!0;class Qn{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)a&&e>y?ey?a=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}si.prototype.isQuaternion=!0;class oi{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(li.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(li.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=a*t+s*i-o*n,c=a*n+o*t-r*i,h=a*i+r*n-s*t,u=-r*t-s*n-o*i;return this.x=l*a+u*-r+c*-o-h*-s,this.y=c*a+u*-s+h*-r-l*-o,this.z=h*a+u*-o+l*-s-c*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ai.copy(this).projectOnVector(e),this.sub(ai)}reflect(e){return this.sub(ai.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}oi.prototype.isVector3=!0;const ai=new oi,li=new si;class ci{constructor(e=new oi(1/0,1/0,1/0),t=new oi(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.length;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.count;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ui),ui.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vi),xi.subVectors(this.max,vi),pi.subVectors(e.a,vi),fi.subVectors(e.b,vi),mi.subVectors(e.c,vi),gi.subVectors(fi,pi),yi.subVectors(mi,fi),_i.subVectors(pi,mi);let t=[0,-gi.z,gi.y,0,-yi.z,yi.y,0,-_i.z,_i.y,gi.z,0,-gi.x,yi.z,0,-yi.x,_i.z,0,-_i.x,-gi.y,gi.x,0,-yi.y,yi.x,0,-_i.y,_i.x,0];return!!Mi(t,pi,fi,mi,xi)&&(t=[1,0,0,0,1,0,0,0,1],!!Mi(t,pi,fi,mi,xi)&&(bi.crossVectors(gi,yi),t=[bi.x,bi.y,bi.z],Mi(t,pi,fi,mi,xi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ui.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ui).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(hi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ci.prototype.isBox3=!0;const hi=[new oi,new oi,new oi,new oi,new oi,new oi,new oi,new oi],ui=new oi,di=new ci,pi=new oi,fi=new oi,mi=new oi,gi=new oi,yi=new oi,_i=new oi,vi=new oi,xi=new oi,bi=new oi,wi=new oi;function Mi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){wi.fromArray(e,s);const o=r.x*Math.abs(wi.x)+r.y*Math.abs(wi.y)+r.z*Math.abs(wi.z),a=t.dot(wi),l=n.dot(wi),c=i.dot(wi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Si=new ci,Ei=new oi,Ti=new oi,Ai=new oi;class Ci{constructor(e=new oi,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Si.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ai.subVectors(e,this.center);const t=Ai.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ai.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?Ti.set(0,0,1).multiplyScalar(e.radius):Ti.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ei.copy(e.center).add(Ti)),this.expandByPoint(Ei.copy(e.center).sub(Ti)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Li=new oi,Ri=new oi,Pi=new oi,Di=new oi,Ii=new oi,Oi=new oi,ki=new oi;class Ni{constructor(e=new oi,t=new oi(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Li.copy(this.direction).multiplyScalar(t).add(this.origin),Li.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ri.copy(e).add(t).multiplyScalar(.5),Pi.copy(t).sub(e).normalize(),Di.copy(this.origin).sub(Ri);const r=.5*e.distanceTo(t),s=-this.direction.dot(Pi),o=Di.dot(this.direction),a=-Di.dot(Pi),l=Di.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Pi).multiplyScalar(u).add(Ri),d}intersectSphere(e,t){Li.subVectors(e.center,this.origin);const n=Li.dot(this.direction),i=Li.dot(Li)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,s=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,s=(e.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Li)}intersectTriangle(e,t,n,i,r){Ii.subVectors(t,e),Oi.subVectors(n,e),ki.crossVectors(Ii,Oi);let s,o=this.direction.dot(ki);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Di.subVectors(this.origin,e);const a=s*this.direction.dot(Oi.crossVectors(Di,Oi));if(a<0)return null;const l=s*this.direction.dot(Ii.cross(Di));if(l<0)return null;if(a+l>o)return null;const c=-s*Di.dot(ki);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Bi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Bi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ui.setFromMatrixColumn(e,0).length(),r=1/Ui.setFromMatrixColumn(e,1).length(),s=1/Ui.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zi,e,Hi)}lookAt(e,t,n){const i=this.elements;return Wi.subVectors(e,t),0===Wi.lengthSq()&&(Wi.z=1),Wi.normalize(),Gi.crossVectors(n,Wi),0===Gi.lengthSq()&&(1===Math.abs(n.z)?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),Gi.crossVectors(n,Wi)),Gi.normalize(),Vi.crossVectors(Wi,Gi),i[0]=Gi.x,i[4]=Vi.x,i[8]=Wi.x,i[1]=Gi.y,i[5]=Vi.y,i[9]=Wi.y,i[2]=Gi.z,i[6]=Vi.z,i[10]=Wi.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],C=i[13],L=i[2],R=i[6],P=i[10],D=i[14],I=i[3],O=i[7],k=i[11],N=i[15];return r[0]=s*b+o*E+a*L+l*I,r[4]=s*w+o*T+a*R+l*O,r[8]=s*M+o*A+a*P+l*k,r[12]=s*S+o*C+a*D+l*N,r[1]=c*b+h*E+u*L+d*I,r[5]=c*w+h*T+u*R+d*O,r[9]=c*M+h*A+u*P+d*k,r[13]=c*S+h*C+u*D+d*N,r[2]=p*b+f*E+m*L+g*I,r[6]=p*w+f*T+m*R+g*O,r[10]=p*M+f*A+m*P+g*k,r[14]=p*S+f*C+m*D+g*N,r[3]=y*b+_*E+v*L+x*I,r[7]=y*w+_*T+v*R+x*O,r[11]=y*M+_*A+v*P+x*k,r[15]=y*S+_*C+v*D+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-i*l*h-r*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*s*h-n*s*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=h*m*l-f*u*l+f*a*d-o*m*d-h*a*g+o*u*g,_=p*u*l-c*m*l-p*a*d+s*m*d+c*a*g-s*u*g,v=c*f*l-p*h*l+p*o*d-s*f*d-c*o*g+s*h*g,x=p*h*a-c*f*a-p*o*u+s*f*u+c*o*m-s*h*m,b=t*y+n*_+i*v+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,e[2]=(o*m*r-f*a*r+f*i*l-n*m*l-o*i*g+n*a*g)*w,e[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=_*w,e[5]=(c*m*r-p*u*r+p*i*d-t*m*d-c*i*g+t*u*g)*w,e[6]=(p*a*r-s*m*r-p*i*l+t*m*l+s*i*g-t*a*g)*w,e[7]=(s*u*r-c*a*r+c*i*l-t*u*l-s*i*d+t*a*d)*w,e[8]=v*w,e[9]=(p*h*r-c*f*r-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(s*f*r-p*o*r+p*n*l-t*f*l-s*n*g+t*o*g)*w,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*f*i-p*h*i+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*o*i-s*f*i-p*n*a+t*f*a+s*n*m-t*o*m)*w,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=o*h,y=a*l,_=a*c,v=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+v)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(u+g))*b,i[6]=(m+y)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-y)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ui.set(i[0],i[1],i[2]).length();const s=Ui.set(i[4],i[5],i[6]).length(),o=Ui.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Fi.copy(this);const a=1/r,l=1/s,c=1/o;return Fi.elements[0]*=a,Fi.elements[1]*=a,Fi.elements[2]*=a,Fi.elements[4]*=l,Fi.elements[5]*=l,Fi.elements[6]*=l,Fi.elements[8]*=c,Fi.elements[9]*=c,Fi.elements[10]*=c,t.setFromRotationMatrix(Fi),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,s){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(s-r),h=(t+e)*a,u=(n+i)*l,d=(s+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Bi.prototype.isMatrix4=!0;const Ui=new oi,Fi=new Bi,zi=new oi(0,0,0),Hi=new oi(1,1,1),Gi=new oi,Vi=new oi,Wi=new oi,ji=new Bi,qi=new si;class Xi{constructor(e=0,t=0,n=0,i=Xi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(wn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-wn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(wn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-wn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-wn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ji.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ji,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qi.setFromEuler(this),this.setFromQuaternion(qi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xi.prototype.isEuler=!0,Xi.DefaultOrder="XYZ",Xi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ji{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){cr.subVectors(i,t),hr.subVectors(n,t),ur.subVectors(e,t);const s=cr.dot(cr),o=cr.dot(hr),a=cr.dot(ur),l=hr.dot(hr),c=hr.dot(ur),h=s*l-o*o;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,dr),dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getUV(e,t,n,i,r,s,o,a){return this.getBarycoord(e,t,n,i,dr),a.set(0,0),a.addScaledVector(r,dr.x),a.addScaledVector(s,dr.y),a.addScaledVector(o,dr.z),a}static isFrontFacing(e,t,n,i){return cr.subVectors(n,t),hr.subVectors(e,t),cr.cross(hr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return cr.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),.5*cr.cross(hr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return vr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return vr.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;pr.subVectors(i,n),fr.subVectors(r,n),gr.subVectors(e,n);const a=pr.dot(gr),l=fr.dot(gr);if(a<=0&&l<=0)return t.copy(n);yr.subVectors(e,i);const c=pr.dot(yr),h=fr.dot(yr);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(pr,s);_r.subVectors(e,r);const d=pr.dot(_r),p=fr.dot(_r);if(p>=0&&d<=p)return t.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fr,o);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return mr.subVectors(r,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(mr,o);const g=1/(m+f+u);return s=f*g,o=u*g,t.copy(n).addScaledVector(pr,s).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let xr=0;class br extends gn{constructor(){super(),Object.defineProperty(this,"id",{value:xr++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=O,this.blendDst=k,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=nn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gt,this.stencilZFail=Gt,this.stencilZPass=Gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===y;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==f&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}br.prototype.isMaterial=!0,br.fromType=function(){return null};class wr extends br{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}wr.prototype.isMeshBasicMaterial=!0;const Mr=new oi,Sr=new Ln;class Er{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(r),!1===e.ray.intersectsSphere(qr))return;if(Wr.copy(r).invert(),jr.copy(e.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===jr.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:os.clone(),object:e}}(e,t,n,i,Xr,Jr,Yr,ss);if(p){a&&(ns.fromBufferAttribute(a,c),is.fromBufferAttribute(a,h),rs.fromBufferAttribute(a,u),p.uv=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln)),l&&(ns.fromBufferAttribute(l,c),is.fromBufferAttribute(l,h),rs.fromBufferAttribute(l,u),p.uv2=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln));const e={a:c,b:h,c:u,normal:new oi,materialIndex:0};vr.getNormal(Xr,Jr,Yr,e.normal),p.face=e}return p}as.prototype.isMesh=!0;class cs extends Vr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,i,r,s,p,f,m,g,y){const _=s/m,v=p/g,x=s/2,b=p/2,w=f/2,M=m+1,S=g+1;let E=0,T=0;const A=new oi;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}ps.prototype.isShaderMaterial=!0;class fs extends lr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Bi,this.projectionMatrix=new Bi,this.projectionMatrixInverse=new Bi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}fs.prototype.isCamera=!0;class ms extends fs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*xn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*vn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*xn*Math.atan(Math.tan(.5*vn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*vn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}ms.prototype.isPerspectiveCamera=!0;const gs=90;class ys extends lr{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ms(gs,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new oi(1,0,0)),this.add(i);const r=new ms(gs,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new oi(-1,0,0)),this.add(r);const s=new ms(gs,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new oi(0,1,0)),this.add(s);const o=new ms(gs,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new oi(0,-1,0)),this.add(o);const a=new ms(gs,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new oi(0,0,1)),this.add(a);const l=new ms(gs,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new oi(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,c=e.getRenderTarget(),h=e.toneMapping,u=e.xr.enabled;e.toneMapping=Q,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=h,e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class _s extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:se,n,i,r,s,o,a,l,c),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}_s.prototype.isCubeTexture=!0;class vs extends $n{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new _s(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:_e}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new cs(5,5,5),o=new ps({name:"CubemapFromEquirect",uniforms:hs(n),vertexShader:i,fragmentShader:r,side:m,blending:v});o.uniforms.tEquirect.value=t;const a=new as(s,o),l=t.minFilter;return t.minFilter===be&&(t.minFilter=_e),new ys(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}vs.prototype.isWebGLCubeRenderTarget=!0;const xs=new oi,bs=new oi,ws=new Rn;class Ms{constructor(e=new oi(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=xs.subVectors(n,t).cross(bs.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(xs),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ws.getNormalMatrix(e),i=this.coplanarPoint(xs).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Ms.prototype.isPlane=!0;const Ss=new Ci,Es=new oi;class Ts{constructor(e=new Ms,t=new Ms,n=new Ms,i=new Ms,r=new Ms,s=new Ms){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],_=n[15];return t[0].setComponents(o-i,h-a,f-u,_-m).normalize(),t[1].setComponents(o+i,h+a,f+u,_+m).normalize(),t[2].setComponents(o+r,h+l,f+d,_+g).normalize(),t[3].setComponents(o-r,h-l,f-d,_-g).normalize(),t[4].setComponents(o-s,h-c,f-p,_-y).normalize(),t[5].setComponents(o+s,h+c,f+p,_+y).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ss.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(e){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Es.y=i.normal.y>0?e.max.y:e.min.y,Es.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Es)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Cs(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 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}\nfloat 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}\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\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; }\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 color ) { return dot( color, vec3( 0.3333 ) ); }\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};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.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}",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\tvec2 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 r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), 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_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 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, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( 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}",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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\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 )\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 )\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:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, 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#if defined( 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, 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#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\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\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_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\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 ( PHYSICALLY_CORRECT_LIGHTS )\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#else\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#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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\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 GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\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_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, 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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\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 ], geometry.normal );\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, vUv2 );\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( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\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#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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\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_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\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, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\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\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\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 = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\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 OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - 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_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, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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\tvarying vec4 vSpotShadowCoord[ 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#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\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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, vSpotShadowCoord[ 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\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\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, vUv );\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 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}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\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\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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\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;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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, vUv2 );\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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \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 + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Ps={common:{diffuse:{value:new jn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Rn},uv2Transform:{value:new Rn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ln(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new jn(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 jn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}},sprite:{diffuse:{value:new jn(16777215)},opacity:{value:1},center:{value:new Ln(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}}},Ds={basic:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.fog]),vertexShader:Rs.meshbasic_vert,fragmentShader:Rs.meshbasic_frag},lambert:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshlambert_vert,fragmentShader:Rs.meshlambert_frag},phong:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},specular:{value:new jn(1118481)},shininess:{value:30}}]),vertexShader:Rs.meshphong_vert,fragmentShader:Rs.meshphong_frag},standard:{uniforms:us([Ps.common,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.roughnessmap,Ps.metalnessmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag},toon:{uniforms:us([Ps.common,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.gradientmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshtoon_vert,fragmentShader:Rs.meshtoon_frag},matcap:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,{matcap:{value:null}}]),vertexShader:Rs.meshmatcap_vert,fragmentShader:Rs.meshmatcap_frag},points:{uniforms:us([Ps.points,Ps.fog]),vertexShader:Rs.points_vert,fragmentShader:Rs.points_frag},dashed:{uniforms:us([Ps.common,Ps.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Rs.linedashed_vert,fragmentShader:Rs.linedashed_frag},depth:{uniforms:us([Ps.common,Ps.displacementmap]),vertexShader:Rs.depth_vert,fragmentShader:Rs.depth_frag},normal:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,{opacity:{value:1}}]),vertexShader:Rs.meshnormal_vert,fragmentShader:Rs.meshnormal_frag},sprite:{uniforms:us([Ps.sprite,Ps.fog]),vertexShader:Rs.sprite_vert,fragmentShader:Rs.sprite_frag},background:{uniforms:{uvTransform:{value:new Rn},t2D:{value:null}},vertexShader:Rs.background_vert,fragmentShader:Rs.background_frag},cube:{uniforms:us([Ps.envmap,{opacity:{value:1}}]),vertexShader:Rs.cube_vert,fragmentShader:Rs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Rs.equirect_vert,fragmentShader:Rs.equirect_frag},distanceRGBA:{uniforms:us([Ps.common,Ps.displacementmap,{referencePosition:{value:new oi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Rs.distanceRGBA_vert,fragmentShader:Rs.distanceRGBA_frag},shadow:{uniforms:us([Ps.lights,Ps.fog,{color:{value:new jn(0)},opacity:{value:1}}]),vertexShader:Rs.shadow_vert,fragmentShader:Rs.shadow_frag}};function Is(e,t,n,i,r,s){const o=new jn(0);let a,l,c=!0===r?0:1,h=null,u=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,p(o,c)},render:function(n,r){let s=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const y=e.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(g=null),null===g?p(o,c):g&&g.isColor&&(p(g,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===ce)?(void 0===l&&(l=new as(new cs(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:hs(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,h===g&&u===g.version&&d===e.toneMapping||(l.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new as(new Ls(2,2),new ps({name:"BackgroundMaterial",uniforms:hs(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&u===g.version&&d===e.toneMapping||(a.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),a.layers.enableAll(),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Os(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},l=p(null);let c=l,h=!1;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){const t=[],n=[],i=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return c.attributesNum!==o||c.index!==i}(r,v,d,x),b&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const a=n.getAttributes();for(const t in a)if(a[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}c.attributes=r,c.attributesNum=o,c.index=i}(r,v,d,x)}else{const e=!0===l.wireframe;c.geometry===v.id&&c.program===d.id&&c.wireframe===e||(c.geometry=v.id,c.program=d.id,c.wireframe=e,b=!0)}null!==x&&n.update(x,34963),(b||h)&&(h=!1,function(r,s,o,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();const l=a.attributes,c=o.getAttributes(),h=s.defaultAttributeValues;for(const t in c){const i=c[t];if(i.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,o=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=s||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),y=e.getParameter(36349),_=u>0,v=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:_,floatFragmentTextures:v,floatVertexTextures:_&&v,maxSamples:s?e.getParameter(36183):0}}function Bs(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new Ms,a=new Rn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length0){const o=new vs(s.height/2);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Ds.physical={uniforms:us([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ln(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new jn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ln},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new jn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new jn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag};class Fs extends fs{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Fs.prototype.isOrthographicCamera=!0;const zs=[.125,.215,.35,.446,.526,.582],Hs=new Fs,Gs=new jn;let Vs=null;const Ws=(1+Math.sqrt(5))/2,js=1/Ws,qs=[new oi(1,1,1),new oi(-1,1,1),new oi(1,1,-1),new oi(-1,1,-1),new oi(0,Ws,js),new oi(0,Ws,-js),new oi(js,0,Ws),new oi(-js,0,Ws),new oi(Ws,js,0),new oi(-Ws,js,0)];class Xs{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Vs=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ks(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Zs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?a=zs[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,y=new Float32Array(f*p*d),_=new Float32Array(m*p*d),v=new Float32Array(g*p*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];y.set(i,f*p*e),_.set(u,m*p*e);const r=[e,e,e,e,e,e];v.set(r,g*p*e)}const x=new Vr;x.setAttribute("position",new Er(y,f)),x.setAttribute("uv",new Er(_,m)),x.setAttribute("faceIndex",new Er(v,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new oi(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new as(this._lodPlanes[0],e);this._renderer.compile(t,Hs)}_sceneToCubeUV(e,t,n,i){const r=new ms(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(Gs),a.toneMapping=Q,a.autoClear=!1;const h=new wr({name:"PMREM.Background",side:m,depthWrite:!1,depthTest:!1}),u=new as(new cs,h);let d=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(Gs),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ys(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(e,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===se||e.mapping===oe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ks()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Zs());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new as(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ys(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Hs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ey-4?i-y+4:0),4*(this._cubeSize-_),3*_,2*_),a.setRenderTarget(t),a.render(c,Hs)}}function Js(e,t,n){const i=new $n(e,t,n);return i.texture.mapping=ce,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ys(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Zs(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}function Ks(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\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",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:v,depthTest:!1,depthWrite:!1})}function Qs(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ae||s===le,a=s===se||s===oe;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new Xs(e)),i=o?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new Xs(e));const s=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $s(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function eo(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);const m=new Float32Array(p*f*4*r),g=new ei(m,p,f,r);g.type=Le,g.needsUpdate=!0;const y=4*d;for(let t=0;t0)return e;const r=t*n;let s=po[r];if(void 0===s&&(s=new Float32Array(r),po[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function vo(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function wa(e){return e.replace(ba,Ma)}function Ma(e,t){const n=Rs[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return wa(n)}const Sa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ea=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ta(e){return e.replace(Ea,Ca).replace(Sa,Aa)}function Aa(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ca(0,t,n,i)}function Ca(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(v+="\n"),x=[g,y].filter(_a).join("\n"),x.length>0&&(x+="\n")):(v=[La(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(_a).join("\n"),x=[g,La(n),"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Rs.tonemapping_pars_fragment:"",n.toneMapping!==Q?ya("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Rs.encodings_pars_fragment,ga("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_a).join("\n")),o=wa(o),o=va(o,n),o=xa(o,n),a=wa(a),a=va(a,n),a=xa(a,n),o=Ta(o),a=Ta(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+v,x=["#define varying in",n.glslVersion===fn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,M=pa(r,35633,b+v+o),S=pa(r,35632,w);if(r.attachShader(_,M),r.attachShader(_,S),void 0!==n.index0AttributeName?r.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(_).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(_,35714)){i=!1;const t=ma(r,M,"vertex"),n=ma(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:v},fragmentShader:{log:n,prefix:x}})}let E,T;return r.deleteShader(M),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new da(r,_)),E},this.getAttributes=function(){return void 0===T&&(T=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,k=s.clearcoat>0;return{isWebGL2:h,shaderID:E,shaderName:s.type,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:d,outputEncoding:null===I?e.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:Dt,map:!!s.map,matcap:!!s.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===Bt,tangentSpaceNormalMap:s.normalMapType===Nt,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===It,clearcoat:k,clearcoatMap:k&&!!s.clearcoatMap,clearcoatRoughnessMap:k&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:k&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===x,alphaMap:!!s.alphaMap,alphaTest:O,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:A,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===g,flipSided:s.side===m,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0),t.supportsVertexTextures&&a.enable(1),t.instancing&&a.enable(2),t.instancingColor&&a.enable(3),t.map&&a.enable(4),t.matcap&&a.enable(5),t.envMap&&a.enable(6),t.lightMap&&a.enable(7),t.aoMap&&a.enable(8),t.emissiveMap&&a.enable(9),t.bumpMap&&a.enable(10),t.normalMap&&a.enable(11),t.objectSpaceNormalMap&&a.enable(12),t.tangentSpaceNormalMap&&a.enable(13),t.clearcoat&&a.enable(14),t.clearcoatMap&&a.enable(15),t.clearcoatRoughnessMap&&a.enable(16),t.clearcoatNormalMap&&a.enable(17),t.displacementMap&&a.enable(18),t.specularMap&&a.enable(19),t.roughnessMap&&a.enable(20),t.metalnessMap&&a.enable(21),t.gradientMap&&a.enable(22),t.alphaMap&&a.enable(23),t.alphaTest&&a.enable(24),t.vertexColors&&a.enable(25),t.vertexAlphas&&a.enable(26),t.vertexUvs&&a.enable(27),t.vertexTangents&&a.enable(28),t.uvsVertexOnly&&a.enable(29),t.fog&&a.enable(30),e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0),t.flatShading&&a.enable(1),t.logarithmicDepthBuffer&&a.enable(2),t.skinning&&a.enable(3),t.morphTargets&&a.enable(4),t.morphNormals&&a.enable(5),t.morphColors&&a.enable(6),t.premultipliedAlpha&&a.enable(7),t.shadowMapEnabled&&a.enable(8),t.physicallyCorrectLights&&a.enable(9),t.doubleSided&&a.enable(10),t.flipSided&&a.enable(11),t.useDepthPacking&&a.enable(12),t.dithering&&a.enable(13),t.specularIntensityMap&&a.enable(14),t.specularColorMap&&a.enable(15),t.transmission&&a.enable(16),t.transmissionMap&&a.enable(17),t.thicknessMap&&a.enable(18),t.sheen&&a.enable(19),t.sheenColorMap&&a.enable(20),t.sheenRoughnessMap&&a.enable(21),t.decodeVideoTexture&&a.enable(22),t.opaque&&a.enable(23),e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Ds[t];n=ds.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Na),i.length>1&&i.sort(t||Ba),r.length>1&&r.sort(t||Ba)}}}function Fa(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Ua,e.set(t,[i])):n>=e.get(t).length?(i=new Ua,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function za(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new oi,color:new jn};break;case"SpotLight":n={position:new oi,direction:new oi,color:new jn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oi,color:new jn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oi,skyColor:new jn,groundColor:new jn};break;case"RectAreaLight":n={color:new jn,position:new oi,halfWidth:new oi,halfHeight:new oi}}return e[t.id]=n,n}}}let Ha=0;function Ga(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Va(e,t){const n=new za,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new oi);const s=new oi,o=new Bi,a=new Bi;return{setup:function(s,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,m=0,g=0,y=0;s.sort(Ga);const _=!0!==o?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ps.LTC_FLOAT_1,r.rectAreaLTC2=Ps.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ps.LTC_HALF_1,r.rectAreaLTC2=Ps.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=c;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===m&&v.numPointShadows===g&&v.numSpotShadows===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,v.directionalLength=h,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=m,v.numPointShadows=g,v.numSpotShadows=y,r.version=Ha++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(s=new Wa(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class qa extends br{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Ot,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}qa.prototype.isMeshDepthMaterial=!0;class Xa extends br{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new oi,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Ja(e,t,n){let i=new Ts;const r=new Ln,s=new Ln,o=new Qn,a=new qa({depthPacking:kt}),l=new Xa,c={},h=n.maxTextureSize,d={0:m,1:f,2:g},y=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ln},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 \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}"}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const x=new Vr;x.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new as(x,y),w=this;function M(n,i){const r=t.update(b);y.defines.VSM_SAMPLES!==n.blurSamples&&(y.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),y.uniforms.shadow_pass.value=n.map.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,y,b,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,b,null)}function S(t,n,i,r,s,o){let h=null;const u=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==u?u:!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const e=h.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=h.clone(),i[t]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=o===p?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=s),h}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===p)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let l=0,c=t.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null!==u.map||u.isPointLightShadow||this.type!==p||(u.map=new $n(r.x,r.y),u.map.texture.name=c.name+".shadowMap",u.mapPass=new $n(r.x,r.y),u.camera.updateProjectionMatrix()),null===u.map){const e={minFilter:pe,magFilter:pe,format:Ne};u.map=new $n(r.x,r.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==he.indexOf("OpenGL ES")&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),le=ce>=2);let ue=null,de={};const pe=e.getParameter(3088),fe=e.getParameter(2978),me=(new Qn).fromArray(pe),ge=(new Qn).fromArray(fe);function ye(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?An:Math.floor,s=i(r*e.width),o=i(r*e.height);void 0===m&&(m=_(s,o));const a=n?_(s,o):m;return a.width=s,a.height=o,a.getContext("2d").drawImage(e,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function x(e){return En(e.width)&&En(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==pe&&e.minFilter!==_e}function w(t){e.generateMipmap(t)}function M(n,i,r,s,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===It&&!1===o?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||t.get("EXT_color_buffer_float"),l}function S(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==pe&&e.minFilter!==_e?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function E(e){return e===pe||e===fe||e===ge?9728:9729}function T(e){const t=e.target;t.removeEventListener("dispose",T),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=g.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&C(e),0===Object.keys(r).length&&g.delete(n)}i.remove(e)}(t),t.isVideoTexture&&f.delete(t)}function A(t){const n=t.target;n.removeEventListener("dispose",A),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&r.__version!==e.version){const n=e.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void k(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}const P={[he]:10497,[ue]:33071,[de]:33648},D={[pe]:9728,[fe]:9984,[ge]:9986,[_e]:9729,[ve]:9985,[be]:9987};function I(n,s,o){if(o?(e.texParameteri(n,10242,P[s.wrapS]),e.texParameteri(n,10243,P[s.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[s.wrapR]),e.texParameteri(n,10240,D[s.magFilter]),e.texParameteri(n,10241,D[s.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),s.wrapS===ue&&s.wrapT===ue||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,E(s.magFilter)),e.texParameteri(n,10241,E(s.minFilter)),s.minFilter!==pe&&s.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const o=t.get("EXT_texture_filter_anisotropic");if(s.type===Le&&!1===t.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Re&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function O(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&C(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function k(t,i,r){let o=3553;i.isDataArrayTexture&&(o=35866),i.isData3DTexture&&(o=32879);const l=O(t,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),c.version!==c.__currentVersion||!0===l){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=function(e){return!a&&(e.wrapS!==ue||e.wrapT!==ue||e.minFilter!==pe&&e.minFilter!==_e)}(i)&&!1===x(i.image);let u=v(i.image,r,!1,h);u=H(i,u);const d=x(u)||a,p=s.convert(i.format,i.encoding);let f,m=s.convert(i.type),g=M(i.internalFormat,p,m,i.encoding,i.isVideoTexture);I(o,i,d);const y=i.mipmaps,_=a&&!0!==i.isVideoTexture,E=void 0===t.__version||!0===l,T=S(i,u,d);if(i.isDepthTexture)g=6402,a?g=i.type===Le?36012:i.type===Ce?33190:i.type===Ie?35056:33189:i.type===Le&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Fe&&6402===g&&i.type!==Te&&i.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Te,m=s.convert(i.type)),i.format===ze&&6402===g&&(g=34041,i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ie,m=s.convert(i.type))),E&&(_?n.texStorage2D(3553,1,g,u.width,u.height):n.texImage2D(3553,0,g,u.width,u.height,0,p,m,null));else if(i.isDataTexture)if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e>=1,t>>=1}}else if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,n){const i=e.encoding,r=e.format,s=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===mn||i!==Dt&&(i===It?!1===a?!0===t.has("EXT_sRGB")&&r===Ne?(e.format=mn,e.minFilter=_e,e.generateMipmaps=!1):n=Xn.sRGBToLinear(n):r===Ne&&s===Me||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const e=L;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(t,r){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;const o=O(t,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===o){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,o=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=r||o?o?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=H(i,h[e]);const u=h[0],d=x(u)||a,p=s.convert(i.format,i.encoding),f=s.convert(i.type),m=M(i.internalFormat,p,f,i.encoding),g=a&&!0!==i.isVideoTexture,y=void 0===t.__version;let _,E=S(i,u,d);if(I(34067,i,d),r){g&&y&&n.texStorage2D(34067,E,m,u.width,u.height);for(let e=0;e<6;e++){_=h[e].mipmaps;for(let t=0;t<_.length;t++){const r=_[t];i.format!==Ne?null!==p?g?n.compressedTexSubImage2D(34069+e,t,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+e,t,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+e,t,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+e,t,m,r.width,r.height,0,p,f,r.data)}}}else{_=i.mipmaps,g&&y&&(_.length>0&&E++,n.texStorage2D(34067,E,m,h[0].width,h[0].height));for(let e=0;e<6;e++)if(o){g?n.texSubImage2D(34069+e,0,0,0,h[e].width,h[e].height,p,f,h[e].data):n.texImage2D(34069+e,0,m,h[e].width,h[e].height,0,p,f,h[e].data);for(let t=0;t<_.length;t++){const i=_[t].image[e].image;g?n.texSubImage2D(34069+e,t+1,0,0,i.width,i.height,p,f,i.data):n.texImage2D(34069+e,t+1,m,i.width,i.height,0,p,f,i.data)}}else{g?n.texSubImage2D(34069+e,0,0,0,p,f,h[e]):n.texImage2D(34069+e,0,m,p,f,h[e]);for(let t=0;t<_.length;t++){const i=_[t];g?n.texSubImage2D(34069+e,t+1,0,0,p,f,i.image[e]):n.texImage2D(34069+e,t+1,m,p,f,i.image[e])}}}b(i,d)&&w(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){const r=i.get(e);void 0!==t&&N(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&U(e)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",A),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=x(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;t0&&!1===z(t)){c.__webglMultisampledFramebuffer=e.createFramebuffer(),c.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),o=M(l.internalFormat,i,r,l.encoding),a=F(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(c.__webglDepthRenderbuffer=e.createRenderbuffer(),B(c.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),I(34067,l,p);for(let e=0;e<6;e++)N(c.__webglFramebuffer[e],t,l,36064,34069+e);b(l,p)&&w(34067),n.unbindTexture()}else if(d){const e=t.texture;for(let r=0,s=e.length;r0&&!1===z(t)){const r=t.width,s=t.height;let o=16384;const a=[36064],l=t.stencilBuffer?33306:36096;t.depthBuffer&&a.push(l);const c=i.get(t),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(e.invalidateFramebuffer(36008,[l]),e.invalidateFramebuffer(36009,[l])),e.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),p&&e.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=N,this.useMultisampledRTT=z}function Ka(e,t,n){const i=n.isWebGL2;return{convert:function(n,r=null){let s;if(n===Me)return 5121;if(n===Pe)return 32819;if(n===De)return 32820;if(n===Se)return 5120;if(n===Ee)return 5122;if(n===Te)return 5123;if(n===Ae)return 5124;if(n===Ce)return 5125;if(n===Le)return 5126;if(n===Re)return i?5131:(s=t.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(n===Oe)return 6406;if(n===Ne)return 6408;if(n===Be)return 6409;if(n===Ue)return 6410;if(n===Fe)return 6402;if(n===ze)return 34041;if(n===He)return 6403;if(n===ke)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===mn)return s=t.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(n===Ge)return 36244;if(n===Ve)return 33319;if(n===We)return 33320;if(n===je)return 36249;if(n===qe||n===Xe||n===Je||n===Ye)if(r===It){if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(n===qe)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=t.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(n===qe)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ze||n===Ke||n===Qe||n===$e){if(s=t.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(n===Ze)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ke)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qe)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$e)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===et)return s=t.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===tt||n===nt){if(s=t.get("WEBGL_compressed_texture_etc"),null===s)return null;if(n===tt)return r===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===nt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(n===it||n===rt||n===st||n===ot||n===at||n===lt||n===ct||n===ht||n===ut||n===dt||n===pt||n===ft||n===mt||n===gt){if(s=t.get("WEBGL_compressed_texture_astc"),null===s)return null;if(n===it)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===st)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ot)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===at)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ct)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ht)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ut)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ft)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===yt){if(s=t.get("EXT_texture_compression_bptc"),null===s)return null;if(n===yt)return r===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Ie?i?34042:(s=t.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}Xa.prototype.isMeshDistanceMaterial=!0;class Qa extends ms{constructor(e=[]){super(),this.cameras=e}}Qa.prototype.isArrayCamera=!0;class $a extends lr{constructor(){super(),this.type="Group"}}$a.prototype.isGroup=!0;const el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $a,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $a,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new oi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new oi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $a,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new oi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new oi),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==o&&(i=t.getPose(e.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el))),l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const e=new $a;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}const r=l.joints[i.jointName];null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class nl extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){if((c=void 0!==c?c:Fe)!==Fe&&c!==ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Fe&&(n=Te),void 0===n&&c===ze&&(n=Ie),super(null,i,r,s,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==a?a:pe,this.flipY=!1,this.generateMipmaps=!1}}nl.prototype.isDepthTexture=!0;class il extends gn{constructor(e,t){super();const n=this;let i=null,r=1,s=null,o="local-floor",a=null,l=null,c=null,h=null,u=null,d=null;const p=t.getContextAttributes();let f=null,m=null;const g=[],y=new Map,_=new ms;_.layers.enable(1),_.viewport=new Qn;const v=new ms;v.layers.enable(2),v.viewport=new Qn;const x=[_,v],b=new Qa;b.layers.enable(1),b.layers.enable(2);let w=null,M=null;function S(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function E(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),w=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,m=null,P.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function T(e){const t=i.inputSources;for(let e=0;e0&&(n.alphaTest.value=i.alphaTest);const r=t.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const t=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*t}let s,o;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(e,i):i.isMeshToonMaterial?(n(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(n(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(n(e,i),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===m&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o)):i.isMeshMatcapMaterial?(n(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?n(e,i):i.isMeshDistanceMaterial?(n(e,i),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?n(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function sl(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=On("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let d=null,p=null;const y=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Dt,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1;const v=this;let x=!1,b=0,w=0,M=null,S=-1,E=null;const T=new Qn,A=new Qn;let C=null,L=t.width,R=t.height,P=1,D=null,I=null;const O=new Qn(0,0,L,R),k=new Qn(0,0,L,R);let N=!1;const B=new Ts;let U=!1,F=!1,z=null;const H=new Bi,G=new Ln,V=new oi,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===M?P:1}let q,X,J,Y,Z,K,$,ee,te,ne,ie,re,se,oe,ae,le,ce,he,ue,de,pe,fe,me,ge=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){const i=X.isWebGL2;null===z&&(z=new $n(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Re:Me,minFilter:be,samples:i&&!0===o?4:0})),v.getDrawingBufferSize(G),i?z.setSize(G.x,G.y):z.setSize(An(G.x),An(G.y));const r=v.getRenderTarget();v.setRenderTarget(z),v.clear();const s=v.toneMapping;v.toneMapping=Q,Ie(e,t,n),v.toneMapping=s,K.updateMultisampleRenderTarget(z),K.updateRenderTargetMipmap(z),v.setRenderTarget(r)}(r,t,n),i&&J.viewport(T.copy(i)),r.length>0&&Ie(r,t,n),s.length>0&&Ie(s,t,n),a.length>0&&Ie(a,t,n),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ie(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?_[_.length-1]:null,y.pop(),d=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(e,t,n){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=n;const i=Z.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=Z.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){M=e,b=t,w=n;let i=!0;if(e){const t=Z.get(e);void 0!==t.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?K.setupRenderTarget(e):t.__hasExternalTextures&&K.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(e){const n=e.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const i=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?Z.get(e).__webglMultisampledFramebuffer:i,T.copy(e.viewport),A.copy(e.scissor),C=e.scissorTest}else T.copy(O).multiplyScalar(P).floor(),A.copy(k).multiplyScalar(P).floor(),C=N;if(J.bindFramebuffer(36160,r)&&X.drawBuffers&&i&&J.drawBuffers(e,r),J.viewport(T),J.scissor(A),J.setScissorTest(C),s){const i=Z.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(o){const i=Z.get(e.texture),r=t||0;ge.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){J.bindFramebuffer(36160,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==Ne&&fe.convert(a)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Re&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(l===Me||fe.convert(l)===ge.getParameter(35738)||l===Le&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ge.readPixels(t,n,i,r,fe.convert(a),fe.convert(l),s)}finally{const e=null!==M?Z.get(M).__webglFramebuffer:null;J.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);K.setTexture2D(t,0),ge.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);K.setTexture2D(n,0),ge.pixelStorei(37440,n.flipY),ge.pixelStorei(37441,n.premultiplyAlpha),ge.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,i,e.x,e.y,r,s,o,a,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ge.texSubImage2D(3553,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ge.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isData3DTexture)K.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(i,0),h=35866}ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment);const u=ge.getParameter(3314),d=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),m=ge.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ge.pixelStorei(3314,g.width),ge.pixelStorei(32878,g.height),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ge.compressedTexSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,g.data)):ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g),ge.pixelStorei(3314,u),ge.pixelStorei(32878,d),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,m),0===r&&i.generateMipmaps&&ge.generateMipmap(h),J.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),J.unbindTexture()},this.resetState=function(){b=0,w=0,M=null,J.reset(),me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sl.prototype.isWebGLRenderer=!0;class ol extends sl{}ol.prototype.isWebGL1Renderer=!0;class al{constructor(e,t=25e-5){this.name="",this.color=new jn(e),this.density=t}clone(){return new al(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}al.prototype.isFogExp2=!0;class ll{constructor(e,t=1,n=1e3){this.name="",this.color=new jn(e),this.near=t,this.far=n}clone(){return new ll(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ll.prototype.isFog=!0;class cl extends lr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}cl.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:a,point:ml.clone(),uv:vr.getUV(ml,bl,wl,Ml,Sl,El,Tl,new Ln),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Cl(e,t,n,i,r,s){_l.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(vl.x=s*_l.x-r*_l.y,vl.y=r*_l.x+s*_l.y):vl.copy(_l),e.copy(t),e.x+=vl.x,e.y+=vl.y,e.applyMatrix4(xl)}Al.prototype.isSprite=!0;const Ll=new oi,Rl=new oi;class Pl extends lr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){Ll.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);const n=Ll.distanceTo(Rl)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;ia)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}tc.prototype.isLine=!0;const nc=new oi,ic=new oi;class rc extends tc{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dc(e,t,n,i,r,s,o){const a=lc.distanceSqToPoint(e);if(ar.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}uc.prototype.isPoints=!0;class pc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.minFilter=void 0!==s?s:_e,this.magFilter=void 0!==r?r:_e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}pc.prototype.isVideoTexture=!0;class fc extends Kn{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=pe,this.minFilter=pe,this.generateMipmaps=!1,this.needsUpdate=!0}}fc.prototype.isFramebufferTexture=!0;class mc extends Kn{constructor(e,t,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}mc.prototype.isCompressedTexture=!0;class gc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.needsUpdate=!0}}gc.prototype.isCanvasTexture=!0;class yc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new Ln:new oi);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oi,i=[],r=[],s=[],o=new oi,a=new Bi;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new oi)}r[0]=new oi,s[0]=new oi;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(wn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(wn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _c extends yc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new Ln,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(bc.subVectors(i[0],i[1]).add(i[0]),o=bc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Tc(o,a.x,l.x,c.x,h.x),Tc(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Fc extends Vr{constructor(e=[new Ln(0,.5),new Ln(.5,0),new Ln(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=wn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new oi,u=new Ln,d=new oi,p=new oi,f=new oi;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),a.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){const d=n+r*c*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*f,s.push(h.x,h.y,h.z),u.x=r/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*f;l.push(i,c,d)}}for(let n=0;n0&&y(!0),t>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(d,2))}static fromJSON(e){return new Gc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vc extends Gc{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Vc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wc extends Vr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Wc(e.vertices,e.indices,e.radius,e.details)}}class jc extends Wc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new jc(e.radius,e.detail)}}const qc=new oi,Xc=new oi,Jc=new oi,Yc=new vr;class Zc extends Vr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(vn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e0)for(s=t;s=t;s-=i)o=vh(s,e[s],e[s+1],o);return o&&ph(o,o.next)&&(xh(o),o=o.next),o}function $c(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!ph(i,i.next)&&0!==dh(i.prev,i,i.next))i=i.next;else{if(xh(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function eh(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=lh(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?nh(e,i,r,s):th(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),xh(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?eh(e=ih($c(e),t,n),t,n,i,r,s,2):2===o&&rh(e,t,n,i,r,s):eh($c(e),t,n,i,r,s,1);break}}function th(e){const t=e.prev,n=e,i=e.next;if(dh(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(hh(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&dh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function nh(e,t,n,i){const r=e.prev,s=e,o=e.next;if(dh(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=lh(a,l,t,n,i),d=lh(c,h,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ih(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!ph(r,s)&&fh(r,i,i.next,s)&&yh(r,s)&&yh(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),xh(i),xh(i.next),i=e=s),i=i.next}while(i!==e);return $c(i)}function rh(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&uh(o,e)){let a=_h(o,e);return o=$c(o,o.next),a=$c(a,a.next),eh(o,t,n,i,r,s),void eh(a,t,n,i,r,s)}e=e.next}o=o.next}while(o!==e)}function sh(e,t){return e.x-t.x}function oh(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&hh(rs.x||n.x===s.x&&ah(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}(e,t)){const n=_h(t,e);$c(t,t.next),$c(n,n.next)}}function ah(e,t){return dh(e.prev,e,t.prev)<0&&dh(t.next,e,e.next)<0}function lh(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ch(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function uh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&fh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(yh(e,t)&&yh(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(dh(e.prev,e,t.prev)||dh(e,t.prev,t))||ph(e,t)&&dh(e.prev,e,e.next)>0&&dh(t.prev,t,t.next)>0)}function dh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ph(e,t){return e.x===t.x&&e.y===t.y}function fh(e,t,n,i){const r=gh(dh(e,t,n)),s=gh(dh(e,t,i)),o=gh(dh(n,i,e)),a=gh(dh(n,i,t));return r!==s&&o!==a||!(0!==r||!mh(e,n,t))||!(0!==s||!mh(e,i,t))||!(0!==o||!mh(n,e,i))||!(0!==a||!mh(n,t,i))}function mh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function gh(e){return e>0?1:e<0?-1:0}function yh(e,t){return dh(e.prev,e,e.next)<0?dh(e,t,e.next)>=0&&dh(e,e.prev,t)>=0:dh(e,t,e.prev)<0||dh(e,e.next,t)<0}function _h(e,t){const n=new bh(e.i,e.x,e.y),i=new bh(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function vh(e,t,n,i){const r=new bh(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function xh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class wh{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return eh(s,o,n,a,l,p),o}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function Sh(e,t){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=t.x-a/u,f=t.y+o/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-a*l);i=p+o*m-e.x,r=f+a*m-e.y;const g=i*i+r*r;if(g<=2)return new Ln(i,r);s=Math.sqrt(g/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Ln(i/s,r/s)}const P=[];for(let e=0,t=T.length,n=t-1,i=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,t=T.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e0)&&d.push(t,r,l),(e!==n-1||a0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Gh.prototype.isMeshPhysicalMaterial=!0;class Vh extends br{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new jn(16777215),this.specular=new jn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}Vh.prototype.isMeshPhongMaterial=!0;class Wh extends br{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new jn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}Wh.prototype.isMeshToonMaterial=!0;class jh extends br{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}jh.prototype.isMeshNormalMaterial=!0;class qh extends br{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}qh.prototype.isMeshLambertMaterial=!0;class Xh extends br{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new jn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}Xh.prototype.isMeshMatcapMaterial=!0;class Jh extends Yl{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Jh.prototype.isLineDashedMaterial=!0;const Yh={ShadowMaterial:Fh,SpriteMaterial:pl,RawShaderMaterial:zh,ShaderMaterial:ps,PointsMaterial:oc,MeshPhysicalMaterial:Gh,MeshStandardMaterial:Hh,MeshPhongMaterial:Vh,MeshToonMaterial:Wh,MeshNormalMaterial:jh,MeshLambertMaterial:qh,MeshDepthMaterial:qa,MeshDistanceMaterial:Xa,MeshBasicMaterial:wr,MeshMatcapMaterial:Xh,LineDashedMaterial:Jh,LineBasicMaterial:Yl,Material:br};br.fromType=function(e){return new Yh[e]};const Zh={arraySlice:function(e,t,n){return Zh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Zh.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),d=Zh.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new si).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let e=0;e=r)break e;{const o=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=Zh.arraySlice(n,r,s),this.values=Zh.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&Zh.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Zh.arraySlice(this.times),t=Zh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Mt,r=e.length-1;let s=1;for(let o=1;o0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=Zh.arraySlice(e,0,s),this.values=Zh.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=Zh.arraySlice(this.times,0),t=Zh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tu.prototype.TimeBufferType=Float32Array,tu.prototype.ValueBufferType=Float32Array,tu.prototype.DefaultInterpolation=wt;class nu extends tu{}nu.prototype.ValueTypeName="bool",nu.prototype.ValueBufferType=Array,nu.prototype.DefaultInterpolation=bt,nu.prototype.InterpolantFactoryMethodLinear=void 0,nu.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends tu{}iu.prototype.ValueTypeName="color";class ru extends tu{}ru.prototype.ValueTypeName="number";class su extends Kh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)si.slerpFlat(r,0,s,l-o,s,l,a);return r}}class ou extends tu{InterpolantFactoryMethodLinear(e){return new su(this.times,this.values,this.getValueSize(),e)}}ou.prototype.ValueTypeName="quaternion",ou.prototype.DefaultInterpolation=wt,ou.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends tu{}au.prototype.ValueTypeName="string",au.prototype.ValueBufferType=Array,au.prototype.DefaultInterpolation=bt,au.prototype.InterpolantFactoryMethodLinear=void 0,au.prototype.InterpolantFactoryMethodSmooth=void 0;class lu extends tu{}lu.prototype.ValueTypeName="vector";class cu{constructor(e,t=-1,n,i=At){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hu(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tu.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Zh.flattenJSON(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==mu[e])return void mu[e].push({onLoad:t,onProgress:n,onError:i});mu[e]=[],mu[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=mu[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{uu.add(e,t);const n=mu[e];delete mu[e];for(let e=0,i=n.length;e{const n=mu[e];if(void 0===n)throw this.manager.itemError(e),t;delete mu[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class yu extends fu{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new gu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new jn).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Ln).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new oi).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new Qn).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Rn).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Bi).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Ln).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ln).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Vu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){const n=new du(t);r=new vu(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new vu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){si.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;si.multiplyQuaternionsFlat(e,s,e,t,e,n),si.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const bd=new RegExp("[\\[\\]\\.:\\/]","g"),wd="[^\\[\\]\\.:\\/]",Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sd=/((?:WC+[\/:])*)/.source.replace("WC",wd),Ed=/(WCOD+)?/.source.replace("WCOD",Md),Td=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",wd),Ad=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",wd),Cd=new RegExp("^"+Sd+Ed+Td+Ad+"$"),Ld=["material","materials","bones"];class Rd{constructor(e,t,n){this.path=t,this.parsedPath=n||Rd.parseTrackName(t),this.node=Rd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rd.Composite(e,t,n):new Rd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(bd,"")}static parseTrackName(e){const t=Cd.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Ld.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Rd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Pd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:St,endingEnd:St};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case Ct:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);break;case At:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===xt;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(n===_t){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Et,i.endingEnd=Et):(i.endingStart=e?this.zeroSlopeAtStart?Et:St:Tt,i.endingEnd=t?this.zeroSlopeAtEnd?Et:St:Tt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}class Id extends gn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new xd(Rd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Gd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Vd.prototype.isBox2=!0;const Wd=new oi,jd=new oi;class qd{constructor(e=new oi,t=new oi){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Wd.subVectors(e,this.start),jd.subVectors(this.end,this.start);const n=jd.dot(jd);let i=jd.dot(Wd)/n;return t&&(i=wn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Xd=new oi;class Jd extends lr{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new Vr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{vp.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(vp,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Mp extends rc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Vr;n.setAttribute("position",new Or(t,3)),n.setAttribute("color",new Or([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Yl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new jn,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Sp{constructor(){this.type="ShapePath",this.color=new jn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(e){const t=[];for(let n=0,i=e.length;nNumber.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const r=wh.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],l=new Kc,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1,t=0;for(let e=0,t=d.length;e0&&!1===e&&(m=u)}for(let e=0,t=d.length;e65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=wn(e,-65504,65504),Ap[0]=e;const t=Cp[0],n=t>>23&511;return Lp[n]+((8388607&t)>>Rp[n])}static fromHalfFloat(e){const t=e>>10;return Cp[0]=Pp[Ip[t]+(1023&e)]+Dp[t],Ap[0]}}const Tp=new ArrayBuffer(4),Ap=new Float32Array(Tp),Cp=new Uint32Array(Tp),Lp=new Uint32Array(512),Rp=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Lp[e]=0,Lp[256|e]=32768,Rp[e]=24,Rp[256|e]=24):t<-14?(Lp[e]=1024>>-t-14,Lp[256|e]=1024>>-t-14|32768,Rp[e]=-t-1,Rp[256|e]=-t-1):t<=15?(Lp[e]=t+15<<10,Lp[256|e]=t+15<<10|32768,Rp[e]=13,Rp[256|e]=13):t<128?(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=24,Rp[256|e]=24):(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=13,Rp[256|e]=13)}const Pp=new Uint32Array(2048),Dp=new Uint32Array(64),Ip=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;0==(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,Pp[e]=t|n}for(let e=1024;e<2048;++e)Pp[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Dp[e]=e<<23;Dp[31]=1199570944,Dp[32]=2147483648;for(let e=33;e<63;++e)Dp[e]=2147483648+(e-32<<23);Dp[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(Ip[e]=1024);const Op=0,kp=1,Np=0,Bp=1,Up=2;function Fp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function zp(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}class Hp extends uc{constructor(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(e,t)}}class Gp extends Al{constructor(e){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(e)}}class Vp extends uc{constructor(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(e,t)}}class Wp extends oc{constructor(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class jp extends oc{constructor(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class qp extends oc{constructor(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class Xp extends oi{constructor(e,t,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(e,t,n)}}class Jp extends Er{constructor(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(e,t),this.setUsage(sn)}}class Yp extends Tr{constructor(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(e,t)}}class Zp extends Ar{constructor(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(e,t)}}class Kp extends Cr{constructor(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(e,t)}}class Qp extends Lr{constructor(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(e,t)}}class $p extends Rr{constructor(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(e,t)}}class ef extends Pr{constructor(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(e,t)}}class tf extends Dr{constructor(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(e,t)}}class nf extends Or{constructor(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(e,t)}}class rf extends kr{constructor(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(e,t)}}yc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(yc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Uc.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)};class sf extends Mp{constructor(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(e)}}class of extends gp{constructor(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(e,t)}}class af extends rc{constructor(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new Zc(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}sp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Qd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};class lf extends rc{constructor(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new Nh(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}fu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Vu.extractUrlBase(e)},fu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};class cf extends gu{constructor(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(e)}}class hf extends bu{constructor(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(e)}}Vd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Vd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Vd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Vd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},ci.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ci.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ci.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ci.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ci.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Xi.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Ci.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ts.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},qd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Rn.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Rn.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Rn.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Rn.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Bi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Bi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Bi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new oi).setFromMatrixColumn(this,3)},Bi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Bi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Bi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Bi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Bi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Bi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Bi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Bi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Bi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Bi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Bi.prototype.makeFrustum=function(e,t,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,s)},Bi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ms.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},si.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},si.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Ni.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Ni.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Ni.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},vr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},vr.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},vr.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},vr.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},vr.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},vr.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),vr.getBarycoord(e,t,n,i,r)},vr.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),vr.getNormal(e,t,n,i)},Kc.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Kc.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Eh(this,e)},Kc.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rh(this,e)},Ln.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ln.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Ln.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},oi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},oi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},oi.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},oi.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},oi.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},oi.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},oi.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},oi.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},oi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Qn.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Qn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},lr.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},lr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},lr.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},lr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},lr.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(lr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),as.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(as.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Lt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},ms.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Mu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Er.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===sn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(sn)}}}),Er.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},Er.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Er.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vr.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},Vr.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Er(arguments[1],arguments[2])))},Vr.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},Vr.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Vr.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Vr.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},Vr.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Vr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Eh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Eh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Eh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},cl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Od.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(br.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new jn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(ps.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),sl.prototype.clearTarget=function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},sl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},sl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},sl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},sl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},sl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},sl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},sl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},sl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},sl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},sl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},sl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},sl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},sl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},sl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},sl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},sl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},sl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},sl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},sl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},sl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},sl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},sl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},sl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},sl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(sl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?It:Dt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ja.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});class uf extends vs{constructor(e,t,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(e,n)}}function df(){console.error("THREE.CanvasRenderer has been removed")}function pf(){console.error("THREE.JSONLoader has been removed.")}Object.defineProperties($n.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),pd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new $u).load(e,(function(e){t.setBuffer(e)})),this},vd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ys.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ys.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},Xn.crossOrigin=void 0,Xn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new wu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new xu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Xn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const ff={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function mf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}class gf extends Vr{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}}class yf extends Vr{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}}function _f(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function vf(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function xf(){console.error("THREE.ImmediateRenderObject has been removed.")}class bf extends $n{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class wf extends ei{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class Mf extends ni{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i)},365:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(477);const r={type:"change"},s={type:"start"},o={type:"end"};class a extends i.EventDispatcher{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new i.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",X),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),l=a.NONE},this.update=function(){const t=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),o=s.clone().invert(),m=new i.Vector3,g=new i.Quaternion,y=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(s),h.setFromVector3(t),n.autoRotate&&l===a.NONE&&A(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(h.theta+=u.theta*n.dampingFactor,h.phi+=u.phi*n.dampingFactor):(h.theta+=u.theta,h.phi+=u.phi);let i=n.minAzimuthAngle,_=n.maxAzimuthAngle;return isFinite(i)&&isFinite(_)&&(i<-Math.PI?i+=y:i>Math.PI&&(i-=y),_<-Math.PI?_+=y:_>Math.PI&&(_-=y),h.theta=i<=_?Math.max(i,Math.min(_,h.theta)):h.theta>(i+_)/2?Math.max(i,h.theta):Math.min(_,h.theta)),h.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=d,h.radius=Math.max(n.minDistance,Math.min(n.maxDistance,h.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(h),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),p.set(0,0,0)),d=1,!!(f||m.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c)&&(n.dispatchEvent(r),m.copy(n.object.position),g.copy(n.object.quaternion),f=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",q),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",X)};const n=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,h=new i.Spherical,u=new i.Spherical;let d=1;const p=new i.Vector3;let f=!1;const m=new i.Vector2,g=new i.Vector2,y=new i.Vector2,_=new i.Vector2,v=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,S=[],E={};function T(){return Math.pow(.95,n.zoomSpeed)}function A(e){u.theta-=e}function C(e){u.phi-=e}const L=function(){const e=new i.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),R=function(){const e=new i.Vector3;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),P=function(){const e=new i.Vector3;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;e.copy(s).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*t*o/r.clientHeight,n.object.matrix),R(2*i*o/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function D(e){n.object.isPerspectiveCamera?d/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){n.object.isPerspectiveCamera?d*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function k(e){_.set(e.clientX,e.clientY)}function N(){if(1===S.length)m.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);m.set(e,t)}}function B(){if(1===S.length)_.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);_.set(e,t)}}function U(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function F(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g)}function z(e){if(1===S.length)v.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v)}function H(e){const t=K(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);w.set(0,s),M.set(0,Math.pow(w.y/b.y,n.zoomSpeed)),D(M.y),b.copy(w)}function G(e){!1!==n.enabled&&(0===S.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",W)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(Z(e),S.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;N(),l=a.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;B(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(),n.enablePan&&B(),l=a.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(),n.enableRotate&&N(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),l=a.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;k(e),l=a.PAN}else{if(!1===n.enableRotate)return;O(e),l=a.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),l=a.ROTATE}else{if(!1===n.enablePan)return;k(e),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e))}function V(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),l){case a.TOUCH_ROTATE:if(!1===n.enableRotate)return;F(e),n.update();break;case a.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case a.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&H(e),n.enablePan&&z(e)}(e),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&H(e),n.enableRotate&&F(e)}(e),n.update();break;default:l=a.NONE}}(e):function(e){if(!1!==n.enabled)switch(l){case a.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g),n.update()}(e);break;case a.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,b),M.y>0?D(T()):M.y<0&&I(T()),b.copy(w),n.update()}(e);break;case a.PAN:if(!1===n.enablePan)return;!function(e){v.set(e.clientX,e.clientY),x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v),n.update()}(e)}}(e))}function W(e){Y(e),0===S.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W)),n.dispatchEvent(o),l=a.NONE}function j(e){Y(e)}function q(e){!1!==n.enabled&&!1!==n.enableZoom&&l===a.NONE&&(e.preventDefault(),n.dispatchEvent(s),function(e){e.deltaY<0?I(T()):e.deltaY>0&&D(T()),n.update()}(e),n.dispatchEvent(o))}function X(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:P(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:P(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:P(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:P(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function Y(e){delete E[e.pointerId];for(let t=0;t{"use strict";n.d(t,{G:()=>s});var i=n(477);class r extends i.DataTextureLoader{constructor(e){super(e)}parse(e){e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let t=0;const n=new Uint8Array(e),r={id_length:n[t++],colormap_type:n[t++],image_type:n[t++],colormap_index:n[t++]|n[t++]<<8,colormap_length:n[t++]|n[t++]<<8,colormap_size:n[t++],origin:[n[t++]|n[t++]<<8,n[t++]|n[t++]<<8],width:n[t++]|n[t++]<<8,height:n[t++]|n[t++]<<8,pixel_size:n[t++],flags:n[t++]};!function(e){switch(e.image_type){case 1:case 9:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let s=!1,o=!1,a=!1;switch(r.image_type){case 9:s=!0,o=!0;break;case 1:o=!0;break;case 10:s=!0;break;case 2:break;case 11:s=!0,a=!0;break;case 3:a=!0}const l=new Uint8Array(r.width*r.height*4),c=function(e,t,n,i,r){let s,o;const a=n.pixel_size>>3,l=n.width*n.height*a;if(t&&(o=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;s=new Uint8Array(l);let o=0;const c=new Uint8Array(a);for(;o>4){default:case 2:o=0,c=1,u=t,l=0,h=1,d=n;break;case 0:o=0,c=1,u=t,l=n-1,h=-1,d=-1;break;case 3:o=t-1,c=-1,u=-1,l=0,h=1,d=n;break;case 1:o=t-1,c=-1,u=-1,l=n-1,h=-1,d=-1}if(a)switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d++)c=l[d],e[4*(h+p*u)+0]=c,e[4*(h+p*u)+1]=c,e[4*(h+p*u)+2]=c,e[4*(h+p*u)+3]=255}(e,l,h,d,o,c,u,i);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=2)e[4*(c+d*h)+0]=l[u+0],e[4*(c+d*h)+1]=l[u+0],e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+3]=l[u+1]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l,c){const h=c;let u,d,p,f=0;const m=r.width;for(p=t;p!==i;p+=n)for(d=s;d!==a;d+=o,f++)u=l[f],e[4*(d+m*p)+3]=255,e[4*(d+m*p)+2]=h[3*u+0],e[4*(d+m*p)+1]=h[3*u+1],e[4*(d+m*p)+0]=h[3*u+2]}(e,l,h,d,o,c,u,i,s);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d+=2)c=l[d+0]+(l[d+1]<<8),e[4*(h+p*u)+0]=(31744&c)>>7,e[4*(h+p*u)+1]=(992&c)>>2,e[4*(h+p*u)+2]=(31&c)<<3,e[4*(h+p*u)+3]=32768&c?0:255}(e,l,h,d,o,c,u,i);break;case 24:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=3)e[4*(c+d*h)+3]=255,e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2]}(e,l,h,d,o,c,u,i);break;case 32:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=4)e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2],e[4*(c+d*h)+3]=l[u+3]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(l,r.width,r.height,c.pixel_data,c.palettes),{data:l,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:i.LinearMipmapLinearFilter}}}class s extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===s.path?i.LoaderUtils.extractUrlBase(e):s.path,a=new i.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e,t){function n(e,t){const n=[],i=e.childNodes;for(let e=0,r=i.length;e0&&t.push(new i.VectorKeyframeTrack(r+".position",s,o)),a.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",s,a)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",s,l)),t}function S(e,t,n){let i,r,s,o=!0;for(r=0,s=e.length;r=0;){const i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t>>0));switch(n=n.toLowerCase(),n){case"tga":t=Xe;break;default:t=qe}return t}(s);if(void 0!==t){const r=t.load(s),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===c(o.technique)){const e=o.technique;r.wrapS=e.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,r.wrapT=e.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping;return null!==n&&(r.encoding=n),r}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",s),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}s.name=e.name||"";const a=r.parameters;for(const e in a){const t=a[e];switch(e){case"diffuse":t.color&&s.color.fromArray(t.color),t.texture&&(s.map=o(t.texture,i.sRGBEncoding));break;case"specular":t.color&&s.specular&&s.specular.fromArray(t.color),t.texture&&(s.specularMap=o(t.texture));break;case"bump":t.texture&&(s.normalMap=o(t.texture));break;case"ambient":t.texture&&(s.lightMap=o(t.texture,i.sRGBEncoding));break;case"shininess":t.float&&s.shininess&&(s.shininess=t.float);break;case"emission":t.color&&s.emissive&&s.emissive.fromArray(t.color),t.texture&&(s.emissiveMap=o(t.texture,i.sRGBEncoding))}}s.color.convertSRGBToLinear(),s.specular&&s.specular.convertSRGBToLinear(),s.emissive&&s.emissive.convertSRGBToLinear();let l=a.transparent,h=a.transparency;if(void 0===h&&l&&(h={float:1}),void 0===l&&h&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&h)if(l.data.texture)s.transparent=!0;else{const e=l.data.color;switch(l.opaque){case"A_ONE":s.opacity=e[3]*h.float;break;case"RGB_ZERO":s.opacity=1-e[0]*h.float;break;case"A_ZERO":s.opacity=1-e[3]*h.float;break;case"RGB_ONE":s.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}s.opacity<1&&(s.transparent=!0)}if(void 0!==r.extra&&void 0!==r.extra.technique){const e=r.extra.technique;for(const t in e){const n=e[t];switch(t){case"double_sided":s.side=1===n?i.DoubleSide:i.FrontSide;break;case"bump":s.normalMap=o(n.texture),s.normalScale=new i.Vector2(1,1)}}}return s}function K(e){return f(Qe.materials[e],Z)}function Q(e){for(let t=0;t0?n+s:n;t.inputs[o]={id:e,offset:r},t.stride=Math.max(t.stride,r+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=a(i.textContent);break;case"p":t.p=a(i.textContent)}}return t}function he(e){let t=0;for(let n=0,i=e.length;n0&&t0&&d.setAttribute("position",new i.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),a.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),h.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(h,4)),u.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(u,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function pe(e,t,n,i,r=!1){const s=e.p,o=e.stride,a=e.vcount;function l(e){let t=s[e+n]*h;const o=t+h;for(;t4)for(let t=1,i=n-2;t<=i;t++){const n=e+o*t,i=e+o*(t+1);l(e+0*o),l(n),l(i)}e+=o*n}}else for(let e=0,t=s.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;nr.limits.max||t{"use strict";n.d(t,{v:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===this.path?i.LoaderUtils.extractUrlBase(e):this.path,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,o={};for(let e=0;e=0?t.substring(0,s):t;a=a.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},o[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const a=new s(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class s{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:i.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:i.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const i=e[n],r={};t[n]=r;for(const e in i){let t=!0,n=i[e];const s=e.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(r[s]=n)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(e,n){if(r[e])return;const s=t.getTextureParams(n,r),o=t.loadTexture((a=t.baseUrl,"string"!=typeof(l=s.url)||""===l?"":/^https?:\/\//i.test(l)?l:a+l));var a,l;o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(o.encoding=i.sRGBEncoding),r[e]=o}for(const e in n){const t=n[e];let o;if(""!==t)switch(e.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ks":r.specular=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ke":r.emissive=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"map_kd":s("map",t);break;case"map_ks":s("specularMap",t);break;case"map_ke":s("emissiveMap",t);break;case"norm":s("normalMap",t);break;case"map_bump":case"bump":s("bumpMap",t);break;case"map_d":s("alphaMap",t),r.transparent=!0;break;case"ns":r.shininess=parseFloat(t);break;case"d":o=parseFloat(t),o<1&&(r.opacity=o,r.transparent=!0);break;case"tr":o=parseFloat(t),this.options&&this.options.invertTrProperty&&(o=1-o),o>0&&(r.opacity=1-o,r.transparent=!0)}}return this.materials[e]=new i.MeshPhongMaterial(r),this.materials[e]}getTextureParams(e,t){const n={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const o=void 0!==this.manager?this.manager:i.DefaultLoadingManager;let a=o.getHandler(e);null===a&&(a=new i.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(e,n,r,s);return void 0!==t&&(l.mapping=t),l}}},476:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new i.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(s.parse(n))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e){function t(e,t,n){for(let i=0,r=e.length;i>5&31)/31,o=(e>>10&31)/31):(r=l,s=c,o=h)}for(let l=1;l<=3;l++){const c=n+12*l,h=3*e*3+3*(l-1);f[h]=t.getFloat32(c,!0),f[h+1]=t.getFloat32(c+4,!0),f[h+2]=t.getFloat32(c+8,!0),m[h]=i,m[h+1]=u,m[h+2]=p,d&&(a[h]=r,a[h+1]=s,a[h+2]=o)}}return p.setAttribute("position",new i.BufferAttribute(f,3)),p.setAttribute("normal",new i.BufferAttribute(m,3)),d&&(p.setAttribute("color",new i.BufferAttribute(a,3)),p.hasColors=!0,p.alpha=u),p}(n):function(e){const t=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g;let s=0;const o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),l=new RegExp("normal"+o+o+o,"g"),c=[],h=[],u=new i.Vector3;let d,p=0,f=0,m=0;for(;null!==(d=n.exec(e));){f=m;const e=d[0];for(;null!==(d=r.exec(e));){let e=0,t=0;const n=d[0];for(;null!==(d=l.exec(n));)u.x=parseFloat(d[1]),u.y=parseFloat(d[2]),u.z=parseFloat(d[3]),t++;for(;null!==(d=a.exec(n));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),h.push(u.x,u.y,u.z),e++,m++;1!==t&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==e&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}const n=f,i=m-f;t.addGroup(n,i,p),p++}return t.setAttribute("position",new i.Float32BufferAttribute(c,3)),t.setAttribute("normal",new i.Float32BufferAttribute(h,3)),t}("string"!=typeof(r=e)?i.LoaderUtils.decodeText(new Uint8Array(r)):r);var r}}},140:(e,t,n)=>{"use strict";n.d(t,{qf:()=>r});var i=n(477);function r(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),o=new Set(Object.keys(e[0].morphAttributes)),a={},l={},c=e[0].morphTargetsRelative,h=new i.BufferGeometry;let u=0;for(let i=0;i{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Viewer:()=>Viewer,THREE:()=>three__WEBPACK_IMPORTED_MODULE_3__,msgpack:()=>msgpack});var three__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(140),wwobjloader2__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(973),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(976),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(23),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(476),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(365),msgpack=__webpack_require__(676),dat=__webpack_require__(376).ZP;__webpack_require__(583);const extensionCodec=new msgpack.ExtensionCodec;function merge_geometries(e,t=!1){let n=[],i=[],r=e.matrix.clone();!function e(t,r){let s=r.clone().multiply(t.matrix);"Mesh"===t.type&&(t.geometry.applyMatrix4(s),i.push(t.geometry),n.push(t.material));for(let n of t.children)e(n,s)}(e,r);let s=null;return 1==i.length?(s=i[0],t&&(s.material=n[0])):i.length>1?(s=(0,three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__.qf)(i,!0),t&&(s.material=n)):s=new three__WEBPACK_IMPORTED_MODULE_3__.BufferGeometry,s}function handle_special_texture(e){if("_text"==e.type){let t=document.createElement("canvas");t.width=256,t.height=256;let n=t.getContext("2d");n.textAlign="center";let i=e.font_size;for(n.font=i+"px "+e.font_face;n.measureText(e.text).width>t.width;)i--,n.font=i+"px "+e.font_face;n.fillText(e.text,t.width/2,t.height/2);let r=new three__WEBPACK_IMPORTED_MODULE_3__.CanvasTexture(t);return r.uuid=e.uuid,r}return null}function handle_special_geometry(e){if("_meshfile"==e.type&&(console.warn("_meshfile is deprecated. Please use _meshfile_geometry for geometries and _meshfile_object for objects with geometry and material"),e.type="_meshfile_geometry"),"_meshfile_geometry"==e.type){if("obj"==e.format){let t=merge_geometries((new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe).parse(e.data+"\n"));return t.uuid=e.uuid,t}if("dae"==e.format){let t=merge_geometries((new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G).parse(e.data).scene);return t.uuid=e.uuid,t}if("stl"==e.format){let t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer);return t.uuid=e.uuid,t}return console.error("Unsupported mesh type:",e),null}return null}extensionCodec.register({type:18,encode:e=>(console.error("Uint8Array encode not implemented"),null),decode:e=>{const t=new Uint8Array(e.byteLength);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Uint32Array encode not implemented"),null),decode:e=>{const t=new Uint32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Float32Array encode not implemented"),null),decode:e=>{const t=new Float32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;evoid 0!==e.resources[t]?e.resources[t]:t)),"obj"==e.format){let s=new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe(i);if(e.mtl_library){let t=new three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__.v(i).parse(e.mtl_library+"\n",""),n=wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.eW.addMaterialsFromMtlLoader(t);s.setMaterials(n),this.onTextureLoad()}t=merge_geometries(s.parse(e.data+"\n",r),!0),t.uuid=e.uuid,n=t.material}else if("dae"==e.format){let s=new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G(i);s.onTextureLoad=this.onTextureLoad,t=merge_geometries(s.parse(e.data,r).scene,!0),t.uuid=e.uuid,n=t.material}else{if("stl"!=e.format)return console.error("Unsupported mesh type:",e),null;t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer,r),t.uuid=e.uuid,n=t.material}let s=new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(t,n);return s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userjson&&(s.userjson=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),s}return super.parseObject(e,t,n)}}class SceneNode{constructor(e,t,n){this.object=e,this.folder=t,this.children={},this.controllers=[],this.on_update=n,this.create_controls();for(let e of this.object.children)this.add_child(e)}add_child(e){let t=this.folder.addFolder(e.name),n=new SceneNode(e,t,this.on_update);return this.children[e.name]=n,n}create_child(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Group;return t.name=e,this.object.add(t),this.add_child(t)}find(e){if(0==e.length)return this;{let t=e[0],n=this.children[t];return void 0===n&&(n=this.create_child(t)),n.find(e.slice(1))}}create_controls(){for(let e of this.controllers)this.folder.remove(e);if(this.controllers=[],void 0!==this.vis_controller&&this.folder.domElement.removeChild(this.vis_controller.domElement),this.vis_controller=new dat.controllers.BooleanController(this.object,"visible"),this.vis_controller.onChange((()=>this.on_update())),this.folder.domElement.prepend(this.vis_controller.domElement),this.vis_controller.domElement.style.height="0",this.vis_controller.domElement.style.float="right",this.vis_controller.domElement.classList.add("meshcat-visibility-checkbox"),this.vis_controller.domElement.children[0].addEventListener("change",(e=>{e.target.checked?this.folder.domElement.classList.remove("meshcat-hidden-scene-element"):this.folder.domElement.classList.add("meshcat-hidden-scene-element")})),this.object.isLight){let e=this.folder.add(this.object,"intensity").min(0).step(.01);if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.castShadow){let e=this.folder.add(this.object,"castShadow");if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.shadow){let e=this.folder.add(this.object.shadow,"radius").min(0).step(.05).max(3);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(void 0!==this.object.distance){let e=this.folder.add(this.object,"distance").min(0).step(.1).max(100);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(this.object.isCamera){let e=this.folder.add(this.object,"zoom").min(0).step(.1);e.onChange((()=>{this.on_update()})),this.controllers.push(e)}}set_property(e,t){if("position"===e)this.object.position.set(t[0],t[1],t[2]);else if("quaternion"===e)this.object.quaternion.set(t[0],t[1],t[2],t[3]);else if("scale"===e)this.object.scale.set(t[0],t[1],t[2]);else if("color"===e){function e(t,n){if(t.material){t.material.color.setRGB(n[0],n[1],n[2]);let e=n[3];t.material.opacity=e,t.material.transparent=1!=e}for(let i of t.children)e(i,n)}e(this.object,t)}else this.object[e]="top_color"==e||"bottom_color"==e?t.map((e=>255*e)):t;this.vis_controller.updateDisplay(),this.controllers.forEach((e=>e.updateDisplay()))}set_transform(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;t.fromArray(e),t.decompose(this.object.position,this.object.quaternion,this.object.scale)}set_object(e){let t=this.object.parent;this.dispose_recursive(),this.object.parent.remove(this.object),this.object=e,t.add(e),this.create_controls()}dispose_recursive(){for(let e of Object.keys(this.children))this.children[e].dispose_recursive();dispose(this.object)}delete(e){if(0==e.length)console.error("Can't delete an empty path");else{let t=this.find(e.slice(0,e.length-1)),n=e[e.length-1],i=t.children[n];void 0!==i&&(i.dispose_recursive(),t.object.remove(i.object),remove_folders(i.folder),t.folder.removeFolder(i.folder),delete t.children[n])}}}function remove_folders(e){for(let t of Object.keys(e.__folders)){let n=e.__folders[t];remove_folders(n),dat.dom.dom.unbind(window,"resize",n.__resizeHandler),e.removeFolder(n)}}function dispose(e){if(e&&(e.geometry&&e.geometry.dispose(),e.material))if(Array.isArray(e.material))for(let t of e.material)t.map&&t.map.dispose(),t.dispose();else e.material.map&&e.material.map.dispose(),e.material.dispose()}function create_default_scene(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.Scene;return e.name="Scene",e.rotateX(-Math.PI/2),e}function download_data_uri(e,t){let n=document.createElement("a");n.download=e,n.href=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function download_file(e,t,n){n=n||"text/plain";let i=new Blob([t],{type:n}),r=document.createElement("a");document.body.appendChild(r),r.download=e,r.href=window.URL.createObjectURL(i),r.onclick=function(e){let t=this;setTimeout((function(){window.URL.revokeObjectURL(t.href)}),1500)},r.click(),r.remove()}class Animator{constructor(e){this.viewer=e,this.folder=this.viewer.gui.addFolder("Animations"),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer,this.loader=new three__WEBPACK_IMPORTED_MODULE_3__.ObjectLoader,this.clock=new three__WEBPACK_IMPORTED_MODULE_3__.Clock,this.actions=[],this.playing=!1,this.time=0,this.time_scrubber=null,this.setup_capturer("png"),this.duration=0}setup_capturer(e){this.capturer=new window.CCapture({format:e,name:"meshcat_"+String(Date.now())}),this.capturer.format=e}play(){this.clock.start();for(let e of this.actions)e.play();this.playing=!0}record(){this.reset(),this.play(),this.recording=!0,this.capturer.start()}pause(){this.clock.stop(),this.playing=!1,this.recording&&(this.stop_capture(),this.save_capture())}stop_capture(){this.recording=!1,this.capturer.stop(),this.viewer.animate()}save_capture(){this.capturer.save(),"png"===this.capturer.format?alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.png \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4"):"jpg"===this.capturer.format&&alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.jpg \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4")}display_progress(e){this.time=e,null!==this.time_scrubber&&this.time_scrubber.updateDisplay()}seek(e){this.actions.forEach((t=>{t.time=Math.max(0,Math.min(t._clip.duration,e))})),this.mixer.update(0),this.viewer.set_dirty()}reset(){for(let e of this.actions)e.reset();this.display_progress(0),this.mixer.update(0),this.setup_capturer(this.capturer.format),this.viewer.set_dirty()}clear(){remove_folders(this.folder),this.mixer.stopAllAction(),this.actions=[],this.duration=0,this.display_progress(0),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer}load(e,t){this.clear(),this.folder.open();let n=this.folder.addFolder("default");n.open(),n.add(this,"play"),n.add(this,"pause"),n.add(this,"reset"),this.time_scrubber=n.add(this,"time",0,1e9,.001),this.time_scrubber.onChange((e=>this.seek(e))),n.add(this.mixer,"timeScale").step(.01).min(0);let i=n.addFolder("Recording");i.add(this,"record"),i.add({format:"png"},"format",["png","jpg"]).onChange((e=>{this.setup_capturer(e)})),void 0===t.play&&(t.play=!0),void 0===t.loopMode&&(t.loopMode=three__WEBPACK_IMPORTED_MODULE_3__.LoopRepeat),void 0===t.repetitions&&(t.repetitions=1),void 0===t.clampWhenFinished&&(t.clampWhenFinished=!0),this.duration=0,this.progress=0;for(let n of e){let e=this.viewer.scene_tree.find(n.path).object,i=three__WEBPACK_IMPORTED_MODULE_3__.AnimationClip.parse(n.clip);i.uuid=three__WEBPACK_IMPORTED_MODULE_3__.MathUtils.generateUUID();let r=this.mixer.clipAction(i,e);r.clampWhenFinished=t.clampWhenFinished,r.setLoop(t.loopMode,t.repetitions),this.actions.push(r),this.duration=Math.max(this.duration,i.duration)}this.time_scrubber.min(0),this.time_scrubber.max(this.duration),this.reset(),t.play&&this.play()}update(){if(this.playing){if(this.mixer.update(this.clock.getDelta()),this.viewer.set_dirty(),0!=this.duration){let e=this.actions.reduce(((e,t)=>Math.max(e,t.time)),0);this.display_progress(e)}else this.display_progress(0);if(this.actions.every((e=>e.paused))){this.pause();for(let e of this.actions)e.reset()}}}after_render(){this.recording&&this.capturer.capture(this.viewer.renderer.domElement)}}function gradient_texture(e,t){var n=new Uint8Array(8);for(let i=0;i<3;++i)n[i]=t[i],n[4+i]=e[i];n[3]=n[7]=255;var i=new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(n,1,2,three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);return i.magFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,i.encoding=three__WEBPACK_IMPORTED_MODULE_3__.LinearEncoding,i.matrixAutoUpdate=!1,i.matrix.set(.5,0,.25,0,.5,.25,0,0,1),i.needsUpdate=!0,i}class Viewer{constructor(e,t,n){this.dom_element=e,void 0===n?(this.renderer=new three__WEBPACK_IMPORTED_MODULE_3__.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=three__WEBPACK_IMPORTED_MODULE_3__.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.renderer.setPixelRatio(window.devicePixelRatio),this.scene=create_default_scene(),this.gui_controllers={},this.keydown_callbacks={},this.create_scene_tree(),this.add_default_scene_elements(),this.set_dirty(),this.create_camera(),this.num_messages_received=0,window.onload=e=>this.set_3d_pane_size(),window.addEventListener("resize",(e=>this.set_3d_pane_size()),!1),window.addEventListener("keydown",(e=>{this.on_keydown(e)})),requestAnimationFrame((()=>this.set_3d_pane_size())),(t||void 0===t)&&this.animate()}on_keydown(e){if(e.code in this.keydown_callbacks)for(const t of this.keydown_callbacks[e.code])t.callback(e)}hide_background(){this.scene.background=null,this.set_dirty()}show_background(){var e=this.scene_tree.find(["Background"]).object.top_color,t=this.scene_tree.find(["Background"]).object.bottom_color;this.scene.background=gradient_texture(e,t),this.set_dirty()}set_dirty(){this.needs_render=!0}create_camera(){let e=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;e.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],e.toArray());let t=new three__WEBPACK_IMPORTED_MODULE_3__.PerspectiveCamera(75,1,.01,100);this.set_camera(t),this.set_object(["Cameras","default","rotated"],t),t.position.set(3,1,0)}create_default_spot_light(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.SpotLight(16777215,.8);return e.position.set(1.5,1.5,2),e.castShadow=!1,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024,e.shadow.camera.near=.5,e.shadow.camera.far=50,e.shadow.bias=-.001,e}add_default_scene_elements(){var e=this.create_default_spot_light();this.set_object(["Lights","SpotLight"],e),this.set_property(["Lights","SpotLight"],"visible",!1);var t=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);t.position.set(1.5,1.5,2),t.castShadow=!1,t.distance=10,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,t.shadow.camera.near=.5,t.shadow.camera.far=10,t.shadow.bias=-.001,this.set_object(["Lights","PointLightNegativeX"],t);var n=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);n.position.set(-1.5,-1.5,2),n.castShadow=!1,n.distance=10,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,n.shadow.camera.near=.5,n.shadow.camera.far=10,n.shadow.bias=-.001,this.set_object(["Lights","PointLightPositiveX"],n);var i=new three__WEBPACK_IMPORTED_MODULE_3__.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new three__WEBPACK_IMPORTED_MODULE_3__.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var s=new three__WEBPACK_IMPORTED_MODULE_3__.GridHelper(20,40);s.rotateX(Math.PI/2),this.set_object(["Grid"],s);var o=new three__WEBPACK_IMPORTED_MODULE_3__.AxesHelper(.5);this.set_object(["Axes"],o)}create_scene_tree(){this.gui&&this.gui.destroy(),this.gui=new dat.GUI({autoPlace:!1}),this.dom_element.parentElement.appendChild(this.gui.domElement),this.gui.domElement.style.position="absolute",this.gui.domElement.style.right=0,this.gui.domElement.style.top=0;let e=this.gui.addFolder("Scene");e.open(),this.scene_tree=new SceneNode(this.scene,e,(()=>this.set_dirty()));let t=this.gui.addFolder("Save / Load / Capture");t.add(this,"save_scene"),t.add(this,"load_scene"),t.add(this,"save_image"),this.animator=new Animator(this),this.gui.close(),this.set_property(["Background"],"top_color",[135/255,206/255,250/255]),this.set_property(["Background"],"bottom_color",[25/255,25/255,112/255]),this.scene_tree.find(["Background"]).on_update=()=>{this.scene_tree.find(["Background"]).object.visible?this.show_background():this.hide_background()},this.show_background()}set_3d_pane_size(e,t){void 0===e&&(e=this.dom_element.offsetWidth),void 0===t&&(t=this.dom_element.offsetHeight),"OrthographicCamera"==this.camera.type?this.camera.right=this.camera.left+e*(this.camera.top-this.camera.bottom)/t:this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.set_dirty()}render(){this.controls.update(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.animator.after_render(),this.needs_render=!1}animate(){requestAnimationFrame((()=>this.animate())),this.animator.update(),this.needs_render&&this.render()}capture_image(e,t){let n=this.dom_element.offsetWidth,i=this.dom_element.offsetHeight;this.set_3d_pane_size(e,t),this.render();let r=this.renderer.domElement.toDataURL();return this.set_3d_pane_size(n,i),r}save_image(){download_data_uri("meshcat.png",this.capture_image())}set_camera(e){this.camera=e,this.controls=new three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__.z(e,this.dom_element),this.controls.enableKeys=!1,this.controls.screenSpacePanning=!0,this.controls.addEventListener("start",(()=>{this.set_dirty()})),this.controls.addEventListener("change",(()=>{this.set_dirty()}))}set_camera_target(e){this.controls.target.set(e[0],e[1],e[2])}set_camera_from_json(e){(new ExtensibleObjectLoader).parse(e,(e=>{this.set_camera(e)}))}set_transform(e,t){this.scene_tree.find(e).set_transform(t)}set_object(e,t){this.scene_tree.find(e.concat([""])).set_object(t)}set_object_from_json(e,t){let n=new ExtensibleObjectLoader;n.onTextureLoad=()=>{this.set_dirty()},n.parse(t,(t=>{void 0!==t.geometry&&"BufferGeometry"==t.geometry.type?void 0!==t.geometry.attributes.normal&&0!==t.geometry.attributes.normal.count||t.geometry.computeVertexNormals():t.type.includes("Camera")&&(this.set_camera(t),this.set_3d_pane_size()),t.castShadow=!0,t.receiveShadow=!0,this.set_object(e,t),this.set_dirty()}))}delete_path(e){0==e.length?console.error("Deleting the entire scene is not implemented"):this.scene_tree.delete(e)}set_property(e,t,n){this.scene_tree.find(e).set_property(t,n),"Background"===e[0]&&this.scene_tree.find(e).on_update()}set_animation(e,t){t=t||{},this.animator.load(e,t)}set_control(name,callback,value,min,max,step,keycode1,keycode2){let my_callback=eval(callback),handler={};if(name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value){function e(e,t,n){if(null!=t){let i={name,callback:()=>{value=e.gui_controllers[name].getValue();let t=Math.min(Math.max(value+n,min),max);e.gui_controllers[name].setValue(t)}};t in e.keydown_callbacks?e.keydown_callbacks[t].push(i):e.keydown_callbacks[t]=[i]}}handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(my_callback),e(this,keycode1,-step),e(this,keycode2,+step)}else if(handler[name]=my_callback,this.gui_controllers[name]=this.gui.add(handler,name),this.gui_controllers[name].domElement.parentElement.querySelector(".property-name").style.width="100%",null!=keycode1){let e={name,callback:my_callback};keycode1 in this.keydown_callbacks?this.keydown_callbacks[keycode1].push(e):this.keydown_callbacks[keycode1]=[e]}}set_control_value(e,t,n=!0){e in this.gui_controllers&&this.gui_controllers[e]instanceof dat.controllers.NumberController&&(n?this.gui_controllers[e].setValue(t):(this.gui_controllers[e].object[e]=t,this.gui_controllers[e].updateDisplay()))}delete_control(e){e in this.gui_controllers&&(this.gui.remove(this.gui_controllers[e]),delete this.gui_controllers[e]);for(let t in this.keydown_callbacks){let n=this.keydown_callbacks[t].length;for(;n--;)this.keydown_callbacks[t][n].name==e&&this.keydown_callbacks[t].splice(n,1)}}handle_command(e){if("set_transform"==e.type){let t=split_path(e.path);this.set_transform(t,e.matrix)}else if("delete"==e.type){let t=split_path(e.path);this.delete_path(t)}else if("set_object"==e.type){let t=split_path(e.path);this.set_object_from_json(t,e.object)}else if("set_property"==e.type){let t=split_path(e.path);this.set_property(t,e.property,e.value)}else if("set_animation"==e.type)e.animations.forEach((e=>{e.path=split_path(e.path)})),this.set_animation(e.animations,e.options);else if("set_target"==e.type)this.set_camera_target(e.value);else if("set_control"==e.type)this.set_control(e.name,e.callback,e.value,e.min,e.max,e.step,e.keycode1,e.keycode2);else if("set_control_value"==e.type)this.set_control_value(e.name,e.value,e.invoke_callback);else if("delete_control"==e.type)this.delete_control(e.name);else if("capture_image"==e.type){let t=e.xres||1920,n=e.yres||1080;t/=this.renderer.getPixelRatio(),n/=this.renderer.getPixelRatio();let i=this.capture_image(t,n);this.connection.send(JSON.stringify({type:"img",data:i}))}else"save_image"==e.type&&this.save_image();this.set_dirty()}decode(e){return msgpack.decode(new Uint8Array(e.data),{extensionCodec})}handle_command_bytearray(e){let t=msgpack.decode(e,{extensionCodec});this.handle_command(t)}handle_command_message(e){this.num_messages_received++;let t=this.decode(e);this.handle_command(t)}connect(e){void 0===e&&(e=`ws://${location.host}`),"https:"==location.protocol&&(e=e.replace("ws:","wss:")),this.connection=new WebSocket(e),this.connection.binaryType="arraybuffer",this.connection.onmessage=e=>this.handle_command_message(e),this.connection.onclose=function(e){console.log("onclose:",e)}}save_scene(){download_file("scene.json",JSON.stringify(this.scene.toJSON()))}load_scene_from_json(e){let t=new ExtensibleObjectLoader;t.onTextureLoad=()=>{this.set_dirty()},this.scene_tree.dispose_recursive(),this.scene=t.parse(e),this.show_background(),this.create_scene_tree();let n=this.scene_tree.find(["Cameras","default","rotated",""]);n.object.isCamera?this.set_camera(n.object):this.create_camera()}handle_load_file(e){let t=e.files[0];if(!t)return;let n=new FileReader,i=this;n.onload=function(e){let t=this.result,n=JSON.parse(t);i.load_scene_from_json(n)},n.readAsText(t)}load_scene(){let e=document.createElement("input");e.type="file",document.body.appendChild(e);let t=this;e.addEventListener("change",(function(){console.log(this,t),t.handle_load_file(this)}),!1),e.click(),e.remove()}}function split_path(e){return e.split("/").filter((e=>e.length>0))}let style=document.createElement("style");style.appendChild(document.createTextNode("")),document.head.appendChild(style),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input {\n float: right;\n }"),style.sheet.insertRule("\n .meshcat-hidden-scene-element li .meshcat-visibility-checkbox {\n opacity: 0.25;\n pointer-events: none;\n }"),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input[type=checkbox] {\n height: 16px;\n width: 16px;\n display:inline-block;\n padding: 0 0 0 0px;\n }")})(),__webpack_exports__})()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MeshCat=t():e.MeshCat=t()}(self,(function(){return(()=>{var __webpack_modules__={583:(e,t,n)=>{var i;e=n.nmd(e),function(){if(void 0!==e.exports)var r=n(617),s=n(549),o=n(468);var a={function:!0,object:!0};function l(e){return e&&e.Object===Object?e:null}parseFloat,parseInt;var c=a[typeof t]&&t&&!t.nodeType?t:void 0,h=a.object&&e&&!e.nodeType?e:void 0,u=(h&&h.exports,l(c&&h&&"object"==typeof n.g&&n.g)),d=l(a[typeof self]&&self),p=l(a[typeof window]&&window),f=l(a[typeof this]&&this);function m(e){return String("0000000"+e).slice(-7)}u||p!==(f&&f.window)&&p||d||f||Function("return this")(),"gc"in window||(window.gc=function(){}),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),r=i.length,s=new Uint8Array(r),o=0;o=c.frameLimit||c.timeLimit&&e>=c.timeLimit)&&(H(),W());var t=new Date(null);t.setSeconds(e),c.motionBlurFrames>2?_.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+t.toISOString().substr(11,8):_.textContent="CCapture "+c.format+" | "+d+" frames | "+t.toISOString().substr(11,8)}(),j("Frame: "+d+" "+p);for(var s=0;s=h[s].triggerTime&&(G(h[s].callback),h.splice(s,1));for(s=0;s=u[s].triggerTime&&(G(u[s].callback),u[s].triggerTime+=u[s].time);f.forEach((function(e){G(e,n-g)})),f=[]}function W(e){e||(e=function(e){return s(e,l.filename+l.extension,l.mimeType),!1}),l.save(e)}function j(e){t&&console.log(e)}return{start:function(){!function(){function e(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),z.push(this)),this._hookedTime+c.startTime}j("Capturer start"),i=window.Date.now(),n=i+c.startTime,o=window.performance.now(),r=o+c.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(e,t){var i={callback:e,time:t,triggerTime:n+t};return h.push(i),j("Timeout set to "+i.time),i},window.clearTimeout=function(e){for(var t=0;t2?(function(e){A.width===e.width&&A.height===e.height||(A.width=e.width,A.height=e.height,E=new Uint16Array(A.height*A.width*4),C.fillStyle="#0",C.fillRect(0,0,A.width,A.height))}(e),function(e){C.drawImage(e,0,0),T=C.getImageData(0,0,A.width,A.height);for(var t=0;t=.5*c.motionBlurFrames?function(){for(var e=T.data,t=0;t0&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(e){this.filename=this.baseFilename+"-part-"+m(this.part),s(e,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+m(this.part),this.step()}.bind(this)):this.step()},b.prototype.save=function(e){this.videoWriter.complete().then(e)},b.prototype.dispose=function(e){this.frames=[]},w.prototype=Object.create(y.prototype),w.prototype.start=function(){this.encoder.start(this.settings)},w.prototype.add=function(e){this.encoder.add(e)},w.prototype.save=function(e){this.callback=e,this.encoder.end()},w.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},M.prototype=Object.create(y.prototype),M.prototype.add=function(e){this.stream||(this.stream=e.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(e){this.chunks.push(e.data)}.bind(this)),this.step()},M.prototype.save=function(e){this.mediaRecorder.onstop=function(t){var n=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],e(n)}.bind(this),this.mediaRecorder.stop()},S.prototype=Object.create(y.prototype),S.prototype.add=function(e){this.sizeSet||(this.encoder.setOption("width",e.width),this.encoder.setOption("height",e.height),this.sizeSet=!0),this.canvas.width=e.width,this.canvas.height=e.height,this.ctx.drawImage(e,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},S.prototype.save=function(e){this.callback=e,this.encoder.render()},(p||d||{}).CCapture=E,void 0===(i=function(){return E}.call(t,n,t,e))||(e.exports=i)}()},549:e=>{void 0!==e.exports&&(e.exports=function(e,t,n){var i,r,s,o=window,a="application/octet-stream",l=n||a,c=e,h=document,u=h.createElement("a"),d=function(e){return String(e)},p=o.Blob||o.MozBlob||o.WebKitBlob||d,f=o.MSBlobBuilder||o.WebKitBlobBuilder||o.BlobBuilder,m=t||"download";if("true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(e){for(var t=e.split(/[:;,]/),n=t[1],i=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=i.length,s=0,o=new Uint8Array(r);s{e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=void 0,o=0;o0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,o,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){var i=e("./TypedNeuQuant.js"),r=e("./LZWEncoder.js");function s(){this.page=-1,this.pages=[],this.newPage()}s.pageSize=4096,s.charMap={};for(var o=0;o<256;o++)s.charMap[o]=String.fromCharCode(o);function a(e,t){this.width=~~e,this.height=~~t,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new s}s.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(s.pageSize),this.cursor=0},s.prototype.getData=function(){for(var e="",t=0;t=s.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=e},s.prototype.writeUTFBytes=function(e){for(var t=e.length,n=0;n=0&&(this.dispose=e)},a.prototype.setRepeat=function(e){this.repeat=e},a.prototype.setTransparent=function(e){this.transparent=e},a.prototype.addFrame=function(e){this.image=e,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},a.prototype.finish=function(){this.out.writeByte(59)},a.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},a.prototype.setDither=function(e){!0===e&&(e="FloydSteinberg"),this.dither=e},a.prototype.setGlobalPalette=function(e){this.globalPalette=e},a.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},a.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},a.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new i(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},a.prototype.indexPixels=function(e){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var n=0,i=0;i=0&&b+h=0&&w+c>16,(65280&e)>>8,255&e,t)},a.prototype.findClosestRGB=function(e,t,n,i){if(null===this.colorTab)return-1;if(this.neuQuant&&!i)return this.neuQuant.lookupRGB(e,t,n);for(var r=0,s=16777216,o=this.colorTab.length,a=0,l=0;a=0&&(t=7&this.dispose),t<<=2,this.out.writeByte(0|t|e),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},a.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},a.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},a.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},a.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},a.prototype.writePixels=function(){new r(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},a.prototype.stream=function(){return this.out},t.exports=a},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(e,t,n){var i=5003,r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var o,a,l,c,h,u,d=Math.max(2,s),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,y=0,_=!1;function v(e,t){p[a++]=e,a>=254&&w(t)}function x(e){b(i),y=h+2,_=!0,E(h,e)}function b(e){for(var t=0;t0&&(e.writeByte(a),e.writeBytes(p,0,a),a=0)}function M(e){return(1<0?o|=e<=8;)v(255&o,t),o>>=8,g-=8;if((y>l||_)&&(_?(l=M(n_bits=c),_=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),e==u){for(;g>0;)v(255&o,t),o>>=8,g-=8;w(t)}}this.encode=function(n){n.writeByte(d),remaining=e*t,curPixel=0,function(e,t){var n,r,s,o,d,p;for(c=e,_=!1,n_bits=c,l=M(n_bits),u=1+(h=1<=0){d=5003-s,0===s&&(d=1);do{if((s-=d)<0&&(s+=5003),f[s]===n){o=m[s];continue e}}while(f[s]>=0)}E(o,t),o=r,y<4096?(m[s]=y++,f[s]=n):x(t)}else o=m[s];E(o,t),E(u,t)}(d+1,n),n.writeByte(0)}}},{}],4:[function(e,t,n){var i=256,r=1024,s=1<<18;t.exports=function(e,t){var n,o,a,l,c;function h(e,t,i,s,o){n[t][0]-=e*(n[t][0]-i)/r,n[t][1]-=e*(n[t][1]-s)/r,n[t][2]-=e*(n[t][2]-o)/r}function u(e,t,r,o,a){for(var l,h,u=Math.abs(t-e),d=Math.min(t+e,i),p=t+1,f=t-1,m=1;pu;)h=c[m++],pu&&((l=n[f--])[0]-=h*(l[0]-r)/s,l[1]-=h*(l[1]-o)/s,l[2]-=h*(l[2]-a)/s)}function d(e,t,r){var s,o,c,h,u,d=~(1<<31),p=d,f=-1,m=f;for(s=0;s>12))>10,l[s]-=u,a[s]+=u<<10;return l[f]+=64,a[f]-=65536,m}this.buildColormap=function(){(function(){var e,t;for(n=[],o=new Int32Array(256),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),e=0;e>6;for(v<=1&&(v=0),n=0;n=p&&(x-=p),0===g&&(g=1),++n%g==0)for(y-=y/f,(v=(_-=_/30)>>6)<=1&&(v=0),l=0;l>=4,n[e][1]>>=4,n[e][2]>>=4,n[e][3]=e}(),function(){var e,t,r,s,a,l,c=0,h=0;for(e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)o[t]=255}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)u=c?u=i:(u++,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)=0&&((l=t-(a=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(s=a[0]-e)<0&&(s=-s),(l+=s)t;0<=t?++e:--e)n.push(null);return n}.call(this),t=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(e=0,n=t;0<=n?en;0<=n?++e:--e)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},i.prototype.abort=function(){for(var e;null!=(e=this.activeWorkers.shift());)this.log("killing active worker"),e.terminate();return this.running=!1,this.emit("abort")},i.prototype.spawnWorkers=function(){var e,t,n,i;return e=Math.min(this.options.workers,this.frames.length),function(){n=[];for(var i=t=this.freeWorkers.length;t<=e?ie;t<=e?i++:i--)n.push(i);return n}.apply(this).forEach((i=this,function(e){var t;return i.log("spawning worker "+e),(t=new Worker(i.options.workerScript)).onmessage=function(e){return i.activeWorkers.splice(i.activeWorkers.indexOf(t),1),i.freeWorkers.push(t),i.frameFinished(e.data)},i.freeWorkers.push(t)})),e},i.prototype.frameFinished=function(e){var t,n;if(this.log("frame "+e.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[e.index]=e,!0===this.options.globalPalette&&(this.options.globalPalette=e.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(t=1,n=this.freeWorkers.length;1<=n?tn;1<=n?++t:--t)this.renderNextFrame();return o.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m;for(a=0,r=0,l=(p=this.imageParts).length;r=this.frames.length))return e=this.frames[this.nextFrame++],n=this.freeWorkers.shift(),t=this.getTask(e),this.log("starting frame "+(t.index+1)+" of "+this.frames.length),this.activeWorkers.push(n),n.postMessage(t)},i.prototype.getContextData=function(e){return e.getImageData(0,0,this.options.width,this.options.height).data},i.prototype.getImageData=function(e){var t;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(t=this._canvas.getContext("2d")).setFill=this.options.background,t.fillRect(0,0,this.options.width,this.options.height),t.drawImage(e,0,0),this.getContextData(t)},i.prototype.getTask=function(e){var t,n;if(n={index:t=this.frames.indexOf(e),last:t===this.frames.length-1,delay:e.delay,dispose:e.dispose,transparent:e.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===r.name},null!=e.data)n.data=e.data;else if(null!=e.context)n.data=this.getContextData(e.context);else{if(null==e.image)throw new Error("Invalid frame");n.data=this.getImageData(e.image)}return n},i.prototype.log=function(){var e;if(e=1<=arguments.length?a.call(arguments,0):[],this.options.debug)return console.log.apply(console,e)},i}(i)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(e,t,n){var i,r;i=e("./GIFEncoder.js"),r=function(e){var t,n,r,s;return t=new i(e.width,e.height),0===e.index?t.writeHeader():t.firstFrame=!1,t.setTransparent(e.transparent),t.setDispose(e.dispose),t.setRepeat(e.repeat),t.setDelay(e.delay),t.setQuality(e.quality),t.setDither(e.dither),t.setGlobalPalette(e.globalPalette),t.addFrame(e.data),e.last&&t.finish(),!0===e.globalPalette&&(e.globalPalette=t.getGlobalPalette()),r=t.stream(),e.data=r.pages,e.cursor=r.cursor,e.pageSize=r.constructor.pageSize,e.canTransfer?(s=function(){var t,i,r,s;for(s=[],t=0,i=(r=e.data).length;t{!function(){"use strict";var e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];function t(e){var t,n=new Uint8Array(e);for(t=0;t>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];switch(a.length%4){case 1:a+="=";break;case 2:a+="=="}return a}}(),function(){"use strict";var e,t=window.utils;e=[{field:"fileName",length:100},{field:"fileMode",length:8},{field:"uid",length:8},{field:"gid",length:8},{field:"fileSize",length:12},{field:"mtime",length:12},{field:"checksum",length:8},{field:"type",length:1},{field:"linkName",length:100},{field:"ustar",length:8},{field:"owner",length:32},{field:"group",length:32},{field:"majorNumber",length:8},{field:"minorNumber",length:8},{field:"filenamePrefix",length:155},{field:"padding",length:12}],window.header={},window.header.structure=e,window.header.format=function(n,i){var r=t.clean(512),s=0;return e.forEach((function(e){var t,i,o=n[e.field]||"";for(t=0,i=o.length;ti&&(t.push({blocks:r,length:n}),r=[],n=0),r.push(e),n+=e.headerLength+e.inputLength})),t.push({blocks:r,length:n}),t.forEach((function(t){var n=new Uint8Array(t.length),i=0;t.blocks.forEach((function(e){n.set(e.header,i),i+=e.headerLength,n.set(e.input,i),i+=e.inputLength})),e.push(n)})),e.push(new Uint8Array(1024)),new Blob(e,{type:"octet/stream"})},s.prototype.clear=function(){this.written=0,this.out=i.clean(t)},void 0!==e.exports?e.exports=s:window.Tar=s}()},376:(e,t,n)=>{"use strict";function i(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),s=Math.round(e.b),o=e.a,a=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+s+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+s+","+o+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+s+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+s+","+o+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+",a:"+o+"}":"unknown format"}n.d(t,{ZP:()=>he});var r=Array.prototype.forEach,s=Array.prototype.slice,o={BREAK:{},extend:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(s.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=s.call(arguments);return function(){for(var t=s.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(r&&e.forEach&&e.forEach===r)e.forEach(t,n);else if(e.length===e.length+0){var i,s=void 0;for(s=0,i=e.length;s1?o.toArray(arguments):arguments[0];return o.each(a,(function(t){if(t.litmus(e))return o.each(t.conversions,(function(t,n){if(l=t.read(e),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=t,o.BREAK})),o.BREAK})),c},u=void 0,d={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),s=n*(1-t),o=n*(1-r*t),a=n*(1-(1-r)*t),l=[[n,a,s],[o,n,s],[s,n,a],[s,o,n],[a,s,n],[n,s,o]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),s=r-i,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=e===r?(t-n)/s:t===r?2+(n-e)/s:4+(e-t)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(u=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var P=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=i||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,o.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=R(r.__impliedStep),r}return y(t,e),m(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=R(e),this}}]),t}(w),D=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function h(){T.unbind(window,"mousemove",c),T.unbind(window,"mouseup",h),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"change",(function(){var e=parseFloat(s.__input.value);o.isNaN(e)||s.setValue(e)})),T.bind(r.__input,"blur",(function(){l()})),T.bind(r.__input,"mousedown",(function(e){T.bind(window,"mousemove",c),T.bind(window,"mouseup",h),a=e.clientY})),T.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P);function I(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var O=function(e){function t(e,n,i,r,s){f(this,t);var o=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:s})),a=o;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(I(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function c(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(I(t,n.left,n.right,a.__min,a.__max))}function u(){T.unbind(window,"touchmove",h),T.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),T.bind(o.__background,"mousedown",(function(e){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(e)})),T.bind(o.__background,"touchstart",(function(e){1===e.touches.length&&(T.bind(window,"touchmove",h),T.bind(window,"touchend",u),h(e))})),T.addClass(o.__background,"slider"),T.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(P),k=function(e){function t(e,n,i){f(this,t);var r=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,T.bind(r.__button,"click",(function(e){return e.preventDefault(),s.fire(),!1})),T.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return y(t,e),m(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(w),N=function(e){function t(e,n){f(this,t);var i=_(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new v(i.getValue()),i.__temp=new v(0);var r=i;i.domElement=document.createElement("div"),T.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",T.bind(i.__input,"keydown",(function(e){13===e.keyCode&&p.call(this)})),T.bind(i.__input,"blur",p),T.bind(i.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(r.__selector,"drag")}))})),T.bind(i.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(r.__selector,"drag")}))}));var s,a=document.createElement("div");function l(e){g(e),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",u),T.bind(window,"touchend",u)}function c(e){y(e),T.bind(window,"mousemove",y),T.bind(window,"touchmove",y),T.bind(window,"mouseup",d),T.bind(window,"touchend",d)}function u(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",u),T.unbind(window,"touchend",u),m()}function d(){T.unbind(window,"mousemove",y),T.unbind(window,"touchmove",y),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var e=h(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function m(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function g(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,s=n.clientY,o=(i-t.left)/(t.right-t.left),a=1-(s-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function y(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return o.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),o.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),o.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),o.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),o.extend(a.style,{width:"100%",height:"100%",background:"none"}),U(a,"top","rgba(0,0,0,0)","#000"),o.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=i.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(i.__saturation_field,"mousedown",l),T.bind(i.__saturation_field,"touchstart",l),T.bind(i.__field_knob,"mousedown",l),T.bind(i.__field_knob,"touchstart",l),T.bind(i.__hue_field,"mousedown",c),T.bind(i.__hue_field,"touchstart",c),i.__saturation_field.appendChild(a),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return y(t,e),m(t,[{key:"updateDisplay",value:function(){var e=h(this.getValue());if(!1!==e){var t=!1;o.each(v.COMPONENTS,(function(n){if(!o.isUndefined(e[n])&&!o.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&o.extend(this.__color.__state,e)}o.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;o.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,U(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),o.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(w),B=["-moz-","-o-","-webkit-","-ms-",""];function U(e,t,n,i){e.style.background="",o.each(B,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var F='
\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n
',z=function(e,t){var n=e[t];return o.isArray(arguments[2])||o.isObject(arguments[2])?new C(e,t,arguments[2]):o.isNumber(n)?o.isNumber(arguments[2])&&o.isNumber(arguments[3])?o.isNumber(arguments[4])?new O(e,t,arguments[2],arguments[3],arguments[4]):new O(e,t,arguments[2],arguments[3]):o.isNumber(arguments[4])?new D(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new D(e,t,{min:arguments[2],max:arguments[3]}):o.isString(n)?new L(e,t):o.isFunction(n)?new k(e,t,""):o.isBoolean(n)?new A(e,t):null},H=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},G=function(){function e(){f(this,e),this.backgroundElement=document.createElement("div"),o.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),o.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;T.bind(this.backgroundElement,"click",(function(){t.hide()}))}return m(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),o.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",T.unbind(e.domElement,"webkitTransitionEnd",t),T.unbind(e.domElement,"transitionend",t),T.unbind(e.domElement,"oTransitionEnd",t)};T.bind(this.domElement,"webkitTransitionEnd",t),T.bind(this.domElement,"transitionend",t),T.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if("undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var V="Default",W=function(){try{return!!window.localStorage}catch(e){return!1}}(),j=void 0,q=!0,X=void 0,J=!1,Y=[],Z=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=o.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=o.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),o.isUndefined(i.load)?i.load={preset:V}:i.preset&&(i.load.preset=i.preset),o.isUndefined(i.parent)&&i.hideable&&Y.push(this),i.resizable=o.isUndefined(i.parent)&&i.resizable,i.autoPlace&&o.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,s=W&&"true"===localStorage.getItem(ne(0,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:i,factoryArgs:[o.toArray(arguments)]})}if(o.isArray(t)||o.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),te(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof O){var i=new D(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});o.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),T.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof D){var r=function(t){if(o.isNumber(n.__min)&&o.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=te(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(i),r&&s.listen(),s}return t};n.min=o.compose(r,n.min),n.max=o.compose(r,n.max)}else n instanceof A?(T.bind(t,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof k?(T.bind(t,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(t,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(t,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof N&&(T.addClass(t,"color"),n.updateDisplay=o.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=o.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&$(e.getRoot(),!0),t}),n.setValue)}(e,c,r),e.__controllers.push(r),r}function ne(e,t){return document.location.href+"."+t}function ie(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function re(e,t){t.style.display=e.useLocalStorage?"block":"none"}function se(e){var t=e.__save_row=document.createElement("li");T.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),T.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",T.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",T.addClass(i,"button"),T.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",T.addClass(r,"button"),T.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",T.addClass(s,"button"),T.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?o.each(e.load.remembered,(function(t,n){ie(e,n,n===e.preset)})):ie(e,V,!1),T.bind(a,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=le(this)),e.folders={},o.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=le(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=le(this,!0)),this.load.remembered[e]=le(this),this.preset=e,ie(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){o.each(this.__controllers,(function(t){this.getRoot().load.remembered?ee(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),o.each(this.__folders,(function(e){e.revert(e)})),e||$(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&ce(this.__listening)},updateDisplay:function(){o.each(this.__controllers,(function(e){e.updateDisplay()})),o.each(this.__folders,(function(e){e.updateDisplay()}))}});const he={color:{Color:v,math:d,interpret:h},controllers:{Controller:w,BooleanController:A,OptionController:C,StringController:L,NumberController:P,NumberControllerBox:D,NumberControllerSlider:O,FunctionController:k,ColorController:N},dom:{dom:T},gui:{GUI:Z},GUI:Z}},973:(e,t,n)=>{"use strict";n.d(t,{eW:()=>S,oe:()=>x});var i=n(477);class r{static addMaterial(e,t,n,i,r){let s;t.name=n,i?(e[n]=t,r&&console.info('Material with name "'+n+'" was forcefully overridden.')):(s=e[n],s?s.uuid!=s.uuid&&r&&console.log('Same material name "'+s.name+'" different uuid ['+s.uuid+"|"+t.uuid+"]"):(e[n]=t,r&&console.info('Material with name "'+n+'" was added.')))}static getMaterialsJSON(e){const t={};let n;for(const i in e)n=e[i],"function"==typeof n.toJSON&&(t[i]=n.toJSON());return t}static cloneMaterial(e,t,n){let i;if(t){let s=t.materialNameOrg;s=null!=s?s:"";const o=e[s];o?(i=o.clone(),Object.assign(i,t.materialProperties),r.addMaterial(e,i,t.materialProperties.name,!0)):n&&console.info('Requested material "'+s+'" is not available!')}return i}}class s{static buildThreeConst(){return"const EventDispatcher = THREE.EventDispatcher;\nconst BufferGeometry = THREE.BufferGeometry;\nconst BufferAttribute = THREE.BufferAttribute;\nconst Box3 = THREE.Box3;\nconst Sphere = THREE.Sphere;\nconst Texture = THREE.Texture;\nconst MaterialLoader = THREE.MaterialLoader;\n"}static buildUglifiedThreeMapping(){return s.buildUglifiedNameAssignment((function(){return i.BufferGeometry}),"BufferGeometry",/_BufferGeometry/,!1)+s.buildUglifiedNameAssignment((function(){return i.BufferAttribute}),"BufferAttribute",/_BufferAttribute/,!1)+s.buildUglifiedNameAssignment((function(){return i.Box3}),"Box3",/_Box3/,!1)+s.buildUglifiedNameAssignment((function(){return i.Sphere}),"Sphere",/_Sphere/,!1)+s.buildUglifiedNameAssignment((function(){return i.Texture}),"Texture",/_Texture/,!1)+s.buildUglifiedNameAssignment((function(){return i.MaterialLoader}),"MaterialLoader",/_MaterialLoader/,!1)}static buildUglifiedThreeWtmMapping(){return s.buildUglifiedNameAssignment((function(){return o}),"DataTransport",/_DataTransport/,!0)+s.buildUglifiedNameAssignment((function(){return l}),"GeometryTransport",/_GeometryTransport/,!0)+s.buildUglifiedNameAssignment((function(){return c}),"MeshTransport",/_MeshTransport/,!0)+s.buildUglifiedNameAssignment((function(){return a}),"MaterialsTransport",/_MaterialsTransport/,!0)+s.buildUglifiedNameAssignment((function(){return r}),"MaterialUtils",/_MaterialUtils/,!0)}static buildUglifiedNameAssignment(e,t,n,i){let r=e.toString();r=r.replace(n,"").replace(/[\r\n]+/gm,""),r=r.replace(/.*return/,"").replace(/\}/,"").replace(/;/gm,"");const s=r.trim();let o="";return s!==t&&(o="const "+(i?t:s)+" = "+(i?s:t)+";\n"),o}}class o{constructor(e,t){this.main={cmd:void 0!==e?e:"unknown",id:void 0!==t?t:0,type:"DataTransport",progress:0,buffers:{},params:{}},this.transferables=[]}loadData(e){return this.main.cmd=e.cmd,this.main.id=e.id,this.main.type="DataTransport",this.setProgress(e.progress),this.setParams(e.params),e.buffers&&Object.entries(e.buffers).forEach((([e,t])=>{this.main.buffers[e]=t})),this}getCmd(){return this.main.cmd}getId(){return this.main.id}setParams(e){return null!=e&&(this.main.params=e),this}getParams(){return this.main.params}setProgress(e){return this.main.progress=e,this}addBuffer(e,t){return this.main.buffers[e]=t,this}getBuffer(e){return this.main.buffers[e]}package(e){for(let t of Object.values(this.main.buffers))if(null!=t){const n=e?t.slice(0):t;this.transferables.push(n)}return this}getMain(){return this.main}getTransferables(){return this.transferables}postMessage(e){return e.postMessage(this.main,this.transferables),this}}class a extends o{constructor(e,t){super(e,t),this.main.type="MaterialsTransport",this.main.materials={},this.main.multiMaterialNames={},this.main.cloneInstructions=[]}loadData(e){super.loadData(e),this.main.type="MaterialsTransport",Object.assign(this.main,e);const t=new i.MaterialLoader;return Object.entries(this.main.materials).forEach((([e,n])=>{this.main.materials[e]=t.parse(n)})),this}_cleanMaterial(e){return Object.entries(e).forEach((([t,n])=>{(n instanceof i.Texture||null===n)&&(e[t]=void 0)})),e}addBuffer(e,t){return super.addBuffer(e,t),this}setParams(e){return super.setParams(e),this}setMaterials(e){return null!=e&&Object.keys(e).length>0&&(this.main.materials=e),this}getMaterials(){return this.main.materials}cleanMaterials(){let e,t={};for(let n of Object.values(this.main.materials))"function"==typeof n.clone&&(e=n.clone(),t[e.name]=this._cleanMaterial(e));return this.setMaterials(t),this}package(e){return super.package(e),this.main.materials=r.getMaterialsJSON(this.main.materials),this}hasMultiMaterial(){return Object.keys(this.main.multiMaterialNames).length>0}getSingleMaterial(){return Object.keys(this.main.materials).length>0?Object.entries(this.main.materials)[0][1]:null}processMaterialTransport(e,t){for(let n=0;n{n[t]=e[i]}));else{const t=this.getSingleMaterial();null!==t&&(n=e[t.name],n||(n=t))}return n}}class l extends o{constructor(e,t){super(e,t),this.main.type="GeometryTransport",this.main.geometryType=0,this.main.geometry={},this.main.bufferGeometry=null}loadData(e){return super.loadData(e),this.main.type="GeometryTransport",this.setGeometry(e.geometry,e.geometryType)}getGeometryType(){return this.main.geometryType}setParams(e){return super.setParams(e),this}setGeometry(e,t){return this.main.geometry=e,this.main.geometryType=t,e instanceof i.BufferGeometry&&(this.main.bufferGeometry=e),this}package(e){super.package(e);const t=this.main.geometry.getAttribute("position"),n=this.main.geometry.getAttribute("normal"),i=this.main.geometry.getAttribute("uv"),r=this.main.geometry.getAttribute("color"),s=this.main.geometry.getAttribute("skinIndex"),o=this.main.geometry.getAttribute("skinWeight"),a=this.main.geometry.getIndex();return this._addBufferAttributeToTransferable(t,e),this._addBufferAttributeToTransferable(n,e),this._addBufferAttributeToTransferable(i,e),this._addBufferAttributeToTransferable(r,e),this._addBufferAttributeToTransferable(s,e),this._addBufferAttributeToTransferable(o,e),this._addBufferAttributeToTransferable(a,e),this}reconstruct(e){if(this.main.bufferGeometry instanceof i.BufferGeometry)return this;this.main.bufferGeometry=new i.BufferGeometry;const t=this.main.geometry;this._assignAttribute(t.attributes.position,"position",e),this._assignAttribute(t.attributes.normal,"normal",e),this._assignAttribute(t.attributes.uv,"uv",e),this._assignAttribute(t.attributes.color,"color",e),this._assignAttribute(t.attributes.skinIndex,"skinIndex",e),this._assignAttribute(t.attributes.skinWeight,"skinWeight",e);const n=t.index;if(null!=n){const t=e?n.array.slice(0):n.array;this.main.bufferGeometry.setIndex(new i.BufferAttribute(t,n.itemSize,n.normalized))}const r=t.boundingBox;null!==r&&(this.main.bufferGeometry.boundingBox=Object.assign(new i.Box3,r));const s=t.boundingSphere;return null!==s&&(this.main.bufferGeometry.boundingSphere=Object.assign(new i.Sphere,s)),this.main.bufferGeometry.uuid=t.uuid,this.main.bufferGeometry.name=t.name,this.main.bufferGeometry.type=t.type,this.main.bufferGeometry.groups=t.groups,this.main.bufferGeometry.drawRange=t.drawRange,this.main.bufferGeometry.userData=t.userData,this}getBufferGeometry(){return this.main.bufferGeometry}_addBufferAttributeToTransferable(e,t){if(null!=e){const n=t?e.array.slice(0):e.array;this.transferables.push(n.buffer)}return this}_assignAttribute(e,t,n){if(e){const r=n?e.array.slice(0):e.array;this.main.bufferGeometry.setAttribute(t,new i.BufferAttribute(r,e.itemSize,e.normalized))}return this}}class c extends l{constructor(e,t){super(e,t),this.main.type="MeshTransport",this.main.materialsTransport=new a}loadData(e){return super.loadData(e),this.main.type="MeshTransport",this.main.meshName=e.meshName,this.main.materialsTransport=(new a).loadData(e.materialsTransport.main),this}setParams(e){return super.setParams(e),this}setMaterialsTransport(e){return e instanceof a&&(this.main.materialsTransport=e),this}getMaterialsTransport(){return this.main.materialsTransport}setMesh(e,t){return this.main.meshName=e.name,super.setGeometry(e.geometry,t),this}package(e){return super.package(e),null!==this.main.materialsTransport&&this.main.materialsTransport.package(e),this}reconstruct(e){return super.reconstruct(e),this}}class h{static serializePrototype(e,t,n,i){let r,s=[],o="";i?(o=e.toString()+"\n\n",r=t):r=e;for(let e in r){let t=r[e],n=t.toString();"function"==typeof t&&s.push("\t"+e+": "+n+",\n\n")}o+=n+(i?".prototype":"")+" = {\n\n";for(let e=0;e0){let n;for(const i in e)n=e[i],r.addMaterial(this.materials,n,i,!0===t)}}getMaterials(){return this.materials}getMaterial(e){return this.materials[e]}clearMaterials(){this.materials={}}}class p{static comRouting(e,t,n,i,r){let s=t.data;"init"===s.cmd?null!=n?n[i](e,s.workerId,s.config):i(e,s.workerId,s.config):"execute"===s.cmd&&(null!=n?n[r](e,s.workerId,s.config):r(e,s.workerId,s.config))}}class f{constructor(e){this.taskTypes=new Map,this.verbose=!1,this.maxParallelExecutions=e||4,this.actualExecutionCount=0,this.storedExecutions=[],this.teardown=!1}setVerbose(e){return this.verbose=e,this}setMaxParallelExecutions(e){return this.maxParallelExecutions=e,this}getMaxParallelExecutions(){return this.maxParallelExecutions}supportsTaskType(e){return this.taskTypes.has(e)}registerTaskType(e,t,n,i,r,s){let o=!this.supportsTaskType(e);if(o){let o=new m(e,this.maxParallelExecutions,r,this.verbose);o.setFunctions(t,n,i),o.setDependencyDescriptions(s),this.taskTypes.set(e,o)}return o}registerTaskTypeModule(e,t){let n=!this.supportsTaskType(e);if(n){let n=new m(e,this.maxParallelExecutions,!1,this.verbose);n.setWorkerModule(t),this.taskTypes.set(e,n)}return n}async initTaskType(e,t,n){let i=this.taskTypes.get(e);if(i)if(i.status.initStarted)for(;!i.status.initComplete;)await this._wait(10);else i.status.initStarted=!0,i.isWorkerModule()?await i.createWorkerModules().then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e))):await i.loadDependencies().then((()=>i.createWorkers())).then((()=>i.initWorkers(t,n))).then((()=>i.status.initComplete=!0)).catch((e=>console.error(e)))}async _wait(e){return new Promise((t=>{setTimeout(t,e)}))}async enqueueForExecution(e,t,n,i){return new Promise(((r,s)=>{this.storedExecutions.push(new g(e,t,n,r,s,i)),this._depleteExecutions()}))}_depleteExecutions(){let e=0;for(;this.actualExecutionCount{i.onmessage=n=>{"assetAvailable"===n.data.cmd?t.assetAvailableFunction instanceof Function&&t.assetAvailableFunction(n.data):e(n)},i.onerror=n,i.postMessage({cmd:"execute",workerId:i.getId(),config:t.config},t.transferables)})).then((e=>{n.returnAvailableTask(i),t.resolve(e.data),this.actualExecutionCount--,this._depleteExecutions()})).catch((e=>{t.reject("Execution error: "+e)}))):e++}}dispose(){this.teardown=!0;for(let e of this.taskTypes.values())e.dispose();return this}}class m{constructor(e,t,n,i){this.taskType=e,this.fallback=n,this.verbose=!0===i,this.initialised=!1,this.functions={init:null,execute:null,comRouting:null,dependencies:{descriptions:[],code:[]},workerModuleUrl:null},this.workers={code:[],instances:new Array(t),available:[]},this.status={initStarted:!1,initComplete:!1}}getTaskType(){return this.taskType}setFunctions(e,t,n){this.functions.init=e,this.functions.execute=t,this.functions.comRouting=n,void 0!==this.functions.comRouting&&null!==this.functions.comRouting||(this.functions.comRouting=p.comRouting),this._addWorkerCode("init",this.functions.init.toString()),this._addWorkerCode("execute",this.functions.execute.toString()),this._addWorkerCode("comRouting",this.functions.comRouting.toString()),this.workers.code.push('self.addEventListener( "message", message => comRouting( self, message, null, init, execute ), false );')}_addWorkerCode(e,t){t.startsWith("function")?this.workers.code.push("const "+e+" = "+t+";\n\n"):this.workers.code.push("function "+t+";\n\n")}setDependencyDescriptions(e){e&&e.forEach((e=>{this.functions.dependencies.descriptions.push(e)}))}setWorkerModule(e){this.functions.workerModuleUrl=new URL(e,window.location.href)}isWorkerModule(){return null!==this.functions.workerModuleUrl}async loadDependencies(){let e=[],t=new i.FileLoader;t.setResponseType("arraybuffer");for(let n of this.functions.dependencies.descriptions){if(n.url){let i=new URL(n.url,window.location.href);e.push(t.loadAsync(i.href,(e=>{this.verbose&&console.log(e)})))}n.code&&e.push(new Promise((e=>e(n.code))))}this.verbose&&console.log("Task: "+this.getTaskType()+": Waiting for completion of loading of all dependencies."),this.functions.dependencies.code=await Promise.all(e)}async createWorkers(){let e;if(this.fallback)for(let t=0;t{let s;if(i.onmessage=e=>{this.verbose&&console.log("Init Complete: "+e.data.id),n(e)},i.onerror=r,t){s=[];for(let e=0;e0}returnAvailableTask(e){this.workers.available.push(e)}dispose(){for(let e of this.workers.instances)e.terminate()}}class g{constructor(e,t,n,i,r,s){this.taskType=e,this.config=t,this.assetAvailableFunction=n,this.resolve=i,this.reject=r,this.transferables=s}}class y extends Worker{constructor(e,t,n){super(t,n),this.id=e}getId(){return this.id}}class _{constructor(e,t,n){this.id=e,this.functions={init:t,execute:n}}getId(){return this.id}postMessage(e,t){let n=this,i={postMessage:function(e){n.onmessage({data:e})}};p.comRouting(i,{data:e},null,n.functions.init,n.functions.execute)}terminate(){}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class x extends i.Loader{constructor(e){super(e),this.parser=new b,this.materialStore=new d(!0),this.parser.materials=this.materialStore.getMaterials()}setLogging(e,t){return this.parser.logging.enabled=!0===e,this.parser.logging.debug=!0===t,this}setMaterialPerSmoothingGroup(e){return this.parser.aterialPerSmoothingGroup=!0===e,this}setUseOAsMesh(e){return this.parser.useOAsMesh=!0===e,this}setUseIndices(e){return this.parser.useIndices=!0===e,this}setDisregardNormals(e){return this.parser.disregardNormals=!0===e,this}setModelName(e){return e&&(this.parser.modelName=e),this}getModelName(){return this.parser.modelName}setBaseObject3d(e){return this.parser.baseObject3d=null==e?this.parser.baseObject3d:e,this}setMaterials(e){return this.materialStore.addMaterials(e,!1),this.parser.materials=this.materialStore.getMaterials(),this}setCallbackOnProgress(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onProgress=e),this}setCallbackOnError(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onError=e),this}setCallbackOnLoad(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onLoad=e),this}setCallbackOnMeshAlter(e){return null!=e&&e instanceof Function&&(this.parser.callbacks.onMeshAlter=e),this}load(e,t,n,r,s){if(!(null!=t&&t instanceof Function)){const e="onLoad is not a function! Aborting...";throw this.parser._onError(e),e}this.setCallbackOnLoad(t);const o=this;null!=r&&r instanceof Function||(r=function(e){let t=e;e.currentTarget&&null!==e.currentTarget.statusText&&(t="Error occurred while downloading!\nurl: "+e.currentTarget.responseURL+"\nstatus: "+e.currentTarget.statusText),o.parser._onError(t)}),e||r("An invalid url was provided. Unable to continue!");const a=new URL(e,window.location.href).href;let l=a;const c=a.split("/");if(c.length>2){l=c[c.length-1];let e=c.slice(0,c.length-1).join("/")+"/";void 0!==e&&(this.path=e)}if(null==n||!(n instanceof Function)){let t=0,i=0;n=function(n){if(n.lengthComputable&&(i=n.loaded/n.total,i>t)){t=i;const n='Download of "'+e+'": '+(100*i).toFixed(2)+"%";o.parser._onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(s);const h=new i.FileLoader(this.manager);h.setPath(this.path||this.resourcePath),h.setResponseType("arraybuffer"),h.load(l,(function(e){o.parse(e)}),n,r)}parse(e){if(this.parser.logging.enabled&&console.info("Using OBJLoader2 version: "+x.OBJLOADER2_VERSION),null==e)throw"Provided content is not a valid ArrayBuffer or String. Unable to continue parsing";return this.parser.logging.enabled&&console.time("OBJLoader parse: "+this.modelName),e instanceof ArrayBuffer||e instanceof Uint8Array?(this.parser.logging.enabled&&console.info("Parsing arrayBuffer..."),this.parser._execute(e)):"string"==typeof e||e instanceof String?(this.parser.logging.enabled&&console.info("Parsing text..."),this.parser._executeLegacy(e)):this.parser._onError("Provided content was neither of type String nor Uint8Array! Aborting..."),this.parser.logging.enabled&&console.timeEnd("OBJLoader parse: "+this.modelName),this.parser.baseObject3d}}v(x,"OBJLOADER2_VERSION","4.0.0-dev");class b{constructor(){this.logging={enabled:!1,debug:!1},this.usedBefore=!1,this._init(),this.callbacks={onLoad:null,onError:null,onProgress:null,onMeshAlter:null}}_init(){this.contentRef=null,this.legacyMode=!1,this.materials={},this.baseObject3d=new i.Object3D,this.modelName="noname",this.materialPerSmoothingGroup=!1,this.useOAsMesh=!1,this.useIndices=!1,this.disregardNormals=!1,this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],this.objectId=0,this.rawMesh={objectName:"",groupName:"",activeMtlName:"",mtllibName:"",faceType:-1,subGroups:[],subGroupInUse:null,smoothingGroup:{splitMaterials:!1,normalized:-1,real:-1},counts:{doubleIndicesCount:0,faceCount:0,mtlCount:0,smoothingGroupCount:0}},this.inputObjectCount=1,this.outputObjectCount=1,this.globalCounts={vertices:0,faces:0,doubleIndicesCount:0,lineByte:0,currentByte:0,totalBytes:0}}_resetRawMesh(){this.rawMesh.subGroups=[],this.rawMesh.subGroupInUse=null,this.rawMesh.smoothingGroup.normalized=-1,this.rawMesh.smoothingGroup.real=-1,this._pushSmoothingGroup(1),this.rawMesh.counts.doubleIndicesCount=0,this.rawMesh.counts.faceCount=0,this.rawMesh.counts.mtlCount=0,this.rawMesh.counts.smoothingGroupCount=0}_configure(){if(this.usedBefore=!0,this._pushSmoothingGroup(1),this.logging.enabled){const e=Object.keys(this.materials);let t="OBJLoader2 Parser configuration:"+(e.length>0?"\n\tmaterialNames:\n\t\t- "+e.join("\n\t\t- "):"\n\tmaterialNames: None")+"\n\tmaterialPerSmoothingGroup: "+this.materialPerSmoothingGroup+"\n\tuseOAsMesh: "+this.useOAsMesh+"\n\tuseIndices: "+this.useIndices+"\n\tdisregardNormals: "+this.disregardNormals;null!==this.callbacks.onProgress&&(t+="\n\tcallbacks.onProgress: "+this.callbacks.onProgress.name),null!==this.callbacks.onError&&(t+="\n\tcallbacks.onError: "+this.callbacks.onError.name),null!==this.callbacks.onMeshAlter&&(t+="\n\tcallbacks.onMeshAlter: "+this.callbacks.onMeshAlter.name),null!==this.callbacks.onLoad&&(t+="\n\tcallbacks.onLoad: "+this.callbacks.onLoad.name),console.info(t)}}_execute(e){this.logging.enabled&&console.time("OBJLoader2Parser.execute"),this._configure();const t=new Uint8Array(e);this.contentRef=t;const n=t.byteLength;this.globalCounts.totalBytes=n;const i=new Array(128);let r,s=0,o=0,a="",l=0;for(;l0&&(i[s++]=a),a="";break;case 47:a.length>0&&(i[s++]=a),o++,a="";break;case 10:this._processLine(i,s,o,a,l),a="",s=0,o=0;break;case 13:break;default:a+=String.fromCharCode(r)}this._processLine(i,s,o,a,l),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.execute")}_executeLegacy(e){this.logging.enabled&&console.time("OBJLoader2Parser.executeLegacy"),this._configure(),this.legacyMode=!0,this.contentRef=e;const t=e.length;this.globalCounts.totalBytes=t;const n=new Array(128);let i,r=0,s=0,o="",a=0;for(;a0&&(n[r++]=o),o="";break;case"/":o.length>0&&(n[r++]=o),s++,o="";break;case"\n":this._processLine(n,r,s,o,a),o="",r=0,s=0;break;case"\r":break;default:o+=i}this._processLine(n,r,o,s),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.executeLegacy")}_processLine(e,t,n,i,r){if(this.globalCounts.lineByte=this.globalCounts.currentByte,this.globalCounts.currentByte=r,t<1)return;i.length>0&&(e[t++]=i);const s=function(e,t,n,i){let r="";if(i>n){let s;if(t)for(s=n;s4&&(this.colors.push(parseFloat(e[4])),this.colors.push(parseFloat(e[5])),this.colors.push(parseFloat(e[6])));break;case"vt":this.uvs.push(parseFloat(e[1])),this.uvs.push(parseFloat(e[2]));break;case"vn":this.normals.push(parseFloat(e[1])),this.normals.push(parseFloat(e[2])),this.normals.push(parseFloat(e[3]));break;case"f":if(o=t-1,0===n)for(this._checkFaceType(0),l=2,a=o;l0?s-1:s+r.vertices.length/3),a=r.colors.length>0?o:null;const l=i.vertices;if(l.push(r.vertices[o++]),l.push(r.vertices[o++]),l.push(r.vertices[o]),null!==a){const e=i.colors;e.push(r.colors[a++]),e.push(r.colors[a++]),e.push(r.colors[a])}if(t){const e=parseInt(t);let n=2*(e>0?e-1:e+r.uvs.length/2);const s=i.uvs;s.push(r.uvs[n++]),s.push(r.uvs[n])}if(n&&!r.disregardNormals){const e=parseInt(n);let t=3*(e>0?e-1:e+r.normals.length/3);const s=i.normals;s.push(r.normals[t++]),s.push(r.normals[t++]),s.push(r.normals[t])}};if(this.useIndices){this.disregardNormals&&(n=void 0);const r=e+(t?"_"+t:"_n")+(n?"_"+n:"_n");let o=i.indexMappings[r];null==o?(o=this.rawMesh.subGroupInUse.vertices.length/3,s(),i.indexMappings[r]=o,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(o)}else s();this.rawMesh.counts.faceCount++}_createRawMeshReport(e){return"Input Object number: "+e+"\n\tObject name: "+this.rawMesh.objectName+"\n\tGroup name: "+this.rawMesh.groupName+"\n\tMtllib name: "+this.rawMesh.mtllibName+"\n\tVertex count: "+this.vertices.length/3+"\n\tNormal count: "+this.normals.length/3+"\n\tUV count: "+this.uvs.length/2+"\n\tSmoothingGroup count: "+this.rawMesh.counts.smoothingGroupCount+"\n\tMaterial count: "+this.rawMesh.counts.mtlCount+"\n\tReal MeshOutputGroup count: "+this.rawMesh.subGroups.length}_finalizeRawMesh(){const e=[];let t,n,i=0,r=0,s=0,o=0,a=0,l=0;for(const c in this.rawMesh.subGroups)if(t=this.rawMesh.subGroups[c],t.vertices.length>0){if(n=t.indices,n.length>0&&r>0)for(let e=0;e0&&(c={name:""!==this.rawMesh.groupName?this.rawMesh.groupName:this.rawMesh.objectName,subGroups:e,absoluteVertexCount:i,absoluteIndexCount:s,absoluteColorCount:o,absoluteNormalCount:a,absoluteUvCount:l,faceCount:this.rawMesh.counts.faceCount,doubleIndicesCount:this.rawMesh.counts.doubleIndicesCount}),c}_processCompletedMesh(){const e=this._finalizeRawMesh(),t=null!==e;if(t){this.colors.length>0&&this.colors.length!==this.vertices.length&&this._onError("Vertex Colors were detected, but vertex count and color count do not match!"),this.logging.enabled&&this.logging.debug&&console.debug(this._createRawMeshReport(this.inputObjectCount)),this.inputObjectCount++,this._buildMesh(e);const t=this.globalCounts.currentByte/this.globalCounts.totalBytes;this._onProgress("Completed [o: "+this.rawMesh.objectName+" g:"+this.rawMesh.groupName+"] Total progress: "+(100*t).toFixed(2)+"%"),this._resetRawMesh()}return t}_buildMesh(e){const t=e.subGroups;this.globalCounts.vertices+=e.absoluteVertexCount/3,this.globalCounts.faces+=e.faceCount,this.globalCounts.doubleIndicesCount+=e.doubleIndicesCount;const n=new i.BufferGeometry,s=new Float32Array(e.absoluteVertexCount),o=e.absoluteIndexCount>0?new Uint32Array(e.absoluteIndexCount):null,a=e.absoluteColorCount>0?new Float32Array(e.absoluteColorCount):null,l=e.absoluteNormalCount>0?new Float32Array(e.absoluteNormalCount):null,c=e.absoluteUvCount>0?new Float32Array(e.absoluteUvCount):null;let h;n.setAttribute("position",new i.BufferAttribute(s,3,!1)),null!=l&&n.setAttribute("normal",new i.BufferAttribute(l,3,!1)),null!=c&&n.setAttribute("uv",new i.BufferAttribute(c,2,!1)),null!=a&&n.setAttribute("color",new i.BufferAttribute(a,3,!1)),null!==o&&n.setIndex(new i.BufferAttribute(o,1,!1));let u=0,d=0,p=0,f=0,m=0,g=0,y=0;const _=t.length>1,v=[],x=null!==a;let b,w,M,S,E,T=0;const A={cloneInstructions:[],multiMaterialNames:{},modelName:this.modelName,progress:this.globalCounts.currentByte/this.globalCounts.totalBytes,geometryType:this.rawMesh.faceType<4?0:6===this.rawMesh.faceType?2:1,objectId:this.objectId};for(const e in t)if(t.hasOwnProperty(e)){if(h=t[e],E=h.materialName,b=0===h.smoothingGroup,this.rawMesh.faceType<4?(S=E,x&&(S+="_vertexColor"),b&&(S+="_flat")):S=6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",w=this.materials[E],M=this.materials[S],null==w&&null==M&&(S=x?"defaultVertexColorMaterial":"defaultMaterial",M=this.materials[S],this.logging.enabled&&console.info('object_group "'+h.objectName+"_"+h.groupName+'" was defined with unresolvable material "'+E+'"! Assigning "'+S+'".')),null==M){const e={materialNameOrg:E,materialProperties:{name:S,vertexColors:x?2:0,flatShading:b}};M=r.cloneMaterial(this.materials,e,this.logging.enabled&&this.logging.debug),A.cloneInstructions.push(e)}if(_&&(y=this.useIndices?h.indices.length:h.vertices.length/3,n.addGroup(g,y,T),M=this.materials[S],v[T]=M,A.multiMaterialNames[T]=M.name,g+=y,T++),s.set(h.vertices,u),u+=h.vertices.length,null!==o&&(o.set(h.indices,d),d+=h.indices.length),null!==a&&(a.set(h.colors,p),p+=h.colors.length),null!==l&&(l.set(h.normals,f),f+=h.normals.length),null!==c&&(c.set(h.uvs,m),m+=h.uvs.length),this.logging.enabled&&this.logging.debug){let e="";T>0&&(e="\n\t\tmaterialIndex: "+T);const t="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+h.groupName+"\n\t\tIndex: "+h.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+h.materialName+"\n\t\tsmoothingGroup: "+h.smoothingGroup+e+"\n\t\tobjectName: "+h.objectName+"\n\t\t#vertices: "+h.vertices.length/3+"\n\t\t#indices: "+h.indices.length+"\n\t\t#colors: "+h.colors.length/3+"\n\t\t#uvs: "+h.uvs.length/2+"\n\t\t#normals: "+h.normals.length/3;console.debug(t)}}let C;this.outputObjectCount++,null==n.getAttribute("normal")&&n.computeVertexNormals();const L=_?v:M;C=0===A.geometryType?new i.Mesh(n,L):1===A.geometryType?new i.LineSegments(n,L):new i.Points(n,L),C.name=e.name,this._onAssetAvailable(C,A)}_finalizeParsing(){if(this.logging.enabled&&console.info("Global output object count: "+this.outputObjectCount),this._processCompletedMesh()&&this.logging.enabled){const e="Overall counts: \n\tVertices: "+this.globalCounts.vertices+"\n\tFaces: "+this.globalCounts.faces+"\n\tMultiple definitions: "+this.globalCounts.doubleIndicesCount;console.info(e)}this._onLoad()}_onProgress(e){if(null!==this.callbacks.onProgress)this.callbacks.onProgress(e);else{const t=e||"";this.logging.enabled&&this.logging.debug&&console.log(t)}}_onError(e){null!==this.callbacks.onError?this.callbacks.onError(e):this.logging.enabled&&this.logging.debug&&console.error(e)}_onAssetAvailable(e,t){this._onMeshAlter(e,t),this.baseObject3d.add(e)}_onMeshAlter(e){null!==this.callbacks.onMeshAlter&&this.callbacks.onMeshAlter(e,this.baseObject3d)}_onLoad(){null!==this.callbacks.onLoad&&this.callbacks.onLoad(this.baseObject3d,this.objectId)}static buildUglifiedMapping(){return s.buildUglifiedNameAssignment((function(){return b}),"OBJLoader2Parser",/_OBJLoader2Parser/,!0)}}class w{static buildStandardWorkerDependencies(e){return[{url:e},{code:s.buildThreeConst()},{code:w.buildThreeExtraConst()},{code:"\n\n"},{code:s.buildUglifiedThreeMapping()},{code:w.buildUglifiedThreeExtraMapping()},{code:"\n\n"},{code:h.serializeClass(o)},{code:h.serializeClass(l)},{code:h.serializeClass(c)},{code:h.serializeClass(a)},{code:h.serializeClass(r)},{code:h.serializeClass(b)},{code:h.serializeClass(u)},{code:s.buildUglifiedThreeWtmMapping()},{code:"\n\n"},{code:b.buildUglifiedMapping()},{code:"\n\n"}]}static buildThreeExtraConst(){return"const MathUtils = THREE.MathUtils;\nconst Material = THREE.Material;\nconst Object3D = THREE.Object3D;\nconst Mesh = THREE.Mesh;\n"}static buildUglifiedThreeExtraMapping(){return s.buildUglifiedNameAssignment((function(){return i.MathUtils}),"MathUtils",/_MathUtils/,!1)+s.buildUglifiedNameAssignment((function(){return i.Material}),"Material",/_Material/,!1)+s.buildUglifiedNameAssignment((function(){return i.Object3D}),"Object3D",/_Object3D/,!1)+s.buildUglifiedNameAssignment((function(){return i.Mesh}),"Mesh",/_Mesh/,!1)}static init(e,t,n){const i=(new a).loadData(n);e.obj2={parser:new b,buffer:null,materials:i.getMaterials()},e.obj2.parser._onMeshAlter=(t,n)=>{const i=new a;if(i.main.multiMaterialNames=n.multiMaterialNames,0===Object.keys(i.main.multiMaterialNames).length){const e=t.material;r.addMaterial(i.main.materials,e,e.name,!1,!1)}i.main.cloneInstructions=n.cloneInstructions,i.cleanMaterials(),new c("assetAvailable",n.objectId).setProgress(n.progress).setParams({modelName:n.modelName}).setMesh(t,n.geometryType).setMaterialsTransport(i).postMessage(e)},e.obj2.parser.callbacks.onLoad=()=>{new o("execComplete",e.obj2.parser.objectId).postMessage(e)},e.obj2.parser.callbacks.onProgress=t=>{e.obj2.parser.logging.debug&&console.debug("WorkerRunner: progress: "+t)},u.applyProperties(e.obj2.parser,i.getParams(),!1);const s=i.getBuffer("modelData");null!=s&&(e.obj2.buffer=s),new o("init",t).postMessage(e)}static execute(e,t,n){e.obj2.parser.usedBefore&&e.obj2.parser._init(),e.obj2.parser.materials=e.obj2.materials;const i=(new o).loadData(n);u.applyProperties(e.obj2.parser,i.getParams(),!1);const r=i.getBuffer("modelData");null!=r&&(e.obj2.buffer=r),e.obj2.buffer&&(e.obj2.parser.objectId=i.getId(),e.obj2.parser._execute(e.obj2.buffer))}}class M extends x{constructor(e){super(e),this.preferJsmWorker=!1,this.urls={jsmWorker:new URL(M.DEFAULT_JSM_WORKER_PATH,window.location.href),threejs:new URL(M.DEFAULT_JSM_THREEJS_PATH,window.location.href)},this.workerTaskManager=null,this.taskName="tmOBJLoader2"}setWorkerTaskManager(e,t){return this.workerTaskManager=e,t&&(this.taskName=t),this}setJsmWorker(e,t){if(this.preferJsmWorker=!0===e,!(null!=t&&t instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.jsmWorker=t,this}setThreejsLocation(e){if(!(null!=e&&e instanceof URL))throw"The url to the jsm worker is not valid. Aborting...";return this.urls.threejs=e,this}setTerminateWorkerOnLoad(e){return this.terminateWorkerOnLoad=!0===e,this}async _buildWorkerCode(e){null!==this.workerTaskManager&&this.workerTaskManager instanceof f||(this.parser.logging.debug&&console.log("Needed to create new WorkerTaskManager"),this.workerTaskManager=new f(1),this.workerTaskManager.setVerbose(this.parser.logging.enabled&&this.parser.logging.debug)),this.workerTaskManager.supportsTaskType(this.taskName)||(this.preferJsmWorker?this.workerTaskManager.registerTaskTypeModule(this.taskName,this.urls.jsmWorker):this.workerTaskManager.registerTaskType(this.taskName,w.init,w.execute,null,!1,w.buildStandardWorkerDependencies(this.urls.threejs)),await this.workerTaskManager.initTaskType(this.taskName,e.getMain()))}load(e,t,n,i,r){const s=this;x.prototype.load.call(this,e,(function(e,n){"OBJLoader2ParallelDummy"===e.name?s.parser.logging.enabled&&s.parser.logging.debug&&console.debug("Received dummy answer from OBJLoader2Parallel#parse"):t(e,n)}),n,i,r)}parse(e){this.parser.logging.enabled&&console.info("Using OBJLoader2Parallel version: "+M.OBJLOADER2_PARALLEL_VERSION);const t=(new o).setParams({logging:{enabled:this.parser.logging.enabled,debug:this.parser.logging.debug}});this._buildWorkerCode(t).then((()=>{this.parser.logging.debug&&console.log("OBJLoader2Parallel init was performed"),this._executeWorkerParse(e)})).catch((e=>console.error(e)));let n=new i.Object3D;return n.name="OBJLoader2ParallelDummy",n}_executeWorkerParse(e){const t=new o("execute",Math.floor(Math.random()*Math.floor(65536)));t.setParams({modelName:this.parser.modelName,useIndices:this.parser.useIndices,disregardNormals:this.parser.disregardNormals,materialPerSmoothingGroup:this.parser.materialPerSmoothingGroup,useOAsMesh:this.parser.useOAsMesh,materials:r.getMaterialsJSON(this.materialStore.getMaterials())}).addBuffer("modelData",e).package(!1),this.workerTaskManager.enqueueForExecution(this.taskName,t.getMain(),(e=>this._onLoad(e)),t.getTransferables()).then((e=>{this._onLoad(e),this.terminateWorkerOnLoad&&this.workerTaskManager.dispose()})).catch((e=>console.error(e)))}_onLoad(e){let t=e.cmd;if("assetAvailable"===t){let t;if("MeshTransport"===e.type?t=(new c).loadData(e).reconstruct(!1):console.error("Received unknown asset.type: "+e.type),t){let e,n=t.getMaterialsTransport().processMaterialTransport(this.materialStore.getMaterials(),this.parser.logging.enabled);null===n&&(n=new i.MeshStandardMaterial({color:16711680})),e=0===t.getGeometryType()?new i.Mesh(t.getBufferGeometry(),n):1===t.getGeometryType()?new i.LineSegments(t.getBufferGeometry(),n):new i.Points(t.getBufferGeometry(),n),this.parser._onMeshAlter(e),this.parser.baseObject3d.add(e)}}else if("execComplete"===t){let t;"DataTransport"===e.type?(t=(new o).loadData(e),t instanceof o&&null!==this.parser.callbacks.onLoad&&this.parser.callbacks.onLoad(this.parser.baseObject3d,t.getId())):console.error("Received unknown asset.type: "+e.type)}else console.error("Received unknown command: "+t)}}v(M,"OBJLOADER2_PARALLEL_VERSION",x.OBJLOADER2_VERSION),v(M,"DEFAULT_JSM_WORKER_PATH","/src/loaders/tmOBJLoader2.js"),v(M,"DEFAULT_JSM_THREEJS_PATH","/node_modules/three/build/three.min.js");class S{static link(e,t){"function"==typeof t.setMaterials&&t.setMaterials(S.addMaterialsFromMtlLoader(e),!0)}static addMaterialsFromMtlLoader(e){let t={};return void 0!==e.preload&&e.preload instanceof Function&&(e.preload(),t=e.materials),t}}},676:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DataViewIndexOutOfBoundsError:()=>H,DecodeError:()=>x,Decoder:()=>W,EXT_TIMESTAMP:()=>b,Encoder:()=>R,ExtData:()=>_,ExtensionCodec:()=>C,decode:()=>q,decodeArrayStream:()=>ee,decodeAsync:()=>$,decodeMulti:()=>X,decodeMultiStream:()=>te,decodeStream:()=>ne,decodeTimestampExtension:()=>T,decodeTimestampToTimeSpec:()=>E,encode:()=>D,encodeDateToTimeSpec:()=>M,encodeTimeSpecToTimestamp:()=>w,encodeTimestampExtension:()=>S});var i,r,s,o=4294967295;function a(e,t,n){var i=Math.floor(n/4294967296),r=n;e.setUint32(t,i),e.setUint32(t+4,r)}function l(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var c=("undefined"==typeof process||"never"!==(null===(i=null===process||void 0===process?void 0:process.env)||void 0===i?void 0:i.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function h(e){for(var t=e.length,n=0,i=0;i=55296&&r<=56319&&i65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(o+=String.fromCharCode.apply(String,s)),o}var m,g=c?new TextDecoder:null,y=c?"undefined"!=typeof process&&"force"!==(null===(s=null===process||void 0===process?void 0:process.env)||void 0===s?void 0:s.TEXT_DECODER)?200:0:o,_=function(e,t){this.type=e,this.data=t},v=(m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),x=function(e){function t(n){var i=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(i,r),Object.defineProperty(i,"name",{configurable:!0,enumerable:!1,value:t.name}),i}return v(t,e),t}(Error),b=-1;function w(e){var t,n=e.sec,i=e.nsec;if(n>=0&&i>=0&&n<=17179869183){if(0===i&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var s=n/4294967296,o=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,i<<2|3&s),t.setUint32(4,o),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,i),a(t,4,n),r}function M(e){var t=e.getTime(),n=Math.floor(t/1e3),i=1e6*(t-1e3*n),r=Math.floor(i/1e9);return{sec:n+r,nsec:i-1e9*r}}function S(e){return e instanceof Date?w(M(e)):null}function E(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:l(t,4),nsec:t.getUint32(0)};default:throw new x("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}function T(e){var t=E(e);return new Date(1e3*t.sec+t.nsec/1e6)}var A={type:b,encode:S,decode:T},C=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(A)}return e.prototype.register=function(e){var t=e.type,n=e.encode,i=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=i;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=i}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>d){var t=h(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),p(e,this.bytes,this.pos),this.pos+=t}else t=h(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var i=e.length,r=n,s=0;s>6&31|192;else{if(o>=55296&&o<=56319&&s>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=63&o|128}else t[r++]=o}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=L(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var i=0,r=e;i0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var i=0,r=this.caches[n-1];i=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)},e.prototype.decode=function(e,t,n){var i=this.find(e,t,n);if(null!=i)return this.hit++,i;this.miss++;var r=f(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,r),r},e}(),k=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof B?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},F=new DataView(new ArrayBuffer(0)),z=new Uint8Array(F.buffer),H=function(){try{F.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),G=new H("Insufficient data"),V=new O,W=function(){function e(e,t,n,i,r,s,a,l){void 0===e&&(e=C.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=o),void 0===i&&(i=o),void 0===r&&(r=o),void 0===s&&(s=o),void 0===a&&(a=o),void 0===l&&(l=V),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=r,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=l,this.totalPos=0,this.pos=0,this.view=F,this.bytes=z,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=L(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=L(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=L(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return k(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,i,r,s,o,a,l;return s=this,o=void 0,l=function(){var s,o,a,l,c,h,u,d;return k(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=N(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{o=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof H))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return l=p.sent(),i={error:l},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(i)throw i.error;return[7];case 11:return[7];case 12:if(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw h=(c=this).headByte,u=c.pos,d=c.totalPos,new RangeError("Insufficient data in parsing ".concat(I(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{r(l.next(e))}catch(e){t(e)}}function i(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(n,i)}r((l=l.apply(s,o||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return U(this,arguments,(function(){var n,i,r,s,o,a,l,c,h;return k(this,(function(u){switch(u.label){case 0:n=t,i=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),r=N(e),u.label=2;case 2:return[4,B(r.next())];case 3:if((s=u.sent()).done)return[3,12];if(o=s.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),n&&(i=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,B(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof H))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return l=u.sent(),c={error:l},[3,19];case 14:return u.trys.push([14,,17,18]),s&&!s.done&&(h=r.return)?[4,B(h.call(r))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(c)throw c.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(i=e-128)){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){if(0!=(i=e-144)){this.pushArrayState(i),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(i=this.readU16())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(221===e){if(0!==(i=this.readU32())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(222===e){if(0!==(i=this.readU16())){this.pushMapState(i),this.complete();continue e}t={}}else if(223===e){if(0!==(i=this.readU32())){this.pushMapState(i),this.complete();continue e}t={}}else if(196===e){var i=this.lookU8();t=this.decodeBinary(i,1)}else if(197===e)i=this.lookU16(),t=this.decodeBinary(i,2);else if(198===e)i=this.lookU32(),t=this.decodeBinary(i,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)i=this.lookU8(),t=this.decodeExtension(i,1);else if(200===e)i=this.lookU16(),t=this.decodeExtension(i,2);else{if(201!==e)throw new x("Unrecognized type byte: ".concat(I(e)));i=this.lookU32(),t=this.decodeExtension(i,4)}this.complete();for(var r=this.stack;r.length>0;){var s=r[r.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;r.pop(),t=s.array}else{if(1===s.type){if(void 0,"string"!=(o=typeof t)&&"number"!==o)throw new x("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new x("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}r.pop(),t=s.map}}return t}var o},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new x("Unrecognized array type byte: ".concat(I(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new x("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new x("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new x("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthy?function(e,t,n){var i=e.subarray(t,t+n);return g.decode(i)}(this.bytes,r,e):f(this.bytes,r,e),this.pos+=t+e,i},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new x("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw G;var n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new x("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=l(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),j={};function q(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function X(e,t){return void 0===t&&(t=j),new W(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var J=function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Y?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}};function K(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function Q(e){return null!=e[Symbol.asyncIterator]?e:function(e){return Z(this,arguments,(function(){var t,n,i,r;return J(this,(function(s){switch(s.label){case 0:t=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Y(t.read())];case 3:return n=s.sent(),i=n.done,r=n.value,i?[4,Y(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return K(r),[4,Y(r)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function $(e,t){return void 0===t&&(t=j),n=this,i=void 0,s=function(){var n;return function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]{"use strict";n.r(t),n.d(t,{ACESFilmicToneMapping:()=>ne,AddEquation:()=>E,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>Ct,AdditiveBlending:()=>b,AlphaFormat:()=>Oe,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>nn,AmbientLight:()=>Uu,AmbientLightProbe:()=>td,AnimationClip:()=>cu,AnimationLoader:()=>yu,AnimationMixer:()=>Id,AnimationObjectGroup:()=>Pd,AnimationUtils:()=>Zh,ArcCurve:()=>vc,ArrayCamera:()=>Qa,ArrowHelper:()=>wp,Audio:()=>pd,AudioAnalyser:()=>vd,AudioContext:()=>Qu,AudioListener:()=>dd,AudioLoader:()=>$u,AxesHelper:()=>Mp,AxisHelper:()=>sf,BackSide:()=>m,BasicDepthPacking:()=>Ot,BasicShadowMap:()=>h,BinaryTextureLoader:()=>hf,Bone:()=>Ul,BooleanKeyframeTrack:()=>nu,BoundingBoxHelper:()=>of,Box2:()=>Vd,Box3:()=>ci,Box3Helper:()=>yp,BoxBufferGeometry:()=>cs,BoxGeometry:()=>cs,BoxHelper:()=>gp,BufferAttribute:()=>Er,BufferGeometry:()=>Vr,BufferGeometryLoader:()=>ju,ByteType:()=>Se,Cache:()=>uu,Camera:()=>fs,CameraHelper:()=>pp,CanvasRenderer:()=>df,CanvasTexture:()=>gc,CapsuleBufferGeometry:()=>zc,CapsuleGeometry:()=>zc,CatmullRomCurve3:()=>Ec,CineonToneMapping:()=>te,CircleBufferGeometry:()=>Hc,CircleGeometry:()=>Hc,ClampToEdgeWrapping:()=>ue,Clock:()=>od,Color:()=>jn,ColorKeyframeTrack:()=>iu,ColorManagement:()=>Un,CompressedTexture:()=>mc,CompressedTextureLoader:()=>_u,ConeBufferGeometry:()=>Vc,ConeGeometry:()=>Vc,CubeCamera:()=>ys,CubeReflectionMapping:()=>se,CubeRefractionMapping:()=>oe,CubeTexture:()=>_s,CubeTextureLoader:()=>xu,CubeUVReflectionMapping:()=>ce,CubicBezierCurve:()=>Lc,CubicBezierCurve3:()=>Rc,CubicInterpolant:()=>Qh,CullFaceBack:()=>a,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>o,Curve:()=>yc,CurvePath:()=>Bc,CustomBlending:()=>S,CustomToneMapping:()=>ie,CylinderBufferGeometry:()=>Gc,CylinderGeometry:()=>Gc,Cylindrical:()=>Hd,Data3DTexture:()=>ni,DataArrayTexture:()=>ei,DataTexture:()=>Fl,DataTexture2DArray:()=>wf,DataTexture3D:()=>Mf,DataTextureLoader:()=>bu,DataUtils:()=>Ep,DecrementStencilOp:()=>jt,DecrementWrapStencilOp:()=>Xt,DefaultLoadingManager:()=>pu,DepthFormat:()=>Fe,DepthStencilFormat:()=>ze,DepthTexture:()=>nl,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>hp,DiscreteInterpolant:()=>eu,DodecahedronBufferGeometry:()=>jc,DodecahedronGeometry:()=>jc,DoubleSide:()=>g,DstAlphaFactor:()=>N,DstColorFactor:()=>U,DynamicBufferAttribute:()=>Jp,DynamicCopyUsage:()=>un,DynamicDrawUsage:()=>sn,DynamicReadUsage:()=>ln,EdgesGeometry:()=>Zc,EdgesHelper:()=>af,EllipseCurve:()=>_c,EqualDepth:()=>j,EqualStencilFunc:()=>Kt,EquirectangularReflectionMapping:()=>ae,EquirectangularRefractionMapping:()=>le,Euler:()=>Xi,EventDispatcher:()=>gn,ExtrudeBufferGeometry:()=>Eh,ExtrudeGeometry:()=>Eh,FaceColors:()=>Bp,FileLoader:()=>gu,FlatShading:()=>y,Float16BufferAttribute:()=>Ir,Float32Attribute:()=>nf,Float32BufferAttribute:()=>Or,Float64Attribute:()=>rf,Float64BufferAttribute:()=>kr,FloatType:()=>Le,Fog:()=>ll,FogExp2:()=>al,Font:()=>vf,FontLoader:()=>_f,FramebufferTexture:()=>fc,FrontSide:()=>f,Frustum:()=>Ts,GLBufferAttribute:()=>Nd,GLSL1:()=>pn,GLSL3:()=>fn,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>tn,GreaterStencilFunc:()=>$t,GridHelper:()=>sp,Group:()=>$a,HalfFloatType:()=>Re,HemisphereLight:()=>Su,HemisphereLightHelper:()=>rp,HemisphereLightProbe:()=>ed,IcosahedronBufferGeometry:()=>Ah,IcosahedronGeometry:()=>Ah,ImageBitmapLoader:()=>Zu,ImageLoader:()=>vu,ImageUtils:()=>Xn,ImmediateRenderObject:()=>xf,IncrementStencilOp:()=>Wt,IncrementWrapStencilOp:()=>qt,InstancedBufferAttribute:()=>Vl,InstancedBufferGeometry:()=>Wu,InstancedInterleavedBuffer:()=>kd,InstancedMesh:()=>Jl,Int16Attribute:()=>Qp,Int16BufferAttribute:()=>Lr,Int32Attribute:()=>ef,Int32BufferAttribute:()=>Pr,Int8Attribute:()=>Yp,Int8BufferAttribute:()=>Tr,IntType:()=>Ae,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>dl,Interpolant:()=>Kh,InterpolateDiscrete:()=>bt,InterpolateLinear:()=>wt,InterpolateSmooth:()=>Mt,InvertStencilOp:()=>Jt,JSONLoader:()=>pf,KeepStencilOp:()=>Gt,KeyframeTrack:()=>tu,LOD:()=>Pl,LatheBufferGeometry:()=>Fc,LatheGeometry:()=>Fc,Layers:()=>Ji,LensFlare:()=>mf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>Qt,LessStencilFunc:()=>Zt,Light:()=>Mu,LightProbe:()=>Hu,Line:()=>tc,Line3:()=>qd,LineBasicMaterial:()=>Yl,LineCurve:()=>Pc,LineCurve3:()=>Dc,LineDashedMaterial:()=>Jh,LineLoop:()=>sc,LinePieces:()=>kp,LineSegments:()=>rc,LineStrip:()=>Op,LinearEncoding:()=>Dt,LinearFilter:()=>_e,LinearInterpolant:()=>$h,LinearMipMapLinearFilter:()=>we,LinearMipMapNearestFilter:()=>xe,LinearMipmapLinearFilter:()=>be,LinearMipmapNearestFilter:()=>ve,LinearSRGBColorSpace:()=>zt,LinearToneMapping:()=>$,Loader:()=>fu,LoaderUtils:()=>Vu,LoadingManager:()=>du,LoopOnce:()=>_t,LoopPingPong:()=>xt,LoopRepeat:()=>vt,LuminanceAlphaFormat:()=>Ue,LuminanceFormat:()=>Be,MOUSE:()=>r,Material:()=>br,MaterialLoader:()=>Gu,Math:()=>Cn,MathUtils:()=>Cn,Matrix3:()=>Rn,Matrix4:()=>Bi,MaxEquation:()=>L,Mesh:()=>as,MeshBasicMaterial:()=>wr,MeshDepthMaterial:()=>qa,MeshDistanceMaterial:()=>Xa,MeshFaceMaterial:()=>Fp,MeshLambertMaterial:()=>qh,MeshMatcapMaterial:()=>Xh,MeshNormalMaterial:()=>jh,MeshPhongMaterial:()=>Vh,MeshPhysicalMaterial:()=>Gh,MeshStandardMaterial:()=>Hh,MeshToonMaterial:()=>Wh,MinEquation:()=>C,MirroredRepeatWrapping:()=>de,MixOperation:()=>Z,MultiMaterial:()=>zp,MultiplyBlending:()=>M,MultiplyOperation:()=>Y,NearestFilter:()=>pe,NearestMipMapLinearFilter:()=>ye,NearestMipMapNearestFilter:()=>me,NearestMipmapLinearFilter:()=>ge,NearestMipmapNearestFilter:()=>fe,NeverDepth:()=>H,NeverStencilFunc:()=>Yt,NoBlending:()=>v,NoColorSpace:()=>Ut,NoColors:()=>Np,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>At,NormalBlending:()=>x,NotEqualDepth:()=>J,NotEqualStencilFunc:()=>en,NumberKeyframeTrack:()=>ru,Object3D:()=>lr,ObjectLoader:()=>qu,ObjectSpaceNormalMap:()=>Bt,OctahedronBufferGeometry:()=>Ch,OctahedronGeometry:()=>Ch,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>B,OneMinusDstColorFactor:()=>F,OneMinusSrcAlphaFactor:()=>k,OneMinusSrcColorFactor:()=>I,OrthographicCamera:()=>Fs,PCFShadowMap:()=>u,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>Xs,ParametricGeometry:()=>gf,Particle:()=>Gp,ParticleBasicMaterial:()=>jp,ParticleSystem:()=>Vp,ParticleSystemMaterial:()=>qp,Path:()=>Uc,PerspectiveCamera:()=>ms,Plane:()=>Ms,PlaneBufferGeometry:()=>Ls,PlaneGeometry:()=>Ls,PlaneHelper:()=>_p,PointCloud:()=>Hp,PointCloudMaterial:()=>Wp,PointLight:()=>ku,PointLightHelper:()=>ep,Points:()=>uc,PointsMaterial:()=>oc,PolarGridHelper:()=>op,PolyhedronBufferGeometry:()=>Wc,PolyhedronGeometry:()=>Wc,PositionalAudio:()=>_d,PropertyBinding:()=>Rd,PropertyMixer:()=>xd,QuadraticBezierCurve:()=>Ic,QuadraticBezierCurve3:()=>Oc,Quaternion:()=>si,QuaternionKeyframeTrack:()=>ou,QuaternionLinearInterpolant:()=>su,REVISION:()=>i,RGBADepthPacking:()=>kt,RGBAFormat:()=>Ne,RGBAIntegerFormat:()=>je,RGBA_ASTC_10x10_Format:()=>ft,RGBA_ASTC_10x5_Format:()=>ut,RGBA_ASTC_10x6_Format:()=>dt,RGBA_ASTC_10x8_Format:()=>pt,RGBA_ASTC_12x10_Format:()=>mt,RGBA_ASTC_12x12_Format:()=>gt,RGBA_ASTC_4x4_Format:()=>it,RGBA_ASTC_5x4_Format:()=>rt,RGBA_ASTC_5x5_Format:()=>st,RGBA_ASTC_6x5_Format:()=>ot,RGBA_ASTC_6x6_Format:()=>at,RGBA_ASTC_8x5_Format:()=>lt,RGBA_ASTC_8x6_Format:()=>ct,RGBA_ASTC_8x8_Format:()=>ht,RGBA_BPTC_Format:()=>yt,RGBA_ETC2_EAC_Format:()=>nt,RGBA_PVRTC_2BPPV1_Format:()=>$e,RGBA_PVRTC_4BPPV1_Format:()=>Qe,RGBA_S3TC_DXT1_Format:()=>Xe,RGBA_S3TC_DXT3_Format:()=>Je,RGBA_S3TC_DXT5_Format:()=>Ye,RGBFormat:()=>ke,RGB_ETC1_Format:()=>et,RGB_ETC2_Format:()=>tt,RGB_PVRTC_2BPPV1_Format:()=>Ke,RGB_PVRTC_4BPPV1_Format:()=>Ze,RGB_S3TC_DXT1_Format:()=>qe,RGFormat:()=>Ve,RGIntegerFormat:()=>We,RawShaderMaterial:()=>zh,Ray:()=>Ni,Raycaster:()=>Bd,RectAreaLight:()=>Fu,RedFormat:()=>He,RedIntegerFormat:()=>Ge,ReinhardToneMapping:()=>ee,RepeatWrapping:()=>he,ReplaceStencilOp:()=>Vt,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>Lh,RingGeometry:()=>Lh,SRGBColorSpace:()=>Ft,Scene:()=>cl,SceneUtils:()=>ff,ShaderChunk:()=>Rs,ShaderLib:()=>Ds,ShaderMaterial:()=>ps,ShadowMaterial:()=>Fh,Shape:()=>Kc,ShapeBufferGeometry:()=>Rh,ShapeGeometry:()=>Rh,ShapePath:()=>Sp,ShapeUtils:()=>wh,ShortType:()=>Ee,Skeleton:()=>Gl,SkeletonHelper:()=>Qd,SkinnedMesh:()=>Bl,SmoothShading:()=>_,Source:()=>Jn,Sphere:()=>Ci,SphereBufferGeometry:()=>Ph,SphereGeometry:()=>Ph,Spherical:()=>zd,SphericalHarmonics3:()=>zu,SplineCurve:()=>kc,SpotLight:()=>Ru,SpotLightHelper:()=>Jd,Sprite:()=>Al,SpriteMaterial:()=>pl,SrcAlphaFactor:()=>O,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>D,StaticCopyUsage:()=>hn,StaticDrawUsage:()=>rn,StaticReadUsage:()=>an,StereoCamera:()=>sd,StreamCopyUsage:()=>dn,StreamDrawUsage:()=>on,StreamReadUsage:()=>cn,StringKeyframeTrack:()=>au,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>s,TangentSpaceNormalMap:()=>Nt,TetrahedronBufferGeometry:()=>Dh,TetrahedronGeometry:()=>Dh,TextGeometry:()=>yf,Texture:()=>Kn,TextureLoader:()=>wu,TorusBufferGeometry:()=>Ih,TorusGeometry:()=>Ih,TorusKnotBufferGeometry:()=>Oh,TorusKnotGeometry:()=>Oh,Triangle:()=>vr,TriangleFanDrawMode:()=>Pt,TriangleStripDrawMode:()=>Rt,TrianglesDrawMode:()=>Lt,TubeBufferGeometry:()=>kh,TubeGeometry:()=>kh,UVMapping:()=>re,Uint16Attribute:()=>$p,Uint16BufferAttribute:()=>Rr,Uint32Attribute:()=>tf,Uint32BufferAttribute:()=>Dr,Uint8Attribute:()=>Zp,Uint8BufferAttribute:()=>Ar,Uint8ClampedAttribute:()=>Kp,Uint8ClampedBufferAttribute:()=>Cr,Uniform:()=>Od,UniformsLib:()=>Ps,UniformsUtils:()=>ds,UnsignedByteType:()=>Me,UnsignedInt248Type:()=>Ie,UnsignedIntType:()=>Ce,UnsignedShort4444Type:()=>Pe,UnsignedShort5551Type:()=>De,UnsignedShortType:()=>Te,VSMShadowMap:()=>p,Vector2:()=>Ln,Vector3:()=>oi,Vector4:()=>Qn,VectorKeyframeTrack:()=>lu,Vertex:()=>Xp,VertexColors:()=>Up,VideoTexture:()=>pc,WebGL1Renderer:()=>ol,WebGL3DRenderTarget:()=>ii,WebGLArrayRenderTarget:()=>ti,WebGLCubeRenderTarget:()=>vs,WebGLMultipleRenderTargets:()=>ri,WebGLMultisampleRenderTarget:()=>bf,WebGLRenderTarget:()=>$n,WebGLRenderTargetCube:()=>uf,WebGLRenderer:()=>sl,WebGLUtils:()=>Ka,WireframeGeometry:()=>Nh,WireframeHelper:()=>lf,WrapAroundEnding:()=>Tt,XHRLoader:()=>cf,ZeroCurvatureEnding:()=>St,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Et,ZeroStencilOp:()=>Ht,_SRGBAFormat:()=>mn,sRGBEncoding:()=>It});const i="140",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,a=1,l=2,c=3,h=0,u=1,d=2,p=3,f=0,m=1,g=2,y=1,_=2,v=0,x=1,b=2,w=3,M=4,S=5,E=100,T=101,A=102,C=103,L=104,R=200,P=201,D=202,I=203,O=204,k=205,N=206,B=207,U=208,F=209,z=210,H=0,G=1,V=2,W=3,j=4,q=5,X=6,J=7,Y=0,Z=1,K=2,Q=0,$=1,ee=2,te=3,ne=4,ie=5,re=300,se=301,oe=302,ae=303,le=304,ce=306,he=1e3,ue=1001,de=1002,pe=1003,fe=1004,me=1004,ge=1005,ye=1005,_e=1006,ve=1007,xe=1007,be=1008,we=1008,Me=1009,Se=1010,Ee=1011,Te=1012,Ae=1013,Ce=1014,Le=1015,Re=1016,Pe=1017,De=1018,Ie=1020,Oe=1021,ke=1022,Ne=1023,Be=1024,Ue=1025,Fe=1026,ze=1027,He=1028,Ge=1029,Ve=1030,We=1031,je=1033,qe=33776,Xe=33777,Je=33778,Ye=33779,Ze=35840,Ke=35841,Qe=35842,$e=35843,et=36196,tt=37492,nt=37496,it=37808,rt=37809,st=37810,ot=37811,at=37812,lt=37813,ct=37814,ht=37815,ut=37816,dt=37817,pt=37818,ft=37819,mt=37820,gt=37821,yt=36492,_t=2200,vt=2201,xt=2202,bt=2300,wt=2301,Mt=2302,St=2400,Et=2401,Tt=2402,At=2500,Ct=2501,Lt=0,Rt=1,Pt=2,Dt=3e3,It=3001,Ot=3200,kt=3201,Nt=0,Bt=1,Ut="",Ft="srgb",zt="srgb-linear",Ht=0,Gt=7680,Vt=7681,Wt=7682,jt=7683,qt=34055,Xt=34056,Jt=5386,Yt=512,Zt=513,Kt=514,Qt=515,$t=516,en=517,tn=518,nn=519,rn=35044,sn=35048,on=35040,an=35045,ln=35049,cn=35041,hn=35046,un=35050,dn=35042,pn="100",fn="300 es",mn=1035;class gn{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+yn[e>>16&255]+yn[e>>24&255]+"-"+yn[255&t]+yn[t>>8&255]+"-"+yn[t>>16&15|64]+yn[t>>24&255]+"-"+yn[63&n|128]+yn[n>>8&255]+"-"+yn[n>>16&255]+yn[n>>24&255]+yn[255&i]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function wn(e,t,n){return Math.max(t,Math.min(n,e))}function Mn(e,t){return(e%t+t)%t}function Sn(e,t,n){return(1-n)*e+n*t}function En(e){return 0==(e&e-1)&&0!==e}function Tn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function An(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Cn=Object.freeze({__proto__:null,DEG2RAD:vn,RAD2DEG:xn,generateUUID:bn,clamp:wn,euclideanModulo:Mn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Sn,damp:function(e,t,n,i){return Sn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Mn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(_n=e);let t=_n+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*vn},radToDeg:function(e){return e*xn},isPowerOfTwo:En,ceilPowerOfTwo:Tn,floorPowerOfTwo:An,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),u=s((t-i)/2),d=o((t-i)/2),p=s((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*u,l*d,a*c);break;case"YZY":e.set(l*d,a*h,l*u,a*c);break;case"ZXZ":e.set(l*u,l*d,a*h,a*c);break;case"XZX":e.set(a*h,l*f,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*f,a*c);break;case"ZYZ":e.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}},denormalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}});class Ln{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ln.prototype.isVector2=!0;class Rn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],y=i[1],_=i[4],v=i[7],x=i[2],b=i[5],w=i[8];return r[0]=s*f+o*y+a*x,r[3]=s*m+o*_+a*b,r[6]=s*g+o*v+a*w,r[1]=l*f+c*y+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*v+h*w,r[2]=u*f+d*y+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*v+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=t*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(o*n-i*s)*f,e[3]=u*f,e[4]=(c*t-i*a)*f,e[5]=(i*r-o*t)*f,e[6]=d*f,e[7]=(n*a-l*t)*f,e[8]=(s*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=t*r+n*a,i[3]=t*s+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*a,i[4]=-n*s+t*l,i[7]=-n*o+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Pn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}Rn.prototype.isMatrix3=!0;const Dn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function In(e,t){return new Dn[e](t)}function On(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function kn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Nn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}const Bn={[Ft]:{[zt]:kn},[zt]:{[Ft]:Nn}},Un={legacyMode:!0,get workingColorSpace(){return zt},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Bn[t]&&void 0!==Bn[t][n]){const i=Bn[t][n];return e.r=i(e.r),e.g=i(e.g),e.b=i(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Fn={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},zn={r:0,g:0,b:0},Hn={h:0,s:0,l:0},Gn={h:0,s:0,l:0};function Vn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Wn(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class jn{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Un.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=zt){return this.r=e,this.g=t,this.b=n,Un.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=zt){if(e=Mn(e,1),t=wn(t,0,1),n=wn(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Vn(r,i,e+1/3),this.g=Vn(r,i,e),this.b=Vn(r,i,e-1/3)}return Un.toWorkingColorSpace(this,i),this}setStyle(e,t=Ft){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,Un.toWorkingColorSpace(this,t),n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,Un.toWorkingColorSpace(this,t),n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return n(e[4]),this.setHSL(i,r,s,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=i[1],n=e.length;if(3===n)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,Un.toWorkingColorSpace(this,t),this;if(6===n)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,Un.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ft){const n=Fn[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=Nn(e.r),this.g=Nn(e.g),this.b=Nn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ft){return Un.fromWorkingColorSpace(Wn(this,zn),e),wn(255*zn.r,0,255)<<16^wn(255*zn.g,0,255)<<8^wn(255*zn.b,0,255)<<0}getHexString(e=Ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=zt){Un.fromWorkingColorSpace(Wn(this,zn),t);const n=zn.r,i=zn.g,r=zn.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=On("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case ue:e.x=e.x<0?0:1;break;case de:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case he:e.y=e.y-Math.floor(e.y);break;case ue:e.y=e.y<0?0:1;break;case de:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}Kn.DEFAULT_IMAGE=null,Kn.DEFAULT_MAPPING=re,Kn.prototype.isTexture=!0;class Qn{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)a&&e>y?ey?a=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*d-l*u,e[t+1]=a*p+c*u+l*h-o*d,e[t+2]=l*p+c*d+o*u-a*h,e[t+3]=c*p-o*h-a*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=n+o+h;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}si.prototype.isQuaternion=!0;class oi{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(li.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(li.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=a*t+s*i-o*n,c=a*n+o*t-r*i,h=a*i+r*n-s*t,u=-r*t-s*n-o*i;return this.x=l*a+u*-r+c*-o-h*-s,this.y=c*a+u*-s+h*-r-l*-o,this.z=h*a+u*-o+l*-s-c*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ai.copy(this).projectOnVector(e),this.sub(ai)}reflect(e){return this.sub(ai.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(wn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}oi.prototype.isVector3=!0;const ai=new oi,li=new si;class ci{constructor(e=new oi(1/0,1/0,1/0),t=new oi(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.length;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=e.count;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,s,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ui),ui.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(vi),xi.subVectors(this.max,vi),pi.subVectors(e.a,vi),fi.subVectors(e.b,vi),mi.subVectors(e.c,vi),gi.subVectors(fi,pi),yi.subVectors(mi,fi),_i.subVectors(pi,mi);let t=[0,-gi.z,gi.y,0,-yi.z,yi.y,0,-_i.z,_i.y,gi.z,0,-gi.x,yi.z,0,-yi.x,_i.z,0,-_i.x,-gi.y,gi.x,0,-yi.y,yi.x,0,-_i.y,_i.x,0];return!!Mi(t,pi,fi,mi,xi)&&(t=[1,0,0,0,1,0,0,0,1],!!Mi(t,pi,fi,mi,xi)&&(bi.crossVectors(gi,yi),t=[bi.x,bi.y,bi.z],Mi(t,pi,fi,mi,xi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ui.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ui).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(hi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ci.prototype.isBox3=!0;const hi=[new oi,new oi,new oi,new oi,new oi,new oi,new oi,new oi],ui=new oi,di=new ci,pi=new oi,fi=new oi,mi=new oi,gi=new oi,yi=new oi,_i=new oi,vi=new oi,xi=new oi,bi=new oi,wi=new oi;function Mi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){wi.fromArray(e,s);const o=r.x*Math.abs(wi.x)+r.y*Math.abs(wi.y)+r.z*Math.abs(wi.z),a=t.dot(wi),l=n.dot(wi),c=i.dot(wi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Si=new ci,Ei=new oi,Ti=new oi,Ai=new oi;class Ci{constructor(e=new oi,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Si.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ai.subVectors(e,this.center);const t=Ai.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ai.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?Ti.set(0,0,1).multiplyScalar(e.radius):Ti.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ei.copy(e.center).add(Ti)),this.expandByPoint(Ei.copy(e.center).sub(Ti)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Li=new oi,Ri=new oi,Pi=new oi,Di=new oi,Ii=new oi,Oi=new oi,ki=new oi;class Ni{constructor(e=new oi,t=new oi(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Li.copy(this.direction).multiplyScalar(t).add(this.origin),Li.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ri.copy(e).add(t).multiplyScalar(.5),Pi.copy(t).sub(e).normalize(),Di.copy(this.origin).sub(Ri);const r=.5*e.distanceTo(t),s=-this.direction.dot(Pi),o=Di.dot(this.direction),a=-Di.dot(Pi),l=Di.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const e=1/c;h*=e,u*=e,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Pi).multiplyScalar(u).add(Ri),d}intersectSphere(e,t){Li.subVectors(e.center,this.origin);const n=Li.dot(this.direction),i=Li.dot(Li)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,s=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,s=(e.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(o=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Li)}intersectTriangle(e,t,n,i,r){Ii.subVectors(t,e),Oi.subVectors(n,e),ki.crossVectors(Ii,Oi);let s,o=this.direction.dot(ki);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Di.subVectors(this.origin,e);const a=s*this.direction.dot(Oi.crossVectors(Di,Oi));if(a<0)return null;const l=s*this.direction.dot(Ii.cross(Di));if(l<0)return null;if(a+l>o)return null;const c=-s*Di.dot(ki);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Bi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,o,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Bi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ui.setFromMatrixColumn(e,0).length(),r=1/Ui.setFromMatrixColumn(e,1).length(),s=1/Ui.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zi,e,Hi)}lookAt(e,t,n){const i=this.elements;return Wi.subVectors(e,t),0===Wi.lengthSq()&&(Wi.z=1),Wi.normalize(),Gi.crossVectors(n,Wi),0===Gi.lengthSq()&&(1===Math.abs(n.z)?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),Gi.crossVectors(n,Wi)),Gi.normalize(),Vi.crossVectors(Wi,Gi),i[0]=Gi.x,i[4]=Vi.x,i[8]=Wi.x,i[1]=Gi.y,i[5]=Vi.y,i[9]=Wi.y,i[2]=Gi.z,i[6]=Vi.z,i[10]=Wi.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],y=n[3],_=n[7],v=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],C=i[13],L=i[2],R=i[6],P=i[10],D=i[14],I=i[3],O=i[7],k=i[11],N=i[15];return r[0]=s*b+o*E+a*L+l*I,r[4]=s*w+o*T+a*R+l*O,r[8]=s*M+o*A+a*P+l*k,r[12]=s*S+o*C+a*D+l*N,r[1]=c*b+h*E+u*L+d*I,r[5]=c*w+h*T+u*R+d*O,r[9]=c*M+h*A+u*P+d*k,r[13]=c*S+h*C+u*D+d*N,r[2]=p*b+f*E+m*L+g*I,r[6]=p*w+f*T+m*R+g*O,r[10]=p*M+f*A+m*P+g*k,r[14]=p*S+f*C+m*D+g*N,r[3]=y*b+_*E+v*L+x*I,r[7]=y*w+_*T+v*R+x*O,r[11]=y*M+_*A+v*P+x*k,r[15]=y*S+_*C+v*D+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-i*l*h-r*o*u+n*l*u+i*o*d-n*a*d)+e[7]*(+t*a*d-t*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*u+i*s*h-n*s*u+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=h*m*l-f*u*l+f*a*d-o*m*d-h*a*g+o*u*g,_=p*u*l-c*m*l-p*a*d+s*m*d+c*a*g-s*u*g,v=c*f*l-p*h*l+p*o*d-s*f*d-c*o*g+s*h*g,x=p*h*a-c*f*a-p*o*u+s*f*u+c*o*m-s*h*m,b=t*y+n*_+i*v+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,e[2]=(o*m*r-f*a*r+f*i*l-n*m*l-o*i*g+n*a*g)*w,e[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*w,e[4]=_*w,e[5]=(c*m*r-p*u*r+p*i*d-t*m*d-c*i*g+t*u*g)*w,e[6]=(p*a*r-s*m*r-p*i*l+t*m*l+s*i*g-t*a*g)*w,e[7]=(s*u*r-c*a*r+c*i*l-t*u*l-s*i*d+t*a*d)*w,e[8]=v*w,e[9]=(p*h*r-c*f*r-p*n*d+t*f*d+c*n*g-t*h*g)*w,e[10]=(s*f*r-p*o*r+p*n*l-t*f*l-s*n*g+t*o*g)*w,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*d-t*o*d)*w,e[12]=x*w,e[13]=(c*f*i-p*h*i+p*n*u-t*f*u-c*n*m+t*h*m)*w,e[14]=(p*o*i-s*f*i-p*n*a+t*f*a+s*n*m-t*o*m)*w,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=o*h,y=a*l,_=a*c,v=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+v)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(u+g))*b,i[6]=(m+y)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-y)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ui.set(i[0],i[1],i[2]).length();const s=Ui.set(i[4],i[5],i[6]).length(),o=Ui.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Fi.copy(this);const a=1/r,l=1/s,c=1/o;return Fi.elements[0]*=a,Fi.elements[1]*=a,Fi.elements[2]*=a,Fi.elements[4]*=l,Fi.elements[5]*=l,Fi.elements[6]*=l,Fi.elements[8]*=c,Fi.elements[9]*=c,Fi.elements[10]*=c,t.setFromRotationMatrix(Fi),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,s){const o=this.elements,a=1/(t-e),l=1/(n-i),c=1/(s-r),h=(t+e)*a,u=(n+i)*l,d=(s+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Bi.prototype.isMatrix4=!0;const Ui=new oi,Fi=new Bi,zi=new oi(0,0,0),Hi=new oi(1,1,1),Gi=new oi,Vi=new oi,Wi=new oi,ji=new Bi,qi=new si;class Xi{constructor(e=0,t=0,n=0,i=Xi.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(wn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-wn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(wn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-wn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(wn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-wn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ji.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ji,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qi.setFromEuler(this),this.setFromQuaternion(qi,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xi.prototype.isEuler=!0,Xi.DefaultOrder="XYZ",Xi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ji{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){cr.subVectors(i,t),hr.subVectors(n,t),ur.subVectors(e,t);const s=cr.dot(cr),o=cr.dot(hr),a=cr.dot(ur),l=hr.dot(hr),c=hr.dot(ur),h=s*l-o*o;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,dr),dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getUV(e,t,n,i,r,s,o,a){return this.getBarycoord(e,t,n,i,dr),a.set(0,0),a.addScaledVector(r,dr.x),a.addScaledVector(s,dr.y),a.addScaledVector(o,dr.z),a}static isFrontFacing(e,t,n,i){return cr.subVectors(n,t),hr.subVectors(e,t),cr.cross(hr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return cr.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),.5*cr.cross(hr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return vr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return vr.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;pr.subVectors(i,n),fr.subVectors(r,n),gr.subVectors(e,n);const a=pr.dot(gr),l=fr.dot(gr);if(a<=0&&l<=0)return t.copy(n);yr.subVectors(e,i);const c=pr.dot(yr),h=fr.dot(yr);if(c>=0&&h<=c)return t.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(pr,s);_r.subVectors(e,r);const d=pr.dot(_r),p=fr.dot(_r);if(p>=0&&d<=p)return t.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(fr,o);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return mr.subVectors(r,i),o=(h-c)/(h-c+(d-p)),t.copy(i).addScaledVector(mr,o);const g=1/(m+f+u);return s=f*g,o=u*g,t.copy(n).addScaledVector(pr,s).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let xr=0;class br extends gn{constructor(){super(),Object.defineProperty(this,"id",{value:xr++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=O,this.blendDst=k,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=nn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gt,this.stencilZFail=Gt,this.stencilZPass=Gt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===y;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==f&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}br.prototype.isMaterial=!0,br.fromType=function(){return null};class wr extends br{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}wr.prototype.isMeshBasicMaterial=!0;const Mr=new oi,Sr=new Ln;class Er{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(r),!1===e.ray.intersectsSphere(qr))return;if(Wr.copy(r).invert(),jr.copy(e.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===jr.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:os.clone(),object:e}}(e,t,n,i,Xr,Jr,Yr,ss);if(p){a&&(ns.fromBufferAttribute(a,c),is.fromBufferAttribute(a,h),rs.fromBufferAttribute(a,u),p.uv=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln)),l&&(ns.fromBufferAttribute(l,c),is.fromBufferAttribute(l,h),rs.fromBufferAttribute(l,u),p.uv2=vr.getUV(ss,Xr,Jr,Yr,ns,is,rs,new Ln));const e={a:c,b:h,c:u,normal:new oi,materialIndex:0};vr.getNormal(Xr,Jr,Yr,e.normal),p.face=e}return p}as.prototype.isMesh=!0;class cs extends Vr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,n,i,r,s,p,f,m,g,y){const _=s/m,v=p/g,x=s/2,b=p/2,w=f/2,M=m+1,S=g+1;let E=0,T=0;const A=new oi;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),E+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}ps.prototype.isShaderMaterial=!0;class fs extends lr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Bi,this.projectionMatrix=new Bi,this.projectionMatrixInverse=new Bi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}fs.prototype.isCamera=!0;class ms extends fs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*xn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*vn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*xn*Math.atan(Math.tan(.5*vn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*vn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}ms.prototype.isPerspectiveCamera=!0;const gs=90;class ys extends lr{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ms(gs,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new oi(1,0,0)),this.add(i);const r=new ms(gs,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new oi(-1,0,0)),this.add(r);const s=new ms(gs,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new oi(0,1,0)),this.add(s);const o=new ms(gs,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new oi(0,-1,0)),this.add(o);const a=new ms(gs,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new oi(0,0,1)),this.add(a);const l=new ms(gs,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new oi(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,c=e.getRenderTarget(),h=e.toneMapping,u=e.xr.enabled;e.toneMapping=Q,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=h,e.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class _s extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:se,n,i,r,s,o,a,l,c),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}_s.prototype.isCubeTexture=!0;class vs extends $n{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new _s(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:_e}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new cs(5,5,5),o=new ps({name:"CubemapFromEquirect",uniforms:hs(n),vertexShader:i,fragmentShader:r,side:m,blending:v});o.uniforms.tEquirect.value=t;const a=new as(s,o),l=t.minFilter;return t.minFilter===be&&(t.minFilter=_e),new ys(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}vs.prototype.isWebGLCubeRenderTarget=!0;const xs=new oi,bs=new oi,ws=new Rn;class Ms{constructor(e=new oi(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=xs.subVectors(n,t).cross(bs.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(xs),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ws.getNormalMatrix(e),i=this.coplanarPoint(xs).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Ms.prototype.isPlane=!0;const Ss=new Ci,Es=new oi;class Ts{constructor(e=new Ms,t=new Ms,n=new Ms,i=new Ms,r=new Ms,s=new Ms){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],_=n[15];return t[0].setComponents(o-i,h-a,f-u,_-m).normalize(),t[1].setComponents(o+i,h+a,f+u,_+m).normalize(),t[2].setComponents(o+r,h+l,f+d,_+g).normalize(),t[3].setComponents(o-r,h-l,f-d,_-g).normalize(),t[4].setComponents(o-s,h-c,f-p,_-y).normalize(),t[5].setComponents(o+s,h+c,f+p,_+y).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ss.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(e){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Es.y=i.normal.y>0?e.max.y:e.min.y,Es.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Es)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Cs(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 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}\nfloat 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}\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\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; }\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 color ) { return dot( color, vec3( 0.3333 ) ); }\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};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.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}",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\tvec2 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 r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), 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_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 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, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( 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}",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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\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 )\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 )\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:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, 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#if defined( 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, 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#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\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\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_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\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 ( PHYSICALLY_CORRECT_LIGHTS )\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#else\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#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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\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 GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\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 GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\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_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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\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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, 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, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( 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, geometry, 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, geometry, 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\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\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 ], geometry.normal );\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, vUv2 );\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( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\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#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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\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_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\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, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\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\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\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 = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\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 OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - 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_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, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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\tvarying vec4 vSpotShadowCoord[ 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#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\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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, vSpotShadowCoord[ 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\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\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, vUv );\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 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}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\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\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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\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;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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, vUv2 );\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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \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 + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Ps={common:{diffuse:{value:new jn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Rn},uv2Transform:{value:new Rn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Ln(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new jn(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 jn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}},sprite:{diffuse:{value:new jn(16777215)},opacity:{value:1},center:{value:new Ln(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Rn}}},Ds={basic:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.fog]),vertexShader:Rs.meshbasic_vert,fragmentShader:Rs.meshbasic_frag},lambert:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshlambert_vert,fragmentShader:Rs.meshlambert_frag},phong:{uniforms:us([Ps.common,Ps.specularmap,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},specular:{value:new jn(1118481)},shininess:{value:30}}]),vertexShader:Rs.meshphong_vert,fragmentShader:Rs.meshphong_frag},standard:{uniforms:us([Ps.common,Ps.envmap,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.roughnessmap,Ps.metalnessmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag},toon:{uniforms:us([Ps.common,Ps.aomap,Ps.lightmap,Ps.emissivemap,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.gradientmap,Ps.fog,Ps.lights,{emissive:{value:new jn(0)}}]),vertexShader:Rs.meshtoon_vert,fragmentShader:Rs.meshtoon_frag},matcap:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,Ps.fog,{matcap:{value:null}}]),vertexShader:Rs.meshmatcap_vert,fragmentShader:Rs.meshmatcap_frag},points:{uniforms:us([Ps.points,Ps.fog]),vertexShader:Rs.points_vert,fragmentShader:Rs.points_frag},dashed:{uniforms:us([Ps.common,Ps.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Rs.linedashed_vert,fragmentShader:Rs.linedashed_frag},depth:{uniforms:us([Ps.common,Ps.displacementmap]),vertexShader:Rs.depth_vert,fragmentShader:Rs.depth_frag},normal:{uniforms:us([Ps.common,Ps.bumpmap,Ps.normalmap,Ps.displacementmap,{opacity:{value:1}}]),vertexShader:Rs.meshnormal_vert,fragmentShader:Rs.meshnormal_frag},sprite:{uniforms:us([Ps.sprite,Ps.fog]),vertexShader:Rs.sprite_vert,fragmentShader:Rs.sprite_frag},background:{uniforms:{uvTransform:{value:new Rn},t2D:{value:null}},vertexShader:Rs.background_vert,fragmentShader:Rs.background_frag},cube:{uniforms:us([Ps.envmap,{opacity:{value:1}}]),vertexShader:Rs.cube_vert,fragmentShader:Rs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Rs.equirect_vert,fragmentShader:Rs.equirect_frag},distanceRGBA:{uniforms:us([Ps.common,Ps.displacementmap,{referencePosition:{value:new oi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Rs.distanceRGBA_vert,fragmentShader:Rs.distanceRGBA_frag},shadow:{uniforms:us([Ps.lights,Ps.fog,{color:{value:new jn(0)},opacity:{value:1}}]),vertexShader:Rs.shadow_vert,fragmentShader:Rs.shadow_frag}};function Is(e,t,n,i,r,s){const o=new jn(0);let a,l,c=!0===r?0:1,h=null,u=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,p(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,p(o,c)},render:function(n,r){let s=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const y=e.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(g=null),null===g?p(o,c):g&&g.isColor&&(p(g,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===ce)?(void 0===l&&(l=new as(new cs(1,1,1),new ps({name:"BackgroundCubeMaterial",uniforms:hs(Ds.cube.uniforms),vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,h===g&&u===g.version&&d===e.toneMapping||(l.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new as(new Ls(2,2),new ps({name:"BackgroundMaterial",uniforms:hs(Ds.background.uniforms),vertexShader:Ds.background.vertexShader,fragmentShader:Ds.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&u===g.version&&d===e.toneMapping||(a.material.needsUpdate=!0,h=g,u=g.version,d=e.toneMapping),a.layers.enableAll(),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Os(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},l=p(null);let c=l,h=!1;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){const t=[],n=[],i=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return c.attributesNum!==o||c.index!==i}(r,v,d,x),b&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const a=n.getAttributes();for(const t in a)if(a[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}c.attributes=r,c.attributesNum=o,c.index=i}(r,v,d,x)}else{const e=!0===l.wireframe;c.geometry===v.id&&c.program===d.id&&c.wireframe===e||(c.geometry=v.id,c.program=d.id,c.wireframe=e,b=!0)}null!==x&&n.update(x,34963),(b||h)&&(h=!1,function(r,s,o,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();const l=a.attributes,c=o.getAttributes(),h=s.defaultAttributeValues;for(const t in c){const i=c[t];if(i.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,o=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=s||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),y=e.getParameter(36349),_=u>0,v=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:_,floatFragmentTextures:v,floatVertexTextures:_&&v,maxSamples:s?e.getParameter(36183):0}}function Bs(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new Ms,a=new Rn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function h(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length0){const o=new vs(s.height/2);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Ds.physical={uniforms:us([Ds.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ln(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new jn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ln},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new jn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new jn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Rs.meshphysical_vert,fragmentShader:Rs.meshphysical_frag};class Fs extends fs{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Fs.prototype.isOrthographicCamera=!0;const zs=[.125,.215,.35,.446,.526,.582],Hs=new Fs,Gs=new jn;let Vs=null;const Ws=(1+Math.sqrt(5))/2,js=1/Ws,qs=[new oi(1,1,1),new oi(-1,1,1),new oi(1,1,-1),new oi(-1,1,-1),new oi(0,Ws,js),new oi(0,Ws,-js),new oi(js,0,Ws),new oi(-js,0,Ws),new oi(Ws,js,0),new oi(-Ws,js,0)];class Xs{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Vs=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ks(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Zs(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?a=zs[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,y=new Float32Array(f*p*d),_=new Float32Array(m*p*d),v=new Float32Array(g*p*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];y.set(i,f*p*e),_.set(u,m*p*e);const r=[e,e,e,e,e,e];v.set(r,g*p*e)}const x=new Vr;x.setAttribute("position",new Er(y,f)),x.setAttribute("uv",new Er(_,m)),x.setAttribute("faceIndex",new Er(v,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new oi(0,1,0);return new ps({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new as(this._lodPlanes[0],e);this._renderer.compile(t,Hs)}_sceneToCubeUV(e,t,n,i){const r=new ms(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(Gs),a.toneMapping=Q,a.autoClear=!1;const h=new wr({name:"PMREM.Background",side:m,depthWrite:!1,depthTest:!1}),u=new as(new cs,h);let d=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(Gs),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Ys(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(e,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===se||e.mapping===oe;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ks()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Zs());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new as(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Ys(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Hs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ey-4?i-y+4:0),4*(this._cubeSize-_),3*_,2*_),a.setRenderTarget(t),a.render(c,Hs)}}function Js(e,t,n){const i=new $n(e,t,n);return i.texture.mapping=ce,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ys(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Zs(){return new ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\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",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 \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:v,depthTest:!1,depthWrite:!1})}function Ks(){return new ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\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",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:v,depthTest:!1,depthWrite:!1})}function Qs(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ae||s===le,a=s===se||s===oe;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new Xs(e)),i=o?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new Xs(e));const s=o?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function $s(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function eo(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);const m=new Float32Array(p*f*4*r),g=new ei(m,p,f,r);g.type=Le,g.needsUpdate=!0;const y=4*d;for(let t=0;t0)return e;const r=t*n;let s=po[r];if(void 0===s&&(s=new Float32Array(r),po[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function vo(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function wa(e){return e.replace(ba,Ma)}function Ma(e,t){const n=Rs[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return wa(n)}const Sa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ea=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ta(e){return e.replace(Ea,Ca).replace(Sa,Aa)}function Aa(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ca(0,t,n,i)}function Ca(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(v+="\n"),x=[g,y].filter(_a).join("\n"),x.length>0&&(x+="\n")):(v=[La(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(_a).join("\n"),x=[g,La(n),"#define SHADER_NAME "+n.shaderName,y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Rs.tonemapping_pars_fragment:"",n.toneMapping!==Q?ya("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Rs.encodings_pars_fragment,ga("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_a).join("\n")),o=wa(o),o=va(o,n),o=xa(o,n),a=wa(a),a=va(a,n),a=xa(a,n),o=Ta(o),a=Ta(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+v,x=["#define varying in",n.glslVersion===fn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,M=pa(r,35633,b+v+o),S=pa(r,35632,w);if(r.attachShader(_,M),r.attachShader(_,S),void 0!==n.index0AttributeName?r.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(_).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(_,35714)){i=!1;const t=ma(r,M,"vertex"),n=ma(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:v},fragmentShader:{log:n,prefix:x}})}let E,T;return r.deleteShader(M),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new da(r,_)),E},this.getAttributes=function(){return void 0===T&&(T=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,k=s.clearcoat>0;return{isWebGL2:h,shaderID:E,shaderName:s.type,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:P,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:d,outputEncoding:null===I?e.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:Dt,map:!!s.map,matcap:!!s.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===Bt,tangentSpaceNormalMap:s.normalMapType===Nt,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===It,clearcoat:k,clearcoatMap:k&&!!s.clearcoatMap,clearcoatRoughnessMap:k&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:k&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===x,alphaMap:!!s.alphaMap,alphaTest:O,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:A,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===g,flipSided:s.side===m,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0),t.supportsVertexTextures&&a.enable(1),t.instancing&&a.enable(2),t.instancingColor&&a.enable(3),t.map&&a.enable(4),t.matcap&&a.enable(5),t.envMap&&a.enable(6),t.lightMap&&a.enable(7),t.aoMap&&a.enable(8),t.emissiveMap&&a.enable(9),t.bumpMap&&a.enable(10),t.normalMap&&a.enable(11),t.objectSpaceNormalMap&&a.enable(12),t.tangentSpaceNormalMap&&a.enable(13),t.clearcoat&&a.enable(14),t.clearcoatMap&&a.enable(15),t.clearcoatRoughnessMap&&a.enable(16),t.clearcoatNormalMap&&a.enable(17),t.displacementMap&&a.enable(18),t.specularMap&&a.enable(19),t.roughnessMap&&a.enable(20),t.metalnessMap&&a.enable(21),t.gradientMap&&a.enable(22),t.alphaMap&&a.enable(23),t.alphaTest&&a.enable(24),t.vertexColors&&a.enable(25),t.vertexAlphas&&a.enable(26),t.vertexUvs&&a.enable(27),t.vertexTangents&&a.enable(28),t.uvsVertexOnly&&a.enable(29),t.fog&&a.enable(30),e.push(a.mask),a.disableAll(),t.useFog&&a.enable(0),t.flatShading&&a.enable(1),t.logarithmicDepthBuffer&&a.enable(2),t.skinning&&a.enable(3),t.morphTargets&&a.enable(4),t.morphNormals&&a.enable(5),t.morphColors&&a.enable(6),t.premultipliedAlpha&&a.enable(7),t.shadowMapEnabled&&a.enable(8),t.physicallyCorrectLights&&a.enable(9),t.doubleSided&&a.enable(10),t.flipSided&&a.enable(11),t.useDepthPacking&&a.enable(12),t.dithering&&a.enable(13),t.specularIntensityMap&&a.enable(14),t.specularColorMap&&a.enable(15),t.transmission&&a.enable(16),t.transmissionMap&&a.enable(17),t.thicknessMap&&a.enable(18),t.sheen&&a.enable(19),t.sheenColorMap&&a.enable(20),t.sheenRoughnessMap&&a.enable(21),t.decodeVideoTexture&&a.enable(22),t.opaque&&a.enable(23),e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Ds[t];n=ds.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=c.length;e0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Na),i.length>1&&i.sort(t||Ba),r.length>1&&r.sort(t||Ba)}}}function Fa(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Ua,e.set(t,[i])):n>=e.get(t).length?(i=new Ua,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function za(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new oi,color:new jn};break;case"SpotLight":n={position:new oi,direction:new oi,color:new jn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oi,color:new jn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oi,skyColor:new jn,groundColor:new jn};break;case"RectAreaLight":n={color:new jn,position:new oi,halfWidth:new oi,halfHeight:new oi}}return e[t.id]=n,n}}}let Ha=0;function Ga(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Va(e,t){const n=new za,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ln,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new oi);const s=new oi,o=new Bi,a=new Bi;return{setup:function(s,o){let a=0,l=0,c=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,m=0,g=0,y=0;s.sort(Ga);const _=!0!==o?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ps.LTC_FLOAT_1,r.rectAreaLTC2=Ps.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ps.LTC_HALF_1,r.rectAreaLTC2=Ps.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=c;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===m&&v.numPointShadows===g&&v.numSpotShadows===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=y,v.directionalLength=h,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=m,v.numPointShadows=g,v.numSpotShadows=y,r.version=Ha++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,h=0;const u=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(s=new Wa(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class qa extends br{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Ot,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}qa.prototype.isMeshDepthMaterial=!0;class Xa extends br{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new oi,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Ja(e,t,n){let i=new Ts;const r=new Ln,s=new Ln,o=new Qn,a=new qa({depthPacking:kt}),l=new Xa,c={},h=n.maxTextureSize,d={0:m,1:f,2:g},y=new ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ln},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 \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}"}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const x=new Vr;x.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new as(x,y),w=this;function M(n,i){const r=t.update(b);y.defines.VSM_SAMPLES!==n.blurSamples&&(y.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),y.uniforms.shadow_pass.value=n.map.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,y,b,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,b,null)}function S(t,n,i,r,s,o){let h=null;const u=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==u?u:!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const e=h.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=h.clone(),i[t]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=o===p?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=s),h}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===p)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let l=0,c=t.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null!==u.map||u.isPointLightShadow||this.type!==p||(u.map=new $n(r.x,r.y),u.map.texture.name=c.name+".shadowMap",u.mapPass=new $n(r.x,r.y),u.camera.updateProjectionMatrix()),null===u.map){const e={minFilter:pe,magFilter:pe,format:Ne};u.map=new $n(r.x,r.y,e),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const m=u.getViewportCount();for(let e=0;e=1):-1!==he.indexOf("OpenGL ES")&&(ce=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),le=ce>=2);let ue=null,de={};const pe=e.getParameter(3088),fe=e.getParameter(2978),me=(new Qn).fromArray(pe),ge=(new Qn).fromArray(fe);function ye(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?An:Math.floor,s=i(r*e.width),o=i(r*e.height);void 0===m&&(m=_(s,o));const a=n?_(s,o):m;return a.width=s,a.height=o,a.getContext("2d").drawImage(e,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+o+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function x(e){return En(e.width)&&En(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==pe&&e.minFilter!==_e}function w(t){e.generateMipmap(t)}function M(n,i,r,s,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===It&&!1===o?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||t.get("EXT_color_buffer_float"),l}function S(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==pe&&e.minFilter!==_e?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function E(e){return e===pe||e===fe||e===ge?9728:9729}function T(e){const t=e.target;t.removeEventListener("dispose",T),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=g.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&C(e),0===Object.keys(r).length&&g.delete(n)}i.remove(e)}(t),t.isVideoTexture&&f.delete(t)}function A(t){const n=t.target;n.removeEventListener("dispose",A),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&r.__version!==e.version){const n=e.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void k(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}const P={[he]:10497,[ue]:33071,[de]:33648},D={[pe]:9728,[fe]:9984,[ge]:9986,[_e]:9729,[ve]:9985,[be]:9987};function I(n,s,o){if(o?(e.texParameteri(n,10242,P[s.wrapS]),e.texParameteri(n,10243,P[s.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[s.wrapR]),e.texParameteri(n,10240,D[s.magFilter]),e.texParameteri(n,10241,D[s.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),s.wrapS===ue&&s.wrapT===ue||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,E(s.magFilter)),e.texParameteri(n,10241,E(s.minFilter)),s.minFilter!==pe&&s.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const o=t.get("EXT_texture_filter_anisotropic");if(s.type===Le&&!1===t.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Re&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function O(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let s=g.get(r);void 0===s&&(s={},g.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&C(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function k(t,i,r){let o=3553;i.isDataArrayTexture&&(o=35866),i.isData3DTexture&&(o=32879);const l=O(t,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),c.version!==c.__currentVersion||!0===l){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=function(e){return!a&&(e.wrapS!==ue||e.wrapT!==ue||e.minFilter!==pe&&e.minFilter!==_e)}(i)&&!1===x(i.image);let u=v(i.image,r,!1,h);u=H(i,u);const d=x(u)||a,p=s.convert(i.format,i.encoding);let f,m=s.convert(i.type),g=M(i.internalFormat,p,m,i.encoding,i.isVideoTexture);I(o,i,d);const y=i.mipmaps,_=a&&!0!==i.isVideoTexture,E=void 0===t.__version||!0===l,T=S(i,u,d);if(i.isDepthTexture)g=6402,a?g=i.type===Le?36012:i.type===Ce?33190:i.type===Ie?35056:33189:i.type===Le&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Fe&&6402===g&&i.type!==Te&&i.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Te,m=s.convert(i.type)),i.format===ze&&6402===g&&(g=34041,i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ie,m=s.convert(i.type))),E&&(_?n.texStorage2D(3553,1,g,u.width,u.height):n.texImage2D(3553,0,g,u.width,u.height,0,p,m,null));else if(i.isDataTexture)if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e>=1,t>>=1}}else if(y.length>0&&d){_&&E&&n.texStorage2D(3553,T,g,y[0].width,y[0].height);for(let e=0,t=y.length;e0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,n){const i=e.encoding,r=e.format,s=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===mn||i!==Dt&&(i===It?!1===a?!0===t.has("EXT_sRGB")&&r===Ne?(e.format=mn,e.minFilter=_e,e.generateMipmaps=!1):n=Xn.sRGBToLinear(n):r===Ne&&s===Me||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const e=L;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?k(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(t,r){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;const o=O(t,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===o){e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,o=i.image[0]&&i.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)h[e]=r||o?o?i.image[e].image:i.image[e]:v(i.image[e],!1,!0,c),h[e]=H(i,h[e]);const u=h[0],d=x(u)||a,p=s.convert(i.format,i.encoding),f=s.convert(i.type),m=M(i.internalFormat,p,f,i.encoding),g=a&&!0!==i.isVideoTexture,y=void 0===t.__version;let _,E=S(i,u,d);if(I(34067,i,d),r){g&&y&&n.texStorage2D(34067,E,m,u.width,u.height);for(let e=0;e<6;e++){_=h[e].mipmaps;for(let t=0;t<_.length;t++){const r=_[t];i.format!==Ne?null!==p?g?n.compressedTexSubImage2D(34069+e,t,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+e,t,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+e,t,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+e,t,m,r.width,r.height,0,p,f,r.data)}}}else{_=i.mipmaps,g&&y&&(_.length>0&&E++,n.texStorage2D(34067,E,m,h[0].width,h[0].height));for(let e=0;e<6;e++)if(o){g?n.texSubImage2D(34069+e,0,0,0,h[e].width,h[e].height,p,f,h[e].data):n.texImage2D(34069+e,0,m,h[e].width,h[e].height,0,p,f,h[e].data);for(let t=0;t<_.length;t++){const i=_[t].image[e].image;g?n.texSubImage2D(34069+e,t+1,0,0,i.width,i.height,p,f,i.data):n.texImage2D(34069+e,t+1,m,i.width,i.height,0,p,f,i.data)}}else{g?n.texSubImage2D(34069+e,0,0,0,p,f,h[e]):n.texImage2D(34069+e,0,m,p,f,h[e]);for(let t=0;t<_.length;t++){const i=_[t];g?n.texSubImage2D(34069+e,t+1,0,0,p,f,i.image[e]):n.texImage2D(34069+e,t+1,m,p,f,i.image[e])}}}b(i,d)&&w(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){const r=i.get(e);void 0!==t&&N(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&U(e)},this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),h=i.get(l);t.addEventListener("dispose",A),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=l.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=x(t)||a;if(u){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else if(c.__webglFramebuffer=e.createFramebuffer(),d)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;t0&&!1===z(t)){c.__webglMultisampledFramebuffer=e.createFramebuffer(),c.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),o=M(l.internalFormat,i,r,l.encoding),a=F(t);e.renderbufferStorageMultisample(36161,a,o,t.width,t.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(c.__webglDepthRenderbuffer=e.createRenderbuffer(),B(c.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),I(34067,l,p);for(let e=0;e<6;e++)N(c.__webglFramebuffer[e],t,l,36064,34069+e);b(l,p)&&w(34067),n.unbindTexture()}else if(d){const e=t.texture;for(let r=0,s=e.length;r0&&!1===z(t)){const r=t.width,s=t.height;let o=16384;const a=[36064],l=t.stencilBuffer?33306:36096;t.depthBuffer&&a.push(l);const c=i.get(t),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(e.invalidateFramebuffer(36008,[l]),e.invalidateFramebuffer(36009,[l])),e.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),p&&e.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=N,this.useMultisampledRTT=z}function Ka(e,t,n){const i=n.isWebGL2;return{convert:function(n,r=null){let s;if(n===Me)return 5121;if(n===Pe)return 32819;if(n===De)return 32820;if(n===Se)return 5120;if(n===Ee)return 5122;if(n===Te)return 5123;if(n===Ae)return 5124;if(n===Ce)return 5125;if(n===Le)return 5126;if(n===Re)return i?5131:(s=t.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(n===Oe)return 6406;if(n===Ne)return 6408;if(n===Be)return 6409;if(n===Ue)return 6410;if(n===Fe)return 6402;if(n===ze)return 34041;if(n===He)return 6403;if(n===ke)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===mn)return s=t.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(n===Ge)return 36244;if(n===Ve)return 33319;if(n===We)return 33320;if(n===je)return 36249;if(n===qe||n===Xe||n===Je||n===Ye)if(r===It){if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(n===qe)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=t.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(n===qe)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xe)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Je)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ye)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ze||n===Ke||n===Qe||n===$e){if(s=t.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(n===Ze)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ke)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Qe)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===$e)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===et)return s=t.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===tt||n===nt){if(s=t.get("WEBGL_compressed_texture_etc"),null===s)return null;if(n===tt)return r===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===nt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(n===it||n===rt||n===st||n===ot||n===at||n===lt||n===ct||n===ht||n===ut||n===dt||n===pt||n===ft||n===mt||n===gt){if(s=t.get("WEBGL_compressed_texture_astc"),null===s)return null;if(n===it)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===st)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ot)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===at)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ct)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ht)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ut)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ft)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gt)return r===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===yt){if(s=t.get("EXT_texture_compression_bptc"),null===s)return null;if(n===yt)return r===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Ie?i?34042:(s=t.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}Xa.prototype.isMeshDistanceMaterial=!0;class Qa extends ms{constructor(e=[]){super(),this.cameras=e}}Qa.prototype.isArrayCamera=!0;class $a extends lr{constructor(){super(),this.type="Group"}}$a.prototype.isGroup=!0;const el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $a,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $a,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new oi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new oi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $a,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new oi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new oi),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==o&&(i=t.getPose(e.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el))),l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const e=new $a;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}const r=l.joints[i.jointName];null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class nl extends Kn{constructor(e,t,n,i,r,s,o,a,l,c){if((c=void 0!==c?c:Fe)!==Fe&&c!==ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Fe&&(n=Te),void 0===n&&c===ze&&(n=Ie),super(null,i,r,s,o,a,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:pe,this.minFilter=void 0!==a?a:pe,this.flipY=!1,this.generateMipmaps=!1}}nl.prototype.isDepthTexture=!0;class il extends gn{constructor(e,t){super();const n=this;let i=null,r=1,s=null,o="local-floor",a=null,l=null,c=null,h=null,u=null,d=null;const p=t.getContextAttributes();let f=null,m=null;const g=[],y=new Map,_=new ms;_.layers.enable(1),_.viewport=new Qn;const v=new ms;v.layers.enable(2),v.viewport=new Qn;const x=[_,v],b=new Qa;b.layers.enable(1),b.layers.enable(2);let w=null,M=null;function S(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function E(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),w=null,M=null,e.setRenderTarget(f),u=null,h=null,c=null,i=null,m=null,P.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function T(e){const t=i.inputSources;for(let e=0;e0&&(n.alphaTest.value=i.alphaTest);const r=t.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const t=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*t}let s,o;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(e,i):i.isMeshToonMaterial?(n(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(n(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(n(e,i),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===m&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o)):i.isMeshMatcapMaterial?(n(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?n(e,i):i.isMeshDistanceMaterial?(n(e,i),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?n(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function sl(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=On("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,a=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let d=null,p=null;const y=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Dt,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1;const v=this;let x=!1,b=0,w=0,M=null,S=-1,E=null;const T=new Qn,A=new Qn;let C=null,L=t.width,R=t.height,P=1,D=null,I=null;const O=new Qn(0,0,L,R),k=new Qn(0,0,L,R);let N=!1;const B=new Ts;let U=!1,F=!1,z=null;const H=new Bi,G=new Ln,V=new oi,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===M?P:1}let q,X,J,Y,Z,K,$,ee,te,ne,ie,re,se,oe,ae,le,ce,he,ue,de,pe,fe,me,ge=n;function ye(e,n){for(let i=0;i0&&function(e,t,n){const i=X.isWebGL2;null===z&&(z=new $n(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Re:Me,minFilter:be,samples:i&&!0===o?4:0})),v.getDrawingBufferSize(G),i?z.setSize(G.x,G.y):z.setSize(An(G.x),An(G.y));const r=v.getRenderTarget();v.setRenderTarget(z),v.clear();const s=v.toneMapping;v.toneMapping=Q,Ie(e,t,n),v.toneMapping=s,K.updateMultisampleRenderTarget(z),K.updateRenderTargetMipmap(z),v.setRenderTarget(r)}(r,t,n),i&&J.viewport(T.copy(i)),r.length>0&&Ie(r,t,n),s.length>0&&Ie(s,t,n),a.length>0&&Ie(a,t,n),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Ie(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?_[_.length-1]:null,y.pop(),d=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(e,t,n){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=n;const i=Z.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=Z.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){M=e,b=t,w=n;let i=!0;if(e){const t=Z.get(e);void 0!==t.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?K.setupRenderTarget(e):t.__hasExternalTextures&&K.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(e){const n=e.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const i=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?Z.get(e).__webglMultisampledFramebuffer:i,T.copy(e.viewport),A.copy(e.scissor),C=e.scissorTest}else T.copy(O).multiplyScalar(P).floor(),A.copy(k).multiplyScalar(P).floor(),C=N;if(J.bindFramebuffer(36160,r)&&X.drawBuffers&&i&&J.drawBuffers(e,r),J.viewport(T),J.scissor(A),J.setScissorTest(C),s){const i=Z.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(o){const i=Z.get(e.texture),r=t||0;ge.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){J.bindFramebuffer(36160,a);try{const o=e.texture,a=o.format,l=o.type;if(a!==Ne&&fe.convert(a)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Re&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(l===Me||fe.convert(l)===ge.getParameter(35738)||l===Le&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ge.readPixels(t,n,i,r,fe.convert(a),fe.convert(l),s)}finally{const e=null!==M?Z.get(M).__webglFramebuffer:null;J.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);K.setTexture2D(t,0),ge.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,o=fe.convert(n.format),a=fe.convert(n.type);K.setTexture2D(n,0),ge.pixelStorei(37440,n.flipY),ge.pixelStorei(37441,n.premultiplyAlpha),ge.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,i,e.x,e.y,r,s,o,a,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ge.texSubImage2D(3553,i,e.x,e.y,o,a,t.image),0===i&&n.generateMipmaps&&ge.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=fe.convert(i.format),c=fe.convert(i.type);let h;if(i.isData3DTexture)K.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(i,0),h=35866}ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment);const u=ge.getParameter(3314),d=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),m=ge.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ge.pixelStorei(3314,g.width),ge.pixelStorei(32878,g.height),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ge.compressedTexSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,g.data)):ge.texSubImage3D(h,r,t.x,t.y,t.z,s,o,a,l,c,g),ge.pixelStorei(3314,u),ge.pixelStorei(32878,d),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,m),0===r&&i.generateMipmaps&&ge.generateMipmap(h),J.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),J.unbindTexture()},this.resetState=function(){b=0,w=0,M=null,J.reset(),me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sl.prototype.isWebGLRenderer=!0;class ol extends sl{}ol.prototype.isWebGL1Renderer=!0;class al{constructor(e,t=25e-5){this.name="",this.color=new jn(e),this.density=t}clone(){return new al(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}al.prototype.isFogExp2=!0;class ll{constructor(e,t=1,n=1e3){this.name="",this.color=new jn(e),this.near=t,this.far=n}clone(){return new ll(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ll.prototype.isFog=!0;class cl extends lr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}cl.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=rn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:a,point:ml.clone(),uv:vr.getUV(ml,bl,wl,Ml,Sl,El,Tl,new Ln),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Cl(e,t,n,i,r,s){_l.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(vl.x=s*_l.x-r*_l.y,vl.y=r*_l.x+s*_l.y):vl.copy(_l),e.copy(t),e.x+=vl.x,e.y+=vl.y,e.applyMatrix4(xl)}Al.prototype.isSprite=!0;const Ll=new oi,Rl=new oi;class Pl extends lr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){Ll.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);const n=Ll.distanceTo(Rl)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;ia)continue;u.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(u);de.far||t.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;na)continue;u.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}tc.prototype.isLine=!0;const nc=new oi,ic=new oi;class rc extends tc{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dc(e,t,n,i,r,s,o){const a=lc.distanceSqToPoint(e);if(ar.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:o})}}uc.prototype.isPoints=!0;class pc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.minFilter=void 0!==s?s:_e,this.magFilter=void 0!==r?r:_e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}pc.prototype.isVideoTexture=!0;class fc extends Kn{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=pe,this.minFilter=pe,this.generateMipmaps=!1,this.needsUpdate=!0}}fc.prototype.isFramebufferTexture=!0;class mc extends Kn{constructor(e,t,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}mc.prototype.isCompressedTexture=!0;class gc extends Kn{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.needsUpdate=!0}}gc.prototype.isCanvasTexture=!0;class yc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new Ln:new oi);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oi,i=[],r=[],s=[],o=new oi,a=new Bi;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new oi)}r[0]=new oi,s[0]=new oi;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(wn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(wn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _c extends yc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t){const n=t||new Ln,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(bc.subVectors(i[0],i[1]).add(i[0]),o=bc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Tc(o,a.x,l.x,c.x,h.x),Tc(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Fc extends Vr{constructor(e=[new Ln(0,.5),new Ln(.5,0),new Ln(0,-.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=wn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new oi,u=new Ln,d=new oi,p=new oi,f=new oi;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case e.length-1:a.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),a.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){const d=n+r*c*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*f,s.push(h.x,h.y,h.z),u.x=r/t,u.y=n/(e.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*f;l.push(i,c,d)}}for(let n=0;n0&&y(!0),t>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(d,2))}static fromJSON(e){return new Gc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vc extends Gc{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Vc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Wc extends Vr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Wc(e.vertices,e.indices,e.radius,e.details)}}class jc extends Wc{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new jc(e.radius,e.detail)}}const qc=new oi,Xc=new oi,Jc=new oi,Yc=new vr;class Zc extends Vr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(vn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let e=0;e0)for(s=t;s=t;s-=i)o=vh(s,e[s],e[s+1],o);return o&&ph(o,o.next)&&(xh(o),o=o.next),o}function $c(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!ph(i,i.next)&&0!==dh(i.prev,i,i.next))i=i.next;else{if(xh(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function eh(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=lh(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?nh(e,i,r,s):th(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),xh(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?eh(e=ih($c(e),t,n),t,n,i,r,s,2):2===o&&rh(e,t,n,i,r,s):eh($c(e),t,n,i,r,s,1);break}}function th(e){const t=e.prev,n=e,i=e.next;if(dh(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(hh(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&dh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function nh(e,t,n,i){const r=e.prev,s=e,o=e.next;if(dh(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=lh(a,l,t,n,i),d=lh(c,h,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&dh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hh(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&dh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ih(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!ph(r,s)&&fh(r,i,i.next,s)&&yh(r,s)&&yh(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),xh(i),xh(i.next),i=e=s),i=i.next}while(i!==e);return $c(i)}function rh(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&uh(o,e)){let a=_h(o,e);return o=$c(o,o.next),a=$c(a,a.next),eh(o,t,n,i,r,s),void eh(a,t,n,i,r,s)}e=e.next}o=o.next}while(o!==e)}function sh(e,t){return e.x-t.x}function oh(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>o){if(o=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&hh(rs.x||n.x===s.x&&ah(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}(e,t)){const n=_h(t,e);$c(t,t.next),$c(n,n.next)}}function ah(e,t){return dh(e.prev,e,t.prev)<0&&dh(t.next,e,e.next)<0}function lh(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ch(e){let t=e,n=e;do{(t.x=0&&(e-o)*(i-a)-(n-o)*(t-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function uh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&fh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(yh(e,t)&&yh(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(dh(e.prev,e,t.prev)||dh(e,t.prev,t))||ph(e,t)&&dh(e.prev,e,e.next)>0&&dh(t.prev,t,t.next)>0)}function dh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ph(e,t){return e.x===t.x&&e.y===t.y}function fh(e,t,n,i){const r=gh(dh(e,t,n)),s=gh(dh(e,t,i)),o=gh(dh(n,i,e)),a=gh(dh(n,i,t));return r!==s&&o!==a||!(0!==r||!mh(e,n,t))||!(0!==s||!mh(e,i,t))||!(0!==o||!mh(n,e,i))||!(0!==a||!mh(n,t,i))}function mh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function gh(e){return e>0?1:e<0?-1:0}function yh(e,t){return dh(e.prev,e,e.next)<0?dh(e,t,e.next)>=0&&dh(e,e.prev,t)>=0:dh(e,t,e.prev)<0||dh(e,e.next,t)<0}function _h(e,t){const n=new bh(e.i,e.x,e.y),i=new bh(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function vh(e,t,n,i){const r=new bh(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function xh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class wh{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){a=c=e[0],l=h=e[1];for(let t=n;tc&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return eh(s,o,n,a,l,p),o}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function Sh(e,t){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=t.x-a/u,f=t.y+o/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-a*l);i=p+o*m-e.x,r=f+a*m-e.y;const g=i*i+r*r;if(g<=2)return new Ln(i,r);s=Math.sqrt(g/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Ln(i/s,r/s)}const P=[];for(let e=0,t=T.length,n=t-1,i=e+1;e=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+d;for(let e=0,t=T.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e0)&&d.push(t,r,l),(e!==n-1||a0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Gh.prototype.isMeshPhysicalMaterial=!0;class Vh extends br{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new jn(16777215),this.specular=new jn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}Vh.prototype.isMeshPhongMaterial=!0;class Wh extends br{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new jn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}Wh.prototype.isMeshToonMaterial=!0;class jh extends br{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}jh.prototype.isMeshNormalMaterial=!0;class qh extends br{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new jn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}qh.prototype.isMeshLambertMaterial=!0;class Xh extends br{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new jn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nt,this.normalScale=new Ln(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}Xh.prototype.isMeshMatcapMaterial=!0;class Jh extends Yl{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Jh.prototype.isLineDashedMaterial=!0;const Yh={ShadowMaterial:Fh,SpriteMaterial:pl,RawShaderMaterial:zh,ShaderMaterial:ps,PointsMaterial:oc,MeshPhysicalMaterial:Gh,MeshStandardMaterial:Hh,MeshPhongMaterial:Vh,MeshToonMaterial:Wh,MeshNormalMaterial:jh,MeshLambertMaterial:qh,MeshDepthMaterial:qa,MeshDistanceMaterial:Xa,MeshBasicMaterial:wr,MeshMatcapMaterial:Xh,LineDashedMaterial:Jh,LineBasicMaterial:Yl,Material:br};br.fromType=function(e){return new Yh[e]};const Zh={arraySlice:function(e,t,n){return Zh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e=i)){l.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e=i.times[u]){const e=u*l+a,t=e+l-a;d=Zh.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),d=Zh.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new si).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let e=0;e=r)break e;{const o=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=Zh.arraySlice(n,r,s),this.values=Zh.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&Zh.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=Zh.arraySlice(this.times),t=Zh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Mt,r=e.length-1;let s=1;for(let o=1;o0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=Zh.arraySlice(e,0,s),this.values=Zh.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=Zh.arraySlice(this.times,0),t=Zh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tu.prototype.TimeBufferType=Float32Array,tu.prototype.ValueBufferType=Float32Array,tu.prototype.DefaultInterpolation=wt;class nu extends tu{}nu.prototype.ValueTypeName="bool",nu.prototype.ValueBufferType=Array,nu.prototype.DefaultInterpolation=bt,nu.prototype.InterpolantFactoryMethodLinear=void 0,nu.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends tu{}iu.prototype.ValueTypeName="color";class ru extends tu{}ru.prototype.ValueTypeName="number";class su extends Kh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)si.slerpFlat(r,0,s,l-o,s,l,a);return r}}class ou extends tu{InterpolantFactoryMethodLinear(e){return new su(this.times,this.values,this.getValueSize(),e)}}ou.prototype.ValueTypeName="quaternion",ou.prototype.DefaultInterpolation=wt,ou.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends tu{}au.prototype.ValueTypeName="string",au.prototype.ValueBufferType=Array,au.prototype.DefaultInterpolation=bt,au.prototype.InterpolantFactoryMethodLinear=void 0,au.prototype.InterpolantFactoryMethodSmooth=void 0;class lu extends tu{}lu.prototype.ValueTypeName="vector";class cu{constructor(e,t=-1,n,i=At){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hu(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tu.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Zh.flattenJSON(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==mu[e])return void mu[e].push({onLoad:t,onProgress:n,onError:i});mu[e]=[],mu[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=mu[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{uu.add(e,t);const n=mu[e];delete mu[e];for(let e=0,i=n.length;e{const n=mu[e];if(void 0===n)throw this.manager.itemError(e),t;delete mu[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class yu extends fu{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new gu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new jn).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Ln).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new oi).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new Qn).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Rn).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Bi).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Ln).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ln).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Vu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){const n=new du(t);r=new vu(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new vu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){si.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;si.multiplyQuaternionsFlat(e,s,e,t,e,n),si.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const bd=new RegExp("[\\[\\]\\.:\\/]","g"),wd="[^\\[\\]\\.:\\/]",Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sd=/((?:WC+[\/:])*)/.source.replace("WC",wd),Ed=/(WCOD+)?/.source.replace("WCOD",Md),Td=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",wd),Ad=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",wd),Cd=new RegExp("^"+Sd+Ed+Td+Ad+"$"),Ld=["material","materials","bones"];class Rd{constructor(e,t,n){this.path=t,this.parsedPath=n||Rd.parseTrackName(t),this.node=Rd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rd.Composite(e,t,n):new Rd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(bd,"")}static parseTrackName(e){const t=Cd.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Ld.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Rd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Pd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:St,endingEnd:St};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case Ct:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);break;case At:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===xt;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(n===_t){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Et,i.endingEnd=Et):(i.endingStart=e?this.zeroSlopeAtStart?Et:St:Tt,i.endingEnd=t?this.zeroSlopeAtEnd?Et:St:Tt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}class Id extends gn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new xd(Rd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Gd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Vd.prototype.isBox2=!0;const Wd=new oi,jd=new oi;class qd{constructor(e=new oi,t=new oi){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Wd.subVectors(e,this.start),jd.subVectors(this.end,this.start);const n=jd.dot(jd);let i=jd.dot(Wd)/n;return t&&(i=wn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Xd=new oi;class Jd extends lr{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new Vr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{vp.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(vp,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Mp extends rc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Vr;n.setAttribute("position",new Or(t,3)),n.setAttribute("color",new Or([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Yl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new jn,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Sp{constructor(){this.type="ShapePath",this.color=new jn,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(e){const t=[];for(let n=0,i=e.length;nNumber.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const r=wh.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],l=new Kc,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1,t=0;for(let e=0,t=d.length;e0&&!1===e&&(m=u)}for(let e=0,t=d.length;e65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=wn(e,-65504,65504),Ap[0]=e;const t=Cp[0],n=t>>23&511;return Lp[n]+((8388607&t)>>Rp[n])}static fromHalfFloat(e){const t=e>>10;return Cp[0]=Pp[Ip[t]+(1023&e)]+Dp[t],Ap[0]}}const Tp=new ArrayBuffer(4),Ap=new Float32Array(Tp),Cp=new Uint32Array(Tp),Lp=new Uint32Array(512),Rp=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Lp[e]=0,Lp[256|e]=32768,Rp[e]=24,Rp[256|e]=24):t<-14?(Lp[e]=1024>>-t-14,Lp[256|e]=1024>>-t-14|32768,Rp[e]=-t-1,Rp[256|e]=-t-1):t<=15?(Lp[e]=t+15<<10,Lp[256|e]=t+15<<10|32768,Rp[e]=13,Rp[256|e]=13):t<128?(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=24,Rp[256|e]=24):(Lp[e]=31744,Lp[256|e]=64512,Rp[e]=13,Rp[256|e]=13)}const Pp=new Uint32Array(2048),Dp=new Uint32Array(64),Ip=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;0==(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,Pp[e]=t|n}for(let e=1024;e<2048;++e)Pp[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Dp[e]=e<<23;Dp[31]=1199570944,Dp[32]=2147483648;for(let e=33;e<63;++e)Dp[e]=2147483648+(e-32<<23);Dp[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(Ip[e]=1024);const Op=0,kp=1,Np=0,Bp=1,Up=2;function Fp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function zp(e=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}class Hp extends uc{constructor(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(e,t)}}class Gp extends Al{constructor(e){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(e)}}class Vp extends uc{constructor(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(e,t)}}class Wp extends oc{constructor(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class jp extends oc{constructor(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class qp extends oc{constructor(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class Xp extends oi{constructor(e,t,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(e,t,n)}}class Jp extends Er{constructor(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(e,t),this.setUsage(sn)}}class Yp extends Tr{constructor(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(e,t)}}class Zp extends Ar{constructor(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(e,t)}}class Kp extends Cr{constructor(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(e,t)}}class Qp extends Lr{constructor(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(e,t)}}class $p extends Rr{constructor(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(e,t)}}class ef extends Pr{constructor(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(e,t)}}class tf extends Dr{constructor(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(e,t)}}class nf extends Or{constructor(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(e,t)}}class rf extends kr{constructor(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(e,t)}}yc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(yc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Uc.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)};class sf extends Mp{constructor(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(e)}}class of extends gp{constructor(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(e,t)}}class af extends rc{constructor(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new Zc(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}sp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Qd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};class lf extends rc{constructor(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new Nh(e.geometry),new Yl({color:void 0!==t?t:16777215}))}}fu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Vu.extractUrlBase(e)},fu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};class cf extends gu{constructor(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(e)}}class hf extends bu{constructor(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(e)}}Vd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Vd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Vd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Vd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},ci.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ci.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ci.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ci.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ci.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Xi.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Ci.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ts.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},qd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Rn.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Rn.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Rn.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Rn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Rn.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Bi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Bi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Bi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new oi).setFromMatrixColumn(this,3)},Bi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Bi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Bi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Bi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Bi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Bi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Bi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Bi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Bi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Bi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Bi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Bi.prototype.makeFrustum=function(e,t,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,s)},Bi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ms.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},si.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},si.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Ni.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Ni.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Ni.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},vr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},vr.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},vr.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},vr.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},vr.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},vr.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),vr.getBarycoord(e,t,n,i,r)},vr.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),vr.getNormal(e,t,n,i)},Kc.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Kc.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Eh(this,e)},Kc.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rh(this,e)},Ln.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ln.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Ln.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},oi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},oi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},oi.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},oi.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},oi.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},oi.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},oi.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},oi.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},oi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Qn.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Qn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},lr.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},lr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},lr.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},lr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},lr.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(lr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),as.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(as.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Lt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},ms.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Mu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Er.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===sn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(sn)}}}),Er.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},Er.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Er.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vr.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},Vr.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Er(arguments[1],arguments[2])))},Vr.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},Vr.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Vr.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Vr.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},Vr.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Vr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?sn:rn),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Eh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Eh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Eh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},cl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Od.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(br.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new jn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(ps.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),sl.prototype.clearTarget=function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},sl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},sl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},sl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},sl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},sl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},sl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},sl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},sl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},sl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},sl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},sl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},sl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},sl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},sl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},sl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},sl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},sl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},sl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},sl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},sl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},sl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},sl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},sl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},sl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(sl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?It:Dt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ja.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});class uf extends vs{constructor(e,t,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(e,n)}}function df(){console.error("THREE.CanvasRenderer has been removed")}function pf(){console.error("THREE.JSONLoader has been removed.")}Object.defineProperties($n.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),pd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new $u).load(e,(function(e){t.setBuffer(e)})),this},vd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ys.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ys.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},Xn.crossOrigin=void 0,Xn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new wu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new xu;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Xn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Xn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const ff={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function mf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}class gf extends Vr{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}}class yf extends Vr{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}}function _f(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function vf(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function xf(){console.error("THREE.ImmediateRenderObject has been removed.")}class bf extends $n{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class wf extends ei{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class Mf extends ni{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i)},365:(e,t,n)=>{"use strict";n.d(t,{z:()=>a});var i=n(477);const r={type:"change"},s={type:"start"},o={type:"end"};class a extends i.EventDispatcher{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new i.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:i.MOUSE.ROTATE,MIDDLE:i.MOUSE.DOLLY,RIGHT:i.MOUSE.PAN},this.touches={ONE:i.TOUCH.ROTATE,TWO:i.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return h.phi},this.getAzimuthalAngle=function(){return h.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",X),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),l=a.NONE},this.update=function(){const t=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),o=s.clone().invert(),m=new i.Vector3,g=new i.Quaternion,y=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(s),h.setFromVector3(t),n.autoRotate&&l===a.NONE&&A(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(h.theta+=u.theta*n.dampingFactor,h.phi+=u.phi*n.dampingFactor):(h.theta+=u.theta,h.phi+=u.phi);let i=n.minAzimuthAngle,_=n.maxAzimuthAngle;return isFinite(i)&&isFinite(_)&&(i<-Math.PI?i+=y:i>Math.PI&&(i-=y),_<-Math.PI?_+=y:_>Math.PI&&(_-=y),h.theta=i<=_?Math.max(i,Math.min(_,h.theta)):h.theta>(i+_)/2?Math.max(i,h.theta):Math.min(_,h.theta)),h.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=d,h.radius=Math.max(n.minDistance,Math.min(n.maxDistance,h.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(h),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),p.set(0,0,0)),d=1,!!(f||m.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c)&&(n.dispatchEvent(r),m.copy(n.object.position),g.copy(n.object.quaternion),f=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",q),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",X)};const n=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,h=new i.Spherical,u=new i.Spherical;let d=1;const p=new i.Vector3;let f=!1;const m=new i.Vector2,g=new i.Vector2,y=new i.Vector2,_=new i.Vector2,v=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,S=[],E={};function T(){return Math.pow(.95,n.zoomSpeed)}function A(e){u.theta-=e}function C(e){u.phi-=e}const L=function(){const e=new i.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),p.add(e)}}(),R=function(){const e=new i.Vector3;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),p.add(e)}}(),P=function(){const e=new i.Vector3;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;e.copy(s).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*t*o/r.clientHeight,n.object.matrix),R(2*i*o/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function D(e){n.object.isPerspectiveCamera?d/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){n.object.isPerspectiveCamera?d*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function k(e){_.set(e.clientX,e.clientY)}function N(){if(1===S.length)m.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);m.set(e,t)}}function B(){if(1===S.length)_.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);_.set(e,t)}}function U(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function F(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g)}function z(e){if(1===S.length)v.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v)}function H(e){const t=K(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);w.set(0,s),M.set(0,Math.pow(w.y/b.y,n.zoomSpeed)),D(M.y),b.copy(w)}function G(e){!1!==n.enabled&&(0===S.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",W)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(Z(e),S.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;N(),l=a.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;B(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(),n.enablePan&&B(),l=a.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(),n.enableRotate&&N(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case i.MOUSE.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),l=a.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;k(e),l=a.PAN}else{if(!1===n.enableRotate)return;O(e),l=a.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),l=a.ROTATE}else{if(!1===n.enablePan)return;k(e),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(s)}(e))}function V(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),l){case a.TOUCH_ROTATE:if(!1===n.enableRotate)return;F(e),n.update();break;case a.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case a.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&H(e),n.enablePan&&z(e)}(e),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&H(e),n.enableRotate&&F(e)}(e),n.update();break;default:l=a.NONE}}(e):function(e){if(!1!==n.enabled)switch(l){case a.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*y.x/t.clientHeight),C(2*Math.PI*y.y/t.clientHeight),m.copy(g),n.update()}(e);break;case a.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,b),M.y>0?D(T()):M.y<0&&I(T()),b.copy(w),n.update()}(e);break;case a.PAN:if(!1===n.enablePan)return;!function(e){v.set(e.clientX,e.clientY),x.subVectors(v,_).multiplyScalar(n.panSpeed),P(x.x,x.y),_.copy(v),n.update()}(e)}}(e))}function W(e){Y(e),0===S.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W)),n.dispatchEvent(o),l=a.NONE}function j(e){Y(e)}function q(e){!1!==n.enabled&&!1!==n.enableZoom&&l===a.NONE&&(e.preventDefault(),n.dispatchEvent(s),function(e){e.deltaY<0?I(T()):e.deltaY>0&&D(T()),n.update()}(e),n.dispatchEvent(o))}function X(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:P(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:P(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:P(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:P(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function Y(e){delete E[e.pointerId];for(let t=0;t{"use strict";n.d(t,{G:()=>s});var i=n(477);class r extends i.DataTextureLoader{constructor(e){super(e)}parse(e){e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let t=0;const n=new Uint8Array(e),r={id_length:n[t++],colormap_type:n[t++],image_type:n[t++],colormap_index:n[t++]|n[t++]<<8,colormap_length:n[t++]|n[t++]<<8,colormap_size:n[t++],origin:[n[t++]|n[t++]<<8,n[t++]|n[t++]<<8],width:n[t++]|n[t++]<<8,height:n[t++]|n[t++]<<8,pixel_size:n[t++],flags:n[t++]};!function(e){switch(e.image_type){case 1:case 9:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let s=!1,o=!1,a=!1;switch(r.image_type){case 9:s=!0,o=!0;break;case 1:o=!0;break;case 10:s=!0;break;case 2:break;case 11:s=!0,a=!0;break;case 3:a=!0}const l=new Uint8Array(r.width*r.height*4),c=function(e,t,n,i,r){let s,o;const a=n.pixel_size>>3,l=n.width*n.height*a;if(t&&(o=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;s=new Uint8Array(l);let o=0;const c=new Uint8Array(a);for(;o>4){default:case 2:o=0,c=1,u=t,l=0,h=1,d=n;break;case 0:o=0,c=1,u=t,l=n-1,h=-1,d=-1;break;case 3:o=t-1,c=-1,u=-1,l=0,h=1,d=n;break;case 1:o=t-1,c=-1,u=-1,l=n-1,h=-1,d=-1}if(a)switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d++)c=l[d],e[4*(h+p*u)+0]=c,e[4*(h+p*u)+1]=c,e[4*(h+p*u)+2]=c,e[4*(h+p*u)+3]=255}(e,l,h,d,o,c,u,i);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=2)e[4*(c+d*h)+0]=l[u+0],e[4*(c+d*h)+1]=l[u+0],e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+3]=l[u+1]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,s,o,a,l,c){const h=c;let u,d,p,f=0;const m=r.width;for(p=t;p!==i;p+=n)for(d=s;d!==a;d+=o,f++)u=l[f],e[4*(d+m*p)+3]=255,e[4*(d+m*p)+2]=h[3*u+0],e[4*(d+m*p)+1]=h[3*u+1],e[4*(d+m*p)+0]=h[3*u+2]}(e,l,h,d,o,c,u,i,s);break;case 16:!function(e,t,n,i,s,o,a,l){let c,h,u,d=0;const p=r.width;for(u=t;u!==i;u+=n)for(h=s;h!==a;h+=o,d+=2)c=l[d+0]+(l[d+1]<<8),e[4*(h+p*u)+0]=(31744&c)>>7,e[4*(h+p*u)+1]=(992&c)>>2,e[4*(h+p*u)+2]=(31&c)<<3,e[4*(h+p*u)+3]=32768&c?0:255}(e,l,h,d,o,c,u,i);break;case 24:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=3)e[4*(c+d*h)+3]=255,e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2]}(e,l,h,d,o,c,u,i);break;case 32:!function(e,t,n,i,s,o,a,l){let c,h,u=0;const d=r.width;for(h=t;h!==i;h+=n)for(c=s;c!==a;c+=o,u+=4)e[4*(c+d*h)+2]=l[u+0],e[4*(c+d*h)+1]=l[u+1],e[4*(c+d*h)+0]=l[u+2],e[4*(c+d*h)+3]=l[u+3]}(e,l,h,d,o,c,u,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(l,r.width,r.height,c.pixel_data,c.palettes),{data:l,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:i.LinearMipmapLinearFilter}}}class s extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===s.path?i.LoaderUtils.extractUrlBase(e):s.path,a=new i.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e,t){function n(e,t){const n=[],i=e.childNodes;for(let e=0,r=i.length;e0&&t.push(new i.VectorKeyframeTrack(r+".position",s,o)),a.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",s,a)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",s,l)),t}function S(e,t,n){let i,r,s,o=!0;for(r=0,s=e.length;r=0;){const i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t>>0));switch(n=n.toLowerCase(),n){case"tga":t=Xe;break;default:t=qe}return t}(s);if(void 0!==t){const r=t.load(s),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===c(o.technique)){const e=o.technique;r.wrapS=e.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,r.wrapT=e.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=i.RepeatWrapping,r.wrapT=i.RepeatWrapping;return null!==n&&(r.encoding=n),r}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",s),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}s.name=e.name||"";const a=r.parameters;for(const e in a){const t=a[e];switch(e){case"diffuse":t.color&&s.color.fromArray(t.color),t.texture&&(s.map=o(t.texture,i.sRGBEncoding));break;case"specular":t.color&&s.specular&&s.specular.fromArray(t.color),t.texture&&(s.specularMap=o(t.texture));break;case"bump":t.texture&&(s.normalMap=o(t.texture));break;case"ambient":t.texture&&(s.lightMap=o(t.texture,i.sRGBEncoding));break;case"shininess":t.float&&s.shininess&&(s.shininess=t.float);break;case"emission":t.color&&s.emissive&&s.emissive.fromArray(t.color),t.texture&&(s.emissiveMap=o(t.texture,i.sRGBEncoding))}}s.color.convertSRGBToLinear(),s.specular&&s.specular.convertSRGBToLinear(),s.emissive&&s.emissive.convertSRGBToLinear();let l=a.transparent,h=a.transparency;if(void 0===h&&l&&(h={float:1}),void 0===l&&h&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&h)if(l.data.texture)s.transparent=!0;else{const e=l.data.color;switch(l.opaque){case"A_ONE":s.opacity=e[3]*h.float;break;case"RGB_ZERO":s.opacity=1-e[0]*h.float;break;case"A_ZERO":s.opacity=1-e[3]*h.float;break;case"RGB_ONE":s.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}s.opacity<1&&(s.transparent=!0)}if(void 0!==r.extra&&void 0!==r.extra.technique){const e=r.extra.technique;for(const t in e){const n=e[t];switch(t){case"double_sided":s.side=1===n?i.DoubleSide:i.FrontSide;break;case"bump":s.normalMap=o(n.texture),s.normalScale=new i.Vector2(1,1)}}}return s}function K(e){return f(Qe.materials[e],Z)}function Q(e){for(let t=0;t0?n+s:n;t.inputs[o]={id:e,offset:r},t.stride=Math.max(t.stride,r+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=a(i.textContent);break;case"p":t.p=a(i.textContent)}}return t}function he(e){let t=0;for(let n=0,i=e.length;n0&&t0&&d.setAttribute("position",new i.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),a.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),h.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(h,4)),u.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(u,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function pe(e,t,n,i,r=!1){const s=e.p,o=e.stride,a=e.vcount;function l(e){let t=s[e+n]*h;const o=t+h;for(;t4)for(let t=1,i=n-2;t<=i;t++){const n=e+o*t,i=e+o*(t+1);l(e+0*o),l(n),l(i)}e+=o*n}}else for(let e=0,t=s.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;nr.limits.max||t{"use strict";n.d(t,{v:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=""===this.path?i.LoaderUtils.extractUrlBase(e):this.path,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(s.parse(n,o))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,o={};for(let e=0;e=0?t.substring(0,s):t;a=a.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},o[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const a=new s(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class s{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:i.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:i.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const i=e[n],r={};t[n]=r;for(const e in i){let t=!0,n=i[e];const s=e.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(r[s]=n)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function s(e,n){if(r[e])return;const s=t.getTextureParams(n,r),o=t.loadTexture((a=t.baseUrl,"string"!=typeof(l=s.url)||""===l?"":/^https?:\/\//i.test(l)?l:a+l));var a,l;o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(o.encoding=i.sRGBEncoding),r[e]=o}for(const e in n){const t=n[e];let o;if(""!==t)switch(e.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ks":r.specular=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"ke":r.emissive=(new i.Color).fromArray(t).convertSRGBToLinear();break;case"map_kd":s("map",t);break;case"map_ks":s("specularMap",t);break;case"map_ke":s("emissiveMap",t);break;case"norm":s("normalMap",t);break;case"map_bump":case"bump":s("bumpMap",t);break;case"map_d":s("alphaMap",t),r.transparent=!0;break;case"ns":r.shininess=parseFloat(t);break;case"d":o=parseFloat(t),o<1&&(r.opacity=o,r.transparent=!0);break;case"tr":o=parseFloat(t),this.options&&this.options.invertTrProperty&&(o=1-o),o>0&&(r.opacity=1-o,r.transparent=!0)}}return this.materials[e]=new i.MeshPhongMaterial(r),this.materials[e]}getTextureParams(e,t){const n={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-s"),s>=0&&(n.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(n.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),n.url=r.join(" ").trim(),n}loadTexture(e,t,n,r,s){const o=void 0!==this.manager?this.manager:i.DefaultLoadingManager;let a=o.getHandler(e);null===a&&(a=new i.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(e,n,r,s);return void 0!==t&&(l.mapping=t),l}}},476:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(477);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new i.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(s.parse(n))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}}),n,r)}parse(e){function t(e,t,n){for(let i=0,r=e.length;i>5&31)/31,o=(e>>10&31)/31):(r=l,s=c,o=h)}for(let l=1;l<=3;l++){const c=n+12*l,h=3*e*3+3*(l-1);f[h]=t.getFloat32(c,!0),f[h+1]=t.getFloat32(c+4,!0),f[h+2]=t.getFloat32(c+8,!0),m[h]=i,m[h+1]=u,m[h+2]=p,d&&(a[h]=r,a[h+1]=s,a[h+2]=o)}}return p.setAttribute("position",new i.BufferAttribute(f,3)),p.setAttribute("normal",new i.BufferAttribute(m,3)),d&&(p.setAttribute("color",new i.BufferAttribute(a,3)),p.hasColors=!0,p.alpha=u),p}(n):function(e){const t=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g;let s=0;const o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),l=new RegExp("normal"+o+o+o,"g"),c=[],h=[],u=new i.Vector3;let d,p=0,f=0,m=0;for(;null!==(d=n.exec(e));){f=m;const e=d[0];for(;null!==(d=r.exec(e));){let e=0,t=0;const n=d[0];for(;null!==(d=l.exec(n));)u.x=parseFloat(d[1]),u.y=parseFloat(d[2]),u.z=parseFloat(d[3]),t++;for(;null!==(d=a.exec(n));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),h.push(u.x,u.y,u.z),e++,m++;1!==t&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==e&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}const n=f,i=m-f;t.addGroup(n,i,p),p++}return t.setAttribute("position",new i.Float32BufferAttribute(c,3)),t.setAttribute("normal",new i.Float32BufferAttribute(h,3)),t}("string"!=typeof(r=e)?i.LoaderUtils.decodeText(new Uint8Array(r)):r);var r}}},140:(e,t,n)=>{"use strict";n.d(t,{qf:()=>r});var i=n(477);function r(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),o=new Set(Object.keys(e[0].morphAttributes)),a={},l={},c=e[0].morphTargetsRelative,h=new i.BufferGeometry;let u=0;for(let i=0;i{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Viewer:()=>Viewer,THREE:()=>three__WEBPACK_IMPORTED_MODULE_3__,msgpack:()=>msgpack});var three__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(140),wwobjloader2__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(973),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(976),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(23),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(476),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(365),msgpack=__webpack_require__(676),dat=__webpack_require__(376).ZP;__webpack_require__(583);const extensionCodec=new msgpack.ExtensionCodec;function merge_geometries(e,t=!1){let n=[],i=[],r=e.matrix.clone();!function e(t,r){let s=r.clone().multiply(t.matrix);"Mesh"===t.type&&(t.geometry.applyMatrix4(s),i.push(t.geometry),n.push(t.material));for(let n of t.children)e(n,s)}(e,r);let s=null;if(1==i.length)s=i[0],t&&(s.material=n[0]);else if(i.length>1){let e=new Array(i.length).fill(!1);for(let t=0;t!0===e))===e.every((e=>!1===e))){console.warn("Broken DAE: Either all geometries need to contain uv tags or none. To circumvent failure in mergeBufferGeometries, removing all textures");for(let e=0;et.width;)i--,n.font=i+"px "+e.font_face;n.fillText(e.text,t.width/2,t.height/2);let r=new three__WEBPACK_IMPORTED_MODULE_3__.CanvasTexture(t);return r.uuid=e.uuid,r}return null}function handle_special_geometry(e){if("_meshfile"==e.type&&(console.warn("_meshfile is deprecated. Please use _meshfile_geometry for geometries and _meshfile_object for objects with geometry and material"),e.type="_meshfile_geometry"),"_meshfile_geometry"==e.type){if("obj"==e.format){let t=merge_geometries((new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe).parse(e.data+"\n"));return t.uuid=e.uuid,t}if("dae"==e.format)try{let t=merge_geometries((new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G).parse(e.data).scene);return t.uuid=e.uuid,t}catch(e){return console.error("Failure parsing DAE:",e),null}else{if("stl"!=e.format)return console.error("Unsupported mesh type:",e),null;try{let t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer);return t.uuid=e.uuid,t}catch(t){return console.error("Failure parsing STL:",t,e),null}}}return null}extensionCodec.register({type:18,encode:e=>(console.error("Uint8Array encode not implemented"),null),decode:e=>{const t=new Uint8Array(e.byteLength);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Uint32Array encode not implemented"),null),decode:e=>{const t=new Uint32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e(console.error("Float32Array encode not implemented"),null),decode:e=>{const t=new Float32Array(e.byteLength/4);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;evoid 0!==e.resources[t]?e.resources[t]:t)),"obj"==e.format){let s=new wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.oe(i);if(e.mtl_library){let t=new three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__.v(i).parse(e.mtl_library+"\n",""),n=wwobjloader2__WEBPACK_IMPORTED_MODULE_0__.eW.addMaterialsFromMtlLoader(t);s.setMaterials(n),this.onTextureLoad()}t=merge_geometries(s.parse(e.data+"\n",r),!0),t.uuid=e.uuid,n=t.material}else if("dae"==e.format){let s=new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_4__.G(i);s.onTextureLoad=this.onTextureLoad,t=merge_geometries(s.parse(e.data,r).scene,!0),t.uuid=e.uuid,n=t.material}else{if("stl"!=e.format)return console.error("Unsupported mesh type:",e),null;t=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(e.data.buffer,r),t.uuid=e.uuid,n=t.material}let s=new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(t,n);return s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userjson&&(s.userjson=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),s}return super.parseObject(e,t,n)}}class SceneNode{constructor(e,t,n){this.object=e,this.folder=t,this.children={},this.controllers=[],this.on_update=n,this.create_controls();for(let e of this.object.children)this.add_child(e)}add_child(e){let t=this.folder.addFolder(e.name),n=new SceneNode(e,t,this.on_update);return this.children[e.name]=n,n}create_child(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Group;return t.name=e,this.object.add(t),this.add_child(t)}find(e){if(0==e.length)return this;{let t=e[0],n=this.children[t];return void 0===n&&(n=this.create_child(t)),n.find(e.slice(1))}}create_controls(){for(let e of this.controllers)this.folder.remove(e);if(this.controllers=[],void 0!==this.vis_controller&&this.folder.domElement.removeChild(this.vis_controller.domElement),this.vis_controller=new dat.controllers.BooleanController(this.object,"visible"),this.vis_controller.onChange((()=>this.on_update())),this.folder.domElement.prepend(this.vis_controller.domElement),this.vis_controller.domElement.style.height="0",this.vis_controller.domElement.style.float="right",this.vis_controller.domElement.classList.add("meshcat-visibility-checkbox"),this.vis_controller.domElement.children[0].addEventListener("change",(e=>{e.target.checked?this.folder.domElement.classList.remove("meshcat-hidden-scene-element"):this.folder.domElement.classList.add("meshcat-hidden-scene-element")})),this.object.isLight){let e=this.folder.add(this.object,"intensity").min(0).step(.01);if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.castShadow){let e=this.folder.add(this.object,"castShadow");if(e.onChange((()=>this.on_update())),this.controllers.push(e),void 0!==this.object.shadow){let e=this.folder.add(this.object.shadow,"radius").min(0).step(.05).max(3);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(void 0!==this.object.distance){let e=this.folder.add(this.object,"distance").min(0).step(.1).max(100);e.onChange((()=>this.on_update())),this.controllers.push(e)}}if(this.object.isCamera){let e=this.folder.add(this.object,"zoom").min(0).step(.1);e.onChange((()=>{this.on_update()})),this.controllers.push(e)}}set_property(e,t){if("position"===e)this.object.position.set(t[0],t[1],t[2]);else if("quaternion"===e)this.object.quaternion.set(t[0],t[1],t[2],t[3]);else if("scale"===e)this.object.scale.set(t[0],t[1],t[2]);else if("color"===e){function e(t,n){if(t.material){t.material.color.setRGB(n[0],n[1],n[2]);let e=n[3];t.material.opacity=e,t.material.transparent=1!=e}for(let i of t.children)e(i,n)}e(this.object,t)}else this.object[e]="top_color"==e||"bottom_color"==e?t.map((e=>255*e)):t;this.vis_controller.updateDisplay(),this.controllers.forEach((e=>e.updateDisplay()))}set_transform(e){let t=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;t.fromArray(e),t.decompose(this.object.position,this.object.quaternion,this.object.scale)}set_object(e){let t=this.object.parent;this.dispose_recursive(),this.object.parent.remove(this.object),this.object=e,t.add(e),this.create_controls()}dispose_recursive(){for(let e of Object.keys(this.children))this.children[e].dispose_recursive();dispose(this.object)}delete(e){if(0==e.length)console.error("Can't delete an empty path");else{let t=this.find(e.slice(0,e.length-1)),n=e[e.length-1],i=t.children[n];void 0!==i&&(i.dispose_recursive(),t.object.remove(i.object),remove_folders(i.folder),t.folder.removeFolder(i.folder),delete t.children[n])}}}function remove_folders(e){for(let t of Object.keys(e.__folders)){let n=e.__folders[t];remove_folders(n),dat.dom.dom.unbind(window,"resize",n.__resizeHandler),e.removeFolder(n)}}function dispose(e){if(e&&(e.geometry&&e.geometry.dispose(),e.material))if(Array.isArray(e.material))for(let t of e.material)t.map&&t.map.dispose(),t.dispose();else e.material.map&&e.material.map.dispose(),e.material.dispose()}function create_default_scene(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.Scene;return e.name="Scene",e.rotateX(-Math.PI/2),e}function download_data_uri(e,t){let n=document.createElement("a");n.download=e,n.href=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function download_file(e,t,n){n=n||"text/plain";let i=new Blob([t],{type:n}),r=document.createElement("a");document.body.appendChild(r),r.download=e,r.href=window.URL.createObjectURL(i),r.onclick=function(e){let t=this;setTimeout((function(){window.URL.revokeObjectURL(t.href)}),1500)},r.click(),r.remove()}class Animator{constructor(e){this.viewer=e,this.folder=this.viewer.gui.addFolder("Animations"),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer,this.loader=new three__WEBPACK_IMPORTED_MODULE_3__.ObjectLoader,this.clock=new three__WEBPACK_IMPORTED_MODULE_3__.Clock,this.actions=[],this.playing=!1,this.time=0,this.time_scrubber=null,this.setup_capturer("png"),this.duration=0}setup_capturer(e){this.capturer=new window.CCapture({format:e,name:"meshcat_"+String(Date.now())}),this.capturer.format=e}play(){this.clock.start();for(let e of this.actions)e.play();this.playing=!0}record(){this.reset(),this.play(),this.recording=!0,this.capturer.start()}pause(){this.clock.stop(),this.playing=!1,this.recording&&(this.stop_capture(),this.save_capture())}stop_capture(){this.recording=!1,this.capturer.stop(),this.viewer.animate()}save_capture(){this.capturer.save(),"png"===this.capturer.format?alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.png \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4"):"jpg"===this.capturer.format&&alert("To convert the still frames into a video, extract the `.tar` file and run: \nffmpeg -r 60 -i %07d.jpg \\\n\t -vcodec libx264 \\\n\t -preset slow \\\n\t -crf 18 \\\n\t output.mp4")}display_progress(e){this.time=e,null!==this.time_scrubber&&this.time_scrubber.updateDisplay()}seek(e){this.actions.forEach((t=>{t.time=Math.max(0,Math.min(t._clip.duration,e))})),this.mixer.update(0),this.viewer.set_dirty()}reset(){for(let e of this.actions)e.reset();this.display_progress(0),this.mixer.update(0),this.setup_capturer(this.capturer.format),this.viewer.set_dirty()}clear(){remove_folders(this.folder),this.mixer.stopAllAction(),this.actions=[],this.duration=0,this.display_progress(0),this.mixer=new three__WEBPACK_IMPORTED_MODULE_3__.AnimationMixer}load(e,t){this.clear(),this.folder.open();let n=this.folder.addFolder("default");n.open(),n.add(this,"play"),n.add(this,"pause"),n.add(this,"reset"),this.time_scrubber=n.add(this,"time",0,1e9,.001),this.time_scrubber.onChange((e=>this.seek(e))),n.add(this.mixer,"timeScale").step(.01).min(0);let i=n.addFolder("Recording");i.add(this,"record"),i.add({format:"png"},"format",["png","jpg"]).onChange((e=>{this.setup_capturer(e)})),void 0===t.play&&(t.play=!0),void 0===t.loopMode&&(t.loopMode=three__WEBPACK_IMPORTED_MODULE_3__.LoopRepeat),void 0===t.repetitions&&(t.repetitions=1),void 0===t.clampWhenFinished&&(t.clampWhenFinished=!0),this.duration=0,this.progress=0;for(let n of e){let e=this.viewer.scene_tree.find(n.path).object,i=three__WEBPACK_IMPORTED_MODULE_3__.AnimationClip.parse(n.clip);i.uuid=three__WEBPACK_IMPORTED_MODULE_3__.MathUtils.generateUUID();let r=this.mixer.clipAction(i,e);r.clampWhenFinished=t.clampWhenFinished,r.setLoop(t.loopMode,t.repetitions),this.actions.push(r),this.duration=Math.max(this.duration,i.duration)}this.time_scrubber.min(0),this.time_scrubber.max(this.duration),this.reset(),t.play&&this.play()}update(){if(this.playing){if(this.mixer.update(this.clock.getDelta()),this.viewer.set_dirty(),0!=this.duration){let e=this.actions.reduce(((e,t)=>Math.max(e,t.time)),0);this.display_progress(e)}else this.display_progress(0);if(this.actions.every((e=>e.paused))){this.pause();for(let e of this.actions)e.reset()}}}after_render(){this.recording&&this.capturer.capture(this.viewer.renderer.domElement)}}function gradient_texture(e,t){var n=new Uint8Array(8);for(let i=0;i<3;++i)n[i]=t[i],n[4+i]=e[i];n[3]=n[7]=255;var i=new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(n,1,2,three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);return i.magFilter=three__WEBPACK_IMPORTED_MODULE_3__.LinearFilter,i.encoding=three__WEBPACK_IMPORTED_MODULE_3__.LinearEncoding,i.matrixAutoUpdate=!1,i.matrix.set(.5,0,.25,0,.5,.25,0,0,1),i.needsUpdate=!0,i}class Viewer{constructor(e,t,n){this.dom_element=e,void 0===n?(this.renderer=new three__WEBPACK_IMPORTED_MODULE_3__.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=three__WEBPACK_IMPORTED_MODULE_3__.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.renderer.setPixelRatio(window.devicePixelRatio),this.scene=create_default_scene(),this.gui_controllers={},this.keydown_callbacks={},this.create_scene_tree(),this.add_default_scene_elements(),this.set_dirty(),this.create_camera(),this.num_messages_received=0,window.onload=e=>this.set_3d_pane_size(),window.addEventListener("resize",(e=>this.set_3d_pane_size()),!1),window.addEventListener("keydown",(e=>{this.on_keydown(e)})),requestAnimationFrame((()=>this.set_3d_pane_size())),(t||void 0===t)&&this.animate()}on_keydown(e){if(e.code in this.keydown_callbacks)for(const t of this.keydown_callbacks[e.code])t.callback(e)}hide_background(){this.scene.background=null,this.set_dirty()}show_background(){var e=this.scene_tree.find(["Background"]).object.top_color,t=this.scene_tree.find(["Background"]).object.bottom_color;this.scene.background=gradient_texture(e,t),this.set_dirty()}set_dirty(){this.needs_render=!0}create_camera(){let e=new three__WEBPACK_IMPORTED_MODULE_3__.Matrix4;e.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],e.toArray());let t=new three__WEBPACK_IMPORTED_MODULE_3__.PerspectiveCamera(75,1,.01,100);this.set_camera(t),this.set_object(["Cameras","default","rotated"],t),t.position.set(3,1,0)}create_default_spot_light(){var e=new three__WEBPACK_IMPORTED_MODULE_3__.SpotLight(16777215,.8);return e.position.set(1.5,1.5,2),e.castShadow=!1,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024,e.shadow.camera.near=.5,e.shadow.camera.far=50,e.shadow.bias=-.001,e}add_default_scene_elements(){var e=this.create_default_spot_light();this.set_object(["Lights","SpotLight"],e),this.set_property(["Lights","SpotLight"],"visible",!1);var t=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);t.position.set(1.5,1.5,2),t.castShadow=!1,t.distance=10,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,t.shadow.camera.near=.5,t.shadow.camera.far=10,t.shadow.bias=-.001,this.set_object(["Lights","PointLightNegativeX"],t);var n=new three__WEBPACK_IMPORTED_MODULE_3__.PointLight(16777215,.4);n.position.set(-1.5,-1.5,2),n.castShadow=!1,n.distance=10,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,n.shadow.camera.near=.5,n.shadow.camera.far=10,n.shadow.bias=-.001,this.set_object(["Lights","PointLightPositiveX"],n);var i=new three__WEBPACK_IMPORTED_MODULE_3__.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new three__WEBPACK_IMPORTED_MODULE_3__.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var s=new three__WEBPACK_IMPORTED_MODULE_3__.GridHelper(20,40);s.rotateX(Math.PI/2),this.set_object(["Grid"],s);var o=new three__WEBPACK_IMPORTED_MODULE_3__.AxesHelper(.5);this.set_object(["Axes"],o)}create_scene_tree(){this.gui&&this.gui.destroy(),this.gui=new dat.GUI({autoPlace:!1}),this.dom_element.parentElement.appendChild(this.gui.domElement),this.gui.domElement.style.position="absolute",this.gui.domElement.style.right=0,this.gui.domElement.style.top=0;let e=this.gui.addFolder("Scene");e.open(),this.scene_tree=new SceneNode(this.scene,e,(()=>this.set_dirty()));let t=this.gui.addFolder("Save / Load / Capture");t.add(this,"save_scene"),t.add(this,"load_scene"),t.add(this,"save_image"),this.animator=new Animator(this),this.gui.close(),this.set_property(["Background"],"top_color",[135/255,206/255,250/255]),this.set_property(["Background"],"bottom_color",[25/255,25/255,112/255]),this.scene_tree.find(["Background"]).on_update=()=>{this.scene_tree.find(["Background"]).object.visible?this.show_background():this.hide_background()},this.show_background()}set_3d_pane_size(e,t){void 0===e&&(e=this.dom_element.offsetWidth),void 0===t&&(t=this.dom_element.offsetHeight),"OrthographicCamera"==this.camera.type?this.camera.right=this.camera.left+e*(this.camera.top-this.camera.bottom)/t:this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.set_dirty()}render(){this.controls.update(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.animator.after_render(),this.needs_render=!1}animate(){requestAnimationFrame((()=>this.animate())),this.animator.update(),this.needs_render&&this.render()}capture_image(e,t){let n=this.dom_element.offsetWidth,i=this.dom_element.offsetHeight;this.set_3d_pane_size(e,t),this.render();let r=this.renderer.domElement.toDataURL();return this.set_3d_pane_size(n,i),r}save_image(){download_data_uri("meshcat.png",this.capture_image())}set_camera(e){this.camera=e,this.controls=new three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__.z(e,this.dom_element),this.controls.enableKeys=!1,this.controls.screenSpacePanning=!0,this.controls.addEventListener("start",(()=>{this.set_dirty()})),this.controls.addEventListener("change",(()=>{this.set_dirty()}))}set_camera_target(e){this.controls.target.set(e[0],e[1],e[2])}set_camera_from_json(e){(new ExtensibleObjectLoader).parse(e,(e=>{this.set_camera(e)}))}set_transform(e,t){this.scene_tree.find(e).set_transform(t)}set_object(e,t){this.scene_tree.find(e.concat([""])).set_object(t)}set_object_from_json(e,t){let n=new ExtensibleObjectLoader;n.onTextureLoad=()=>{this.set_dirty()},n.parse(t,(t=>{void 0!==t.geometry&&"BufferGeometry"==t.geometry.type?void 0!==t.geometry.attributes.normal&&0!==t.geometry.attributes.normal.count||t.geometry.computeVertexNormals():t.type.includes("Camera")&&(this.set_camera(t),this.set_3d_pane_size()),t.castShadow=!0,t.receiveShadow=!0,this.set_object(e,t),this.set_dirty()}))}delete_path(e){0==e.length?console.error("Deleting the entire scene is not implemented"):this.scene_tree.delete(e)}set_property(e,t,n){this.scene_tree.find(e).set_property(t,n),"Background"===e[0]&&this.scene_tree.find(e).on_update()}set_animation(e,t){t=t||{},this.animator.load(e,t)}set_control(name,callback,value,min,max,step,keycode1,keycode2){let my_callback=eval(callback),handler={};if(name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value){function e(e,t,n){if(null!=t){let i={name,callback:()=>{value=e.gui_controllers[name].getValue();let t=Math.min(Math.max(value+n,min),max);e.gui_controllers[name].setValue(t)}};t in e.keydown_callbacks?e.keydown_callbacks[t].push(i):e.keydown_callbacks[t]=[i]}}handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(my_callback),e(this,keycode1,-step),e(this,keycode2,+step)}else if(handler[name]=my_callback,this.gui_controllers[name]=this.gui.add(handler,name),this.gui_controllers[name].domElement.parentElement.querySelector(".property-name").style.width="100%",null!=keycode1){let e={name,callback:my_callback};keycode1 in this.keydown_callbacks?this.keydown_callbacks[keycode1].push(e):this.keydown_callbacks[keycode1]=[e]}}set_control_value(e,t,n=!0){e in this.gui_controllers&&this.gui_controllers[e]instanceof dat.controllers.NumberController&&(n?this.gui_controllers[e].setValue(t):(this.gui_controllers[e].object[e]=t,this.gui_controllers[e].updateDisplay()))}delete_control(e){e in this.gui_controllers&&(this.gui.remove(this.gui_controllers[e]),delete this.gui_controllers[e]);for(let t in this.keydown_callbacks){let n=this.keydown_callbacks[t].length;for(;n--;)this.keydown_callbacks[t][n].name==e&&this.keydown_callbacks[t].splice(n,1)}}handle_command(e){if("set_transform"==e.type){let t=split_path(e.path);this.set_transform(t,e.matrix)}else if("delete"==e.type){let t=split_path(e.path);this.delete_path(t)}else if("set_object"==e.type){let t=split_path(e.path);this.set_object_from_json(t,e.object)}else if("set_property"==e.type){let t=split_path(e.path);this.set_property(t,e.property,e.value)}else if("set_animation"==e.type)e.animations.forEach((e=>{e.path=split_path(e.path)})),this.set_animation(e.animations,e.options);else if("set_target"==e.type)this.set_camera_target(e.value);else if("set_control"==e.type)this.set_control(e.name,e.callback,e.value,e.min,e.max,e.step,e.keycode1,e.keycode2);else if("set_control_value"==e.type)this.set_control_value(e.name,e.value,e.invoke_callback);else if("delete_control"==e.type)this.delete_control(e.name);else if("capture_image"==e.type){let t=e.xres||1920,n=e.yres||1080;t/=this.renderer.getPixelRatio(),n/=this.renderer.getPixelRatio();let i=this.capture_image(t,n);this.connection.send(JSON.stringify({type:"img",data:i}))}else"save_image"==e.type&&this.save_image();this.set_dirty()}decode(e){return msgpack.decode(new Uint8Array(e.data),{extensionCodec})}handle_command_bytearray(e){let t=msgpack.decode(e,{extensionCodec});this.handle_command(t)}handle_command_message(e){this.num_messages_received++;let t=this.decode(e);this.handle_command(t)}connect(e){void 0===e&&(e=`ws://${location.host}`),"https:"==location.protocol&&(e=e.replace("ws:","wss:")),this.connection=new WebSocket(e),this.connection.binaryType="arraybuffer",this.connection.onmessage=e=>this.handle_command_message(e),this.connection.onclose=function(e){console.log("onclose:",e)}}save_scene(){download_file("scene.json",JSON.stringify(this.scene.toJSON()))}load_scene_from_json(e){let t=new ExtensibleObjectLoader;t.onTextureLoad=()=>{this.set_dirty()},this.scene_tree.dispose_recursive(),this.scene=t.parse(e),this.show_background(),this.create_scene_tree();let n=this.scene_tree.find(["Cameras","default","rotated",""]);n.object.isCamera?this.set_camera(n.object):this.create_camera()}handle_load_file(e){let t=e.files[0];if(!t)return;let n=new FileReader,i=this;n.onload=function(e){let t=this.result,n=JSON.parse(t);i.load_scene_from_json(n)},n.readAsText(t)}load_scene(){let e=document.createElement("input");e.type="file",document.body.appendChild(e);let t=this;e.addEventListener("change",(function(){console.log(this,t),t.handle_load_file(this)}),!1),e.click(),e.remove()}}function split_path(e){return e.split("/").filter((e=>e.length>0))}let style=document.createElement("style");style.appendChild(document.createTextNode("")),document.head.appendChild(style),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input {\n float: right;\n }"),style.sheet.insertRule("\n .meshcat-hidden-scene-element li .meshcat-visibility-checkbox {\n opacity: 0.25;\n pointer-events: none;\n }"),style.sheet.insertRule("\n .meshcat-visibility-checkbox > input[type=checkbox] {\n height: 16px;\n width: 16px;\n display:inline-block;\n padding: 0 0 0 0px;\n }")})(),__webpack_exports__})()})); \ No newline at end of file