diff --git a/dist/main.min.js b/dist/main.min.js index eb3894e..ef71535 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),a=n(468);var o={function:!0,object:!0};function l(e){return e&&e.Object===Object?e:null}parseFloat,parseInt;var c=o[typeof t]&&t&&!t.nodeType?t:void 0,u=o.object&&e&&!e.nodeType?e:void 0,h=(u&&u.exports,l(c&&u&&"object"==typeof n.g&&n.g)),d=l(o[typeof self]&&self),p=l(o[typeof window]&&window),f=l(o[typeof this]&&this);function m(e){return String("0000000"+e).slice(-7)}h||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),a=0;a=c.frameLimit||c.timeLimit&&e>=c.timeLimit)&&(H(),W());var t=new Date(null);t.setSeconds(e),c.motionBlurFrames>2?y.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+t.toISOString().substr(11,8):y.textContent="CCapture "+c.format+" | "+d+" frames | "+t.toISOString().substr(11,8)}(),j("Frame: "+d+" "+p);for(var s=0;s=u[s].triggerTime&&(G(u[s].callback),u.splice(s,1));for(s=0;s=h[s].triggerTime&&(G(h[s].callback),h[s].triggerTime+=h[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,a=window.performance.now(),r=a+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 u.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,T=new Uint16Array(A.height*A.width*4),L.fillStyle="#0",L.fillRect(0,0,A.width,A.height))}(e),function(e){L.drawImage(e,0,0),S=L.getImageData(0,0,A.width,A.height);for(var t=0;t=.5*c.motionBlurFrames?function(){for(var e=S.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(v.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(v.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()},E.prototype=Object.create(v.prototype),E.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()},E.prototype.save=function(e){this.callback=e,this.encoder.render()},(p||d||{}).CCapture=T,void 0===(i=function(){return T}.call(t,n,t,e))||(e.exports=i)}()},549:e=>{void 0!==e.exports&&(e.exports=function(e,t,n){var i,r,s,a=window,o="application/octet-stream",l=n||o,c=e,u=document,h=u.createElement("a"),d=function(e){return String(e)},p=a.Blob||a.MozBlob||a.WebKitBlob||d,f=a.MSBlobBuilder||a.WebKitBlobBuilder||a.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,a=new Uint8Array(r);s{e.exports=function e(t,n,i){function r(a,o){if(!n[a]){if(!t[a]){if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,(function(e){return r(t[a][1][e]||e)}),c,c.exports,e,t,n,i)}return n[a].exports}for(var s=void 0,a=0;a0&&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,a,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(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(o=a;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){i=o;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 a=0;a<256;a++)s.charMap[a]=String.fromCharCode(a);function o(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)},o.prototype.setRepeat=function(e){this.repeat=e},o.prototype.setTransparent=function(e){this.transparent=e},o.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},o.prototype.finish=function(){this.out.writeByte(59)},o.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},o.prototype.setDither=function(e){!0===e&&(e="FloydSteinberg"),this.dither=e},o.prototype.setGlobalPalette=function(e){this.globalPalette=e},o.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},o.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},o.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))},o.prototype.indexPixels=function(e){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var n=0,i=0;i=0&&b+u=0&&w+c>16,(65280&e)>>8,255&e,t)},o.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,a=this.colorTab.length,o=0,l=0;o=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)},o.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)},o.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)},o.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)},o.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},o.prototype.writePixels=function(){new r(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},o.prototype.stream=function(){return this.out},t.exports=o},{"./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 a,o,l,c,u,h,d=Math.max(2,s),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,v=0,y=!1;function _(e,t){p[o++]=e,o>=254&&w(t)}function x(e){b(i),v=u+2,y=!0,T(u,e)}function b(e){for(var t=0;t0&&(e.writeByte(o),e.writeBytes(p,0,o),o=0)}function M(e){return(1<0?a|=e<=8;)_(255&a,t),a>>=8,g-=8;if((v>l||y)&&(y?(l=M(n_bits=c),y=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),e==h){for(;g>0;)_(255&a,t),a>>=8,g-=8;w(t)}}this.encode=function(n){n.writeByte(d),remaining=e*t,curPixel=0,function(e,t){var n,r,s,a,d,p;for(c=e,y=!1,n_bits=c,l=M(n_bits),h=1+(u=1<=0){d=5003-s,0===s&&(d=1);do{if((s-=d)<0&&(s+=5003),f[s]===n){a=m[s];continue e}}while(f[s]>=0)}T(a,t),a=r,v<4096?(m[s]=v++,f[s]=n):x(t)}else a=m[s];T(a,t),T(h,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,a,o,l,c;function u(e,t,i,s,a){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]-a)/r}function h(e,t,r,a,o){for(var l,u,h=Math.abs(t-e),d=Math.min(t+e,i),p=t+1,f=t-1,m=1;ph;)u=c[m++],ph&&((l=n[f--])[0]-=u*(l[0]-r)/s,l[1]-=u*(l[1]-a)/s,l[2]-=u*(l[2]-o)/s)}function d(e,t,r){var s,a,c,u,h,d=~(1<<31),p=d,f=-1,m=f;for(s=0;s>12))>10,l[s]-=h,o[s]+=h<<10;return l[f]+=64,o[f]-=65536,m}this.buildColormap=function(){(function(){var e,t;for(n=[],a=new Int32Array(256),o=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),e=0;e>6;for(_<=1&&(_=0),n=0;n<_;n++)c[n]=v*(256*(_*_-n*n)/(_*_));p<1509?(t=1,i=3):i=p%499!=0?1497:p%491!=0?1473:p%487!=0?1461:1509;var x=0;for(n=0;n=p&&(x-=p),0===g&&(g=1),++n%g==0)for(v-=v/f,(_=(y-=y/30)>>6)<=1&&(_=0),l=0;l<_;l++)c[l]=v*(256*(_*_-l*l)/(_*_))}(),function(){for(var e=0;e>=4,n[e][1]>>=4,n[e][2]>>=4,n[e][3]=e}(),function(){var e,t,r,s,o,l,c=0,u=0;for(e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)a[t]=255}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)h=c?h=i:(h++,l<0&&(l=-l),(s=o[0]-e)<0&&(s=-s),(l+=s)=0&&((l=t-(o=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(s=o[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 a.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var e,t,n,i,r,s,a,o,l,c,u,h,d,p,f,m;for(o=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?o.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(o.length%4){case 1:o+="=";break;case 2:o+="=="}return o}}(),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,a=n[e.field]||"";for(t=0,i=a.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),a=e.a,o=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 u=e.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===n?"rgb("+i+","+r+","+s+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+s+","+a+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+s+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+s+","+a+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+s+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+",a:"+a+"}":"unknown format"}n.d(t,{ZP:()=>ue});var r=Array.prototype.forEach,s=Array.prototype.slice,a={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?a.toArray(arguments):arguments[0];return a.each(o,(function(t){if(t.litmus(e))return a.each(t.conversions,(function(t,n){if(l=t.read(e),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=t,a.BREAK})),a.BREAK})),c},h=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),a=n*(1-r*t),o=n*(1-(1-r)*t),l=[[n,o,s],[a,n,s],[s,n,o],[s,a,n],[o,s,n],[n,s,a]][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,a=void 0;return 0===r?{h:NaN,s:0,v:0}:(a=e===r?(t-n)/s:t===r?2+(n-e)/s:4+(e-t)/s,(a/=6)<0&&(a+=1),{h:360*a,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<<(h=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=y(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,a.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 v(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),N=function(e){function t(e,n,i){f(this,t);var r=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var s=r,o=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function c(e){var t=o-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),o=e.clientY}function u(){S.unbind(window,"mousemove",c),S.unbind(window,"mouseup",u),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),S.bind(r.__input,"change",(function(){var e=parseFloat(s.__input.value);a.isNaN(e)||s.setValue(e)})),S.bind(r.__input,"blur",(function(){l()})),S.bind(r.__input,"mousedown",(function(e){S.bind(window,"mousemove",c),S.bind(window,"mouseup",u),o=e.clientY})),S.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 v(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 k=function(e){function t(e,n,i,r,s){f(this,t);var a=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:s})),o=a;function l(e){e.preventDefault();var t=o.__background.getBoundingClientRect();return o.setValue(I(e.clientX,t.left,t.right,o.__min,o.__max)),!1}function c(){S.unbind(window,"mousemove",l),S.unbind(window,"mouseup",c),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function u(e){var t=e.touches[0].clientX,n=o.__background.getBoundingClientRect();o.setValue(I(t,n.left,n.right,o.__min,o.__max))}function h(){S.unbind(window,"touchmove",u),S.unbind(window,"touchend",h),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),S.bind(a.__background,"mousedown",(function(e){document.activeElement.blur(),S.bind(window,"mousemove",l),S.bind(window,"mouseup",c),l(e)})),S.bind(a.__background,"touchstart",(function(e){1===e.touches.length&&(S.bind(window,"touchmove",u),S.bind(window,"touchend",h),u(e))})),S.addClass(a.__background,"slider"),S.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return v(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),D=function(e){function t(e,n,i){f(this,t);var r=y(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,S.bind(r.__button,"click",(function(e){return e.preventDefault(),s.fire(),!1})),S.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return v(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),B=function(e){function t(e,n){f(this,t);var i=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new _(i.getValue()),i.__temp=new _(0);var r=i;i.domElement=document.createElement("div"),S.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 ",S.bind(i.__input,"keydown",(function(e){13===e.keyCode&&p.call(this)})),S.bind(i.__input,"blur",p),S.bind(i.__selector,"mousedown",(function(){S.addClass(this,"drag").bind(window,"mouseup",(function(){S.removeClass(r.__selector,"drag")}))})),S.bind(i.__selector,"touchstart",(function(){S.addClass(this,"drag").bind(window,"touchend",(function(){S.removeClass(r.__selector,"drag")}))}));var s,o=document.createElement("div");function l(e){g(e),S.bind(window,"mousemove",g),S.bind(window,"touchmove",g),S.bind(window,"mouseup",h),S.bind(window,"touchend",h)}function c(e){v(e),S.bind(window,"mousemove",v),S.bind(window,"touchmove",v),S.bind(window,"mouseup",d),S.bind(window,"touchend",d)}function h(){S.unbind(window,"mousemove",g),S.unbind(window,"touchmove",g),S.unbind(window,"mouseup",h),S.unbind(window,"touchend",h),m()}function d(){S.unbind(window,"mousemove",v),S.unbind(window,"touchmove",v),S.unbind(window,"mouseup",d),S.unbind(window,"touchend",d),m()}function p(){var e=u(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,a=(i-t.left)/(t.right-t.left),o=1-(s-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),a>1?a=1:a<0&&(a=0),r.__color.v=o,r.__color.s=a,r.setValue(r.__color.toOriginal()),!1}function v(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 a.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),a.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}),a.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),a.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),a.extend(o.style,{width:"100%",height:"100%",background:"none"}),F(o,"top","rgba(0,0,0,0)","#000"),a.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%);",a.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),S.bind(i.__saturation_field,"mousedown",l),S.bind(i.__saturation_field,"touchstart",l),S.bind(i.__field_knob,"mousedown",l),S.bind(i.__field_knob,"touchstart",l),S.bind(i.__hue_field,"mousedown",c),S.bind(i.__hue_field,"touchstart",c),i.__saturation_field.appendChild(o),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 v(t,e),m(t,[{key:"updateDisplay",value:function(){var e=u(this.getValue());if(!1!==e){var t=!1;a.each(_.COMPONENTS,(function(n){if(!a.isUndefined(e[n])&&!a.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&a.extend(this.__color.__state,e)}a.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;a.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,F(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),a.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(w),O=["-moz-","-o-","-webkit-","-ms-",""];function F(e,t,n,i){e.style.background="",a.each(O,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var U='
\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 a.isArray(arguments[2])||a.isObject(arguments[2])?new L(e,t,arguments[2]):a.isNumber(n)?a.isNumber(arguments[2])&&a.isNumber(arguments[3])?a.isNumber(arguments[4])?new k(e,t,arguments[2],arguments[3],arguments[4]):new k(e,t,arguments[2],arguments[3]):a.isNumber(arguments[4])?new N(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new N(e,t,{min:arguments[2],max:arguments[3]}):a.isString(n)?new C(e,t):a.isFunction(n)?new D(e,t,""):a.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"),a.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"}),S.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),a.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;S.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(),a.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",S.unbind(e.domElement,"webkitTransitionEnd",t),S.unbind(e.domElement,"transitionend",t),S.unbind(e.domElement,"oTransitionEnd",t)};S.bind(this.domElement,"webkitTransitionEnd",t),S.bind(this.domElement,"transitionend",t),S.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-S.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-S.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,Y=!1,J=[],Z=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),S.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=a.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=a.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),a.isUndefined(i.load)?i.load={preset:V}:i.preset&&(i.load.preset=i.preset),a.isUndefined(i.parent)&&i.hideable&&J.push(this),i.resizable=a.isUndefined(i.parent)&&i.resizable,i.autoPlace&&a.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,s=W&&"true"===localStorage.getItem(ne(0,"isLocal")),o=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:[a.toArray(arguments)]})}if(a.isArray(t)||a.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 k){var i=new N(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});a.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)}})),S.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof N){var r=function(t){if(a.isNumber(n.__min)&&a.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=a.compose(r,n.min),n.max=a.compose(r,n.max)}else n instanceof A?(S.bind(t,"click",(function(){S.fakeEvent(n.__checkbox,"click")})),S.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof D?(S.bind(t,"click",(function(){S.fakeEvent(n.__button,"click")})),S.bind(t,"mouseover",(function(){S.addClass(n.__button,"hover")})),S.bind(t,"mouseout",(function(){S.removeClass(n.__button,"hover")}))):n instanceof B&&(S.addClass(t,"color"),n.updateDisplay=a.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=a.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");S.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),S.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",S.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",S.addClass(i,"button"),S.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",S.addClass(r,"button"),S.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",S.addClass(s,"button"),S.addClass(s,"revert");var o=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?a.each(e.load.remembered,(function(t,n){ie(e,n,n===e.preset)})):ie(e,V,!1),S.bind(o,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=le(this)),e.folders={},a.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){a.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),a.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(){a.each(this.__controllers,(function(e){e.updateDisplay()})),a.each(this.__folders,(function(e){e.updateDisplay()}))}});const ue={color:{Color:_,math:d,interpret:u},controllers:{Controller:w,BooleanController:A,OptionController:L,StringController:C,NumberController:P,NumberControllerBox:N,NumberControllerSlider:k,FunctionController:D,ColorController:B},dom:{dom:S},gui:{GUI:Z},GUI:Z}},258:e=>{!function(t){e.exports=t;var n={on:function(e,t){return s(this,e).push(t),this},once:function(e,t){var n=this;return i.originalListener=t,s(n,e).push(i),n;function i(){r.call(n,e,i),t.apply(this,arguments)}},off:r,emit:function(e,t){var n=this,i=s(n,e,!0);if(!i)return!1;var r=arguments.length;if(1===r)i.forEach(o);else if(2===r)i.forEach(l);else{var a=Array.prototype.slice.call(arguments,1);i.forEach(c)}return!!i.length;function o(e){e.call(n)}function l(e){e.call(n,t)}function c(e){e.apply(n,a)}}};function i(e){for(var t in n)e[t]=n[t];return e}function r(e,t){var n,i=this;if(arguments.length){if(t){if(n=s(i,e,!0)){if(!(n=n.filter(a)).length)return r.call(i,e);i.listeners[e]=n}}else if((n=i.listeners)&&(delete n[e],!Object.keys(n).length))return r.call(i)}else delete i.listeners;return i;function a(e){return e!==t&&e.originalListener!==t}}function s(e,t,n){if(!n||e.listeners){var i=e.listeners||(e.listeners={});return i[t]||(i[t]=[])}}i(t.prototype),t.mixin=i}((function e(){if(!(this instanceof e))return new e}))},645:(e,t)=>{t.read=function(e,t,n,i,r){var s,a,o=8*r-i-1,l=(1<>1,u=-7,h=n?r-1:0,d=n?-1:1,p=e[t+h];for(h+=d,s=p&(1<<-u)-1,p>>=-u,u+=o;u>0;s=256*s+e[t+h],h+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=256*a+e[t+h],h+=d,u-=8);if(0===s)s=1-c;else{if(s===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,i),s-=c}return(p?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var a,o,l,c=8*s-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(o=0,a=u):a+h>=1?(o=(t*l-1)*Math.pow(2,r),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;e[n+p]=255&o,p+=f,o/=256,r-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*m}},166:function(e,t){!function(e){var t,n="undefined",i=n!==typeof Buffer&&Buffer,r=n!==typeof Uint8Array&&Uint8Array,s=n!==typeof ArrayBuffer&&ArrayBuffer,a=[0,0,0,0,0,0,0,0],o=Array.isArray||function(e){return!!e&&"[object Array]"==Object.prototype.toString.call(e)},l=4294967296;function c(o,c,x){var b=c?0:4,w=c?4:0,M=c?0:3,E=c?1:2,T=c?2:1,S=c?3:0,A=c?g:y,L=c?v:_,C=N.prototype,R="is"+o,P="_"+R;return C.buffer=void 0,C.offset=0,C[P]=!0,C.toNumber=I,C.toString=function(e){var t=this.buffer,n=this.offset,i=D(t,n+b),r=D(t,n+w),s="",a=!x&&2147483648&i;for(a&&(i=~i,r=l-r),e=e||10;;){var o=i%e*l+r;if(i=Math.floor(i/e),r=Math.floor(o/e),s=(o%e).toString(e)+s,!i&&!r)break}return a&&(s="-"+s),s},C.toJSON=I,C.toArray=u,i&&(C.toBuffer=h),r&&(C.toArrayBuffer=d),N[R]=function(e){return!(!e||!e[P])},e[o]=N,N;function N(e,i,o,c){return this instanceof N?function(e,i,o,c,u){r&&s&&(i instanceof s&&(i=new r(i)),c instanceof s&&(c=new r(c))),i||o||c||t?(p(i,o)||(u=o,c=i,o=0,i=new(t||Array)(8)),e.buffer=i,e.offset=o|=0,n!==typeof c&&("string"==typeof c?function(e,t,n,i){var r=0,s=n.length,a=0,o=0;"-"===n[0]&&r++;for(var c=r;r=0))break;o=o*i+u,a=a*i+Math.floor(o/l),o%=l}c&&(a=~a,o?o=l-o:a++),k(e,t+b,a),k(e,t+w,o)}(i,o,c,u||10):p(c,u)?f(i,o,c,u):"number"==typeof u?(k(i,o+b,c),k(i,o+w,u)):c>0?A(i,o,c):c<0?L(i,o,c):f(i,o,a,0))):e.buffer=m(a,0)}(this,e,i,o,c):new N(e,i,o,c)}function I(){var e=this.buffer,t=this.offset,n=D(e,t+b),i=D(e,t+w);return x||(n|=0),n?n*l+i:i}function k(e,t,n){e[t+S]=255&n,n>>=8,e[t+T]=255&n,n>>=8,e[t+E]=255&n,n>>=8,e[t+M]=255&n}function D(e,t){return 16777216*e[t+M]+(e[t+E]<<16)+(e[t+T]<<8)+e[t+S]}}function u(e){var n=this.buffer,i=this.offset;return t=null,!1!==e&&0===i&&8===n.length&&o(n)?n:m(n,i)}function h(e){var n=this.buffer,r=this.offset;if(t=i,!1!==e&&0===r&&8===n.length&&Buffer.isBuffer(n))return n;var s=new i(8);return f(s,0,n,r),s}function d(e){var n=this.buffer,i=this.offset,a=n.buffer;if(t=r,!1!==e&&0===i&&a instanceof s&&8===a.byteLength)return a;var o=new r(8);return f(o,0,n,i),o.buffer}function p(e,t){var n=e&&e.length;return t|=0,n&&t+8<=n&&"string"!=typeof e[t]}function f(e,t,n,i){t|=0,i|=0;for(var r=0;r<8;r++)e[t++]=255&n[i++]}function m(e,t){return Array.prototype.slice.call(e,t,t+8)}function g(e,t,n){for(var i=t+8;i>t;)e[--i]=255&n,n/=256}function v(e,t,n){var i=t+8;for(n++;i>t;)e[--i]=255&-n^255,n/=256}function y(e,t,n){for(var i=t+8;t{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},374:(e,t,n)=>{t.encode=n(764).encode,t.decode=n(299).decode,t.Encoder=n(883).Encoder,t.Decoder=n(441).Decoder,t.createCodec=n(832).createCodec,t.codec=n(766).codec},679:function(e){function t(e){return e&&e.isBuffer&&e}e.exports=t("undefined"!=typeof Buffer&&Buffer)||t(this.Buffer)||t("undefined"!=typeof window&&window.Buffer)||this.Buffer},947:(e,t)=>{t.copy=function(e,t,n,i){var r;n||(n=0),i||0===i||(i=this.length),t||(t=0);var s=i-n;if(e===this&&n=0;r--)e[r+t]=this[r+n];else for(r=0;r=65536?(a-=65536,s+=String.fromCharCode(55296+(a>>>10),56320+(1023&a))):s+=String.fromCharCode(a));return s},t.write=function(e,t){for(var n=this,i=t||(t|=0),r=e.length,s=0,a=0;a>>6,n[i++]=128|63&s):s<55296||s>57343?(n[i++]=224|s>>>12,n[i++]=128|s>>>6&63,n[i++]=128|63&s):(s=65536+(s-55296<<10|e.charCodeAt(a++)-56320),n[i++]=240|s>>>18,n[i++]=128|s>>>12&63,n[i++]=128|s>>>6&63,n[i++]=128|63&s);return i-t}},683:(e,t,n)=>{var i=n(895),r=e.exports=s(0);function s(e){return new Array(e)}r.alloc=s,r.concat=i.concat,r.from=function(e){if(!i.isBuffer(e)&&i.isView(e))e=i.Uint8Array.from(e);else if(i.isArrayBuffer(e))e=new Uint8Array(e);else{if("string"==typeof e)return i.from.call(r,e);if("number"==typeof e)throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(e)}},580:(e,t,n)=>{var i=n(895),r=i.global,s=e.exports=i.hasBuffer?a(0):[];function a(e){return new r(e)}s.alloc=i.hasBuffer&&r.alloc||a,s.concat=i.concat,s.from=function(e){if(!i.isBuffer(e)&&i.isView(e))e=i.Uint8Array.from(e);else if(i.isArrayBuffer(e))e=new Uint8Array(e);else{if("string"==typeof e)return i.from.call(s,e);if("number"==typeof e)throw new TypeError('"value" argument must not be a number')}return r.from&&1!==r.from.length?r.from(e):new r(e)}},190:(e,t,n)=>{var i=n(947);t.copy=l,t.slice=c,t.toString=function(e,t,n){var s=!a&&r.isBuffer(this)?this.toString:i.toString;return s.apply(this,arguments)},t.write=("write",function(){return(this.write||i.write).apply(this,arguments)});var r=n(895),s=r.global,a=r.hasBuffer&&"TYPED_ARRAY_SUPPORT"in s,o=a&&!s.TYPED_ARRAY_SUPPORT;function l(e,t,n,s){var a=r.isBuffer(this),l=r.isBuffer(e);if(a&&l)return this.copy(e,t,n,s);if(o||a||l||!r.isView(this)||!r.isView(e))return i.copy.call(this,e,t,n,s);var u=n||null!=s?c.call(this,n,s):this;return e.set(u,t),u.length}function c(e,t){var n=this.slice||!o&&this.subarray;if(n)return n.call(this,e,t);var i=r.alloc.call(this,t-e);return l.call(this,i,0,e,t),i}},37:(e,t,n)=>{var i=n(895),r=e.exports=i.hasArrayBuffer?s(0):[];function s(e){return new Uint8Array(e)}r.alloc=s,r.concat=i.concat,r.from=function(e){if(i.isView(e)){var t=e.byteOffset,n=e.byteLength;(e=e.buffer).byteLength!==n&&(e.slice?e=e.slice(t,t+n):(e=new Uint8Array(e)).byteLength!==n&&(e=Array.prototype.slice.call(e,t,t+n)))}else{if("string"==typeof e)return i.from.call(r,e);if("number"==typeof e)throw new TypeError('"value" argument must not be a number')}return new Uint8Array(e)}},895:(e,t,n)=>{var i=t.global=n(679),r=t.hasBuffer=i&&!!i.isBuffer,s=t.hasArrayBuffer="undefined"!=typeof ArrayBuffer,a=t.isArray=n(826);t.isArrayBuffer=s?function(e){return e instanceof ArrayBuffer||f(e)}:v;var o=t.isBuffer=r?i.isBuffer:v,l=t.isView=s?ArrayBuffer.isView||y("ArrayBuffer","buffer"):v;t.alloc=p,t.concat=function(e,n){n||(n=0,Array.prototype.forEach.call(e,(function(e){n+=e.length})));var i=this!==t&&this||e[0],r=p.call(i,n),s=0;return Array.prototype.forEach.call(e,(function(e){s+=d.copy.call(e,r,s)})),r},t.from=function(e){return"string"==typeof e?m.call(this,e):g(this).from(e)};var c=t.Array=n(683),u=t.Buffer=n(580),h=t.Uint8Array=n(37),d=t.prototype=n(190);function p(e){return g(this).alloc(e)}var f=y("ArrayBuffer");function m(e){var t=3*e.length,n=p.call(this,t),i=d.write.call(n,e);return t!==i&&(n=d.slice.call(n,0,i)),n}function g(e){return o(e)?u:l(e)?h:a(e)?c:r?u:s?h:c}function v(){return!1}function y(e,t){return e="[object "+e+"]",function(n){return null!=n&&{}.toString.call(t?n[t]:n)===e}}},877:(e,t,n)=>{var i=n(826);t.createCodec=o,t.install=function(e){for(var t in e)s.prototype[t]=a(s.prototype[t],e[t])},t.filter=function(e){return i(e)?function(e){return e=e.slice(),function(n){return e.reduce(t,n)};function t(e,t){return t(e)}}(e):e};var r=n(895);function s(e){if(!(this instanceof s))return new s(e);this.options=e,this.init()}function a(e,t){return e&&t?function(){return e.apply(this,arguments),t.apply(this,arguments)}:e||t}function o(e){return new s(e)}s.prototype.init=function(){var e=this.options;return e&&e.uint8array&&(this.bufferish=r.Uint8Array),this},t.preset=o({preset:!0})},766:(e,t,n)=>{n(350),n(312),t.codec={preset:n(877).preset}},170:(e,t,n)=>{t.T=r;var i=n(350).preset;function r(e){if(!(this instanceof r))return new r(e);if(e&&(this.options=e,e.codec)){var t=this.codec=e.codec;t.bufferish&&(this.bufferish=t.bufferish)}}n(822).k.mixin(r.prototype),r.prototype.codec=i,r.prototype.fetch=function(){return this.codec.decode(this)}},299:(e,t,n)=>{t.decode=function(e,t){var n=new i(t);return n.write(e),n.read()};var i=n(170).T},441:(e,t,n)=>{t.Decoder=s;var i=n(258),r=n(170).T;function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}s.prototype=new r,i.mixin(s.prototype),s.prototype.decode=function(e){arguments.length&&this.write(e),this.flush()},s.prototype.push=function(e){this.emit("data",e)},s.prototype.end=function(e){this.decode(e),this.emit("end")}},517:(e,t,n)=>{t.F=r;var i=n(312).preset;function r(e){if(!(this instanceof r))return new r(e);if(e&&(this.options=e,e.codec)){var t=this.codec=e.codec;t.bufferish&&(this.bufferish=t.bufferish)}}n(822).I.mixin(r.prototype),r.prototype.codec=i,r.prototype.write=function(e){this.codec.encode(this,e)}},764:(e,t,n)=>{t.encode=function(e,t){var n=new i(t);return n.write(e),n.read()};var i=n(517).F},883:(e,t,n)=>{t.Encoder=s;var i=n(258),r=n(517).F;function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}s.prototype=new r,i.mixin(s.prototype),s.prototype.encode=function(e){this.write(e),this.emit("data",this.read())},s.prototype.end=function(e){arguments.length&&this.encode(e),this.flush(),this.emit("end")}},83:(e,t,n)=>{t.S=function e(t,n){if(!(this instanceof e))return new e(t,n);this.buffer=i.from(t),this.type=n};var i=n(895)},431:(e,t,n)=>{t.setExtPackers=function(e){e.addExtPacker(14,Error,[h,l]),e.addExtPacker(1,EvalError,[h,l]),e.addExtPacker(2,RangeError,[h,l]),e.addExtPacker(3,ReferenceError,[h,l]),e.addExtPacker(4,SyntaxError,[h,l]),e.addExtPacker(5,TypeError,[h,l]),e.addExtPacker(6,URIError,[h,l]),e.addExtPacker(10,RegExp,[u,l]),e.addExtPacker(11,Boolean,[c,l]),e.addExtPacker(12,String,[c,l]),e.addExtPacker(13,Date,[Number,l]),e.addExtPacker(15,Number,[c,l]),"undefined"!=typeof Uint8Array&&(e.addExtPacker(17,Int8Array,a),e.addExtPacker(18,Uint8Array,a),e.addExtPacker(19,Int16Array,a),e.addExtPacker(20,Uint16Array,a),e.addExtPacker(21,Int32Array,a),e.addExtPacker(22,Uint32Array,a),e.addExtPacker(23,Float32Array,a),"undefined"!=typeof Float64Array&&e.addExtPacker(24,Float64Array,a),"undefined"!=typeof Uint8ClampedArray&&e.addExtPacker(25,Uint8ClampedArray,a),e.addExtPacker(26,ArrayBuffer,a),e.addExtPacker(29,DataView,a)),r.hasBuffer&&e.addExtPacker(27,s,r.from)};var i,r=n(895),s=r.global,a=r.Uint8Array.from,o={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1};function l(e){return i||(i=n(764).encode),i(e)}function c(e){return e.valueOf()}function u(e){(e=RegExp.prototype.toString.call(e).split("/")).shift();var t=[e.pop()];return t.unshift(e.join("/")),t}function h(e){var t={};for(var n in o)t[n]=e[n];return t}},600:(e,t,n)=>{t.setExtUnpackers=function(e){e.addExtUnpacker(14,[o,c(Error)]),e.addExtUnpacker(1,[o,c(EvalError)]),e.addExtUnpacker(2,[o,c(RangeError)]),e.addExtUnpacker(3,[o,c(ReferenceError)]),e.addExtUnpacker(4,[o,c(SyntaxError)]),e.addExtUnpacker(5,[o,c(TypeError)]),e.addExtUnpacker(6,[o,c(URIError)]),e.addExtUnpacker(10,[o,l]),e.addExtUnpacker(11,[o,u(Boolean)]),e.addExtUnpacker(12,[o,u(String)]),e.addExtUnpacker(13,[o,u(Date)]),e.addExtUnpacker(15,[o,u(Number)]),"undefined"!=typeof Uint8Array&&(e.addExtUnpacker(17,u(Int8Array)),e.addExtUnpacker(18,u(Uint8Array)),e.addExtUnpacker(19,[h,u(Int16Array)]),e.addExtUnpacker(20,[h,u(Uint16Array)]),e.addExtUnpacker(21,[h,u(Int32Array)]),e.addExtUnpacker(22,[h,u(Uint32Array)]),e.addExtUnpacker(23,[h,u(Float32Array)]),"undefined"!=typeof Float64Array&&e.addExtUnpacker(24,[h,u(Float64Array)]),"undefined"!=typeof Uint8ClampedArray&&e.addExtUnpacker(25,u(Uint8ClampedArray)),e.addExtUnpacker(26,h),e.addExtUnpacker(29,[h,u(DataView)])),r.hasBuffer&&e.addExtUnpacker(27,u(s))};var i,r=n(895),s=r.global,a={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1};function o(e){return i||(i=n(299).decode),i(e)}function l(e){return RegExp.apply(null,e)}function c(e){return function(t){var n=new e;for(var i in a)n[i]=t[i];return n}}function u(e){return function(t){return new e(t)}}function h(e){return new Uint8Array(e).buffer}},832:(e,t,n)=>{n(350),n(312),t.createCodec=n(877).createCodec},822:(e,t,n)=>{t.k=s,t.I=a;var i=n(895),r="BUFFER_SHORTAGE";function s(){if(!(this instanceof s))return new s}function a(){if(!(this instanceof a))return new a}function o(){return this.buffers&&this.buffers.length?(this.flush(),this.pull()):this.fetch()}function l(e){(this.buffers||(this.buffers=[])).push(e)}function c(e){return function(t){for(var n in e)t[n]=e[n];return t}}s.mixin=c({bufferish:i,write:function(e){var t=this.offset?i.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=t?e?this.bufferish.concat([t,e]):t:e,this.offset=0},fetch:function(){throw new Error("method not implemented: fetch()")},flush:function(){for(;this.offsetthis.buffer.length)throw new Error(r);return this.offset=n,t},offset:0}),s.mixin(s.prototype),a.mixin=c({bufferish:i,write:function(){throw new Error("method not implemented: write()")},fetch:function(){var e=this.start;if(e1?this.bufferish.concat(e):e[0];return e.length=0,t},read:o,reserve:function(e){var t=0|e;if(this.buffer){var n=this.buffer.length,i=0|this.offset,r=i+t;if(rthis.minBufferSize)this.flush(),this.push(e);else{var n=this.reserve(t);i.prototype.copy.call(e,this.buffer,n)}},maxBufferSize:65536,minBufferSize:2048,offset:0,start:0}),a.mixin(a.prototype)},350:(e,t,n)=>{var i=n(83).S,r=n(600),s=n(76).readUint8,a=n(738),o=n(877);function l(){var e=this.options;return this.decode=function(e){var t=a.getReadToken(e);return function(e){var n=s(e),i=t[n];if(!i)throw new Error("Invalid type: "+(n?"0x"+n.toString(16):n));return i(e)}}(e),e&&e.preset&&r.setExtUnpackers(this),this}o.install({addExtUnpacker:function(e,t){(this.extUnpackers||(this.extUnpackers=[]))[e]=o.filter(t)},getExtUnpacker:function(e){return(this.extUnpackers||(this.extUnpackers=[]))[e]||function(t){return new i(t,e)}},init:l}),t.preset=l.call(o.preset)},76:(e,t,n)=>{var i=n(645),r=n(166),s=r.Uint64BE,a=r.Int64BE;t.getReadFormat=function(e){var t=o.hasArrayBuffer&&e&&e.binarraybuffer,n=e&&e.int64;return{map:c&&e&&e.usemap?h:u,array:d,str:p,bin:t?m:f,ext:g,uint8:v,uint16:_,uint32:b,uint64:M(8,n?S:E),int8:y,int16:x,int32:w,int64:M(8,n?A:T),float32:M(4,L),float64:M(8,C)}},t.readUint8=v;var o=n(895),l=n(190),c="undefined"!=typeof Map;function u(e,t){var n,i={},r=new Array(t),s=new Array(t),a=e.codec.decode;for(n=0;n{var i=n(76);function r(e){var t,n=new Array(256);for(t=0;t<=127;t++)n[t]=s(t);for(t=128;t<=143;t++)n[t]=o(t-128,e.map);for(t=144;t<=159;t++)n[t]=o(t-144,e.array);for(t=160;t<=191;t++)n[t]=o(t-160,e.str);for(n[192]=s(null),n[193]=null,n[194]=s(!1),n[195]=s(!0),n[196]=a(e.uint8,e.bin),n[197]=a(e.uint16,e.bin),n[198]=a(e.uint32,e.bin),n[199]=a(e.uint8,e.ext),n[200]=a(e.uint16,e.ext),n[201]=a(e.uint32,e.ext),n[202]=e.float32,n[203]=e.float64,n[204]=e.uint8,n[205]=e.uint16,n[206]=e.uint32,n[207]=e.uint64,n[208]=e.int8,n[209]=e.int16,n[210]=e.int32,n[211]=e.int64,n[212]=o(1,e.ext),n[213]=o(2,e.ext),n[214]=o(4,e.ext),n[215]=o(8,e.ext),n[216]=o(16,e.ext),n[217]=a(e.uint8,e.str),n[218]=a(e.uint16,e.str),n[219]=a(e.uint32,e.str),n[220]=a(e.uint16,e.array),n[221]=a(e.uint32,e.array),n[222]=a(e.uint16,e.map),n[223]=a(e.uint32,e.map),t=224;t<=255;t++)n[t]=s(t-256);return n}function s(e){return function(){return e}}function a(e,t){return function(n){var i=e(n);return t(n,i)}}function o(e,t){return function(n){return t(n,e)}}t.getReadToken=function(e){var t=i.getReadFormat(e);return e&&e.useraw?function(e){var t,n=r(e).slice();for(n[217]=n[196],n[218]=n[197],n[219]=n[198],t=160;t<=191;t++)n[t]=o(t-160,e.bin);return n}(t):r(t)}},312:(e,t,n)=>{var i=n(83).S,r=n(431),s=n(943),a=n(877);function o(){var e=this.options;return this.encode=function(e){var t=s.getWriteType(e);return function(e,n){var i=t[typeof n];if(!i)throw new Error('Unsupported type "'+typeof n+'": '+n);i(e,n)}}(e),e&&e.preset&&r.setExtPackers(this),this}a.install({addExtPacker:function(e,t,n){n=a.filter(n);var r=t.name;function s(t){return n&&(t=n(t)),new i(t,e)}r&&"Object"!==r?(this.extPackers||(this.extPackers={}))[r]=s:(this.extEncoderList||(this.extEncoderList=[])).unshift([t,s])},getExtPacker:function(e){var t=this.extPackers||(this.extPackers={}),n=e.constructor,i=n&&n.name&&t[n.name];if(i)return i;for(var r=this.extEncoderList||(this.extEncoderList=[]),s=r.length,a=0;a{var i=n(645),r=n(166),s=r.Uint64BE,a=r.Int64BE,o=n(370).w,l=n(895),c=l.global,u=l.hasBuffer&&"TYPED_ARRAY_SUPPORT"in c&&!c.TYPED_ARRAY_SUPPORT,h=l.hasBuffer&&c.prototype||{};function d(){var e=o.slice();return e[196]=p(196),e[197]=f(197),e[198]=m(198),e[199]=p(199),e[200]=f(200),e[201]=m(201),e[202]=g(202,4,h.writeFloatBE||_,!0),e[203]=g(203,8,h.writeDoubleBE||x,!0),e[204]=p(204),e[205]=f(205),e[206]=m(206),e[207]=g(207,8,v),e[208]=p(208),e[209]=f(209),e[210]=m(210),e[211]=g(211,8,y),e[217]=p(217),e[218]=f(218),e[219]=m(219),e[220]=f(220),e[221]=m(221),e[222]=f(222),e[223]=m(223),e}function p(e){return function(t,n){var i=t.reserve(2),r=t.buffer;r[i++]=e,r[i]=n}}function f(e){return function(t,n){var i=t.reserve(3),r=t.buffer;r[i++]=e,r[i++]=n>>>8,r[i]=n}}function m(e){return function(t,n){var i=t.reserve(5),r=t.buffer;r[i++]=e,r[i++]=n>>>24,r[i++]=n>>>16,r[i++]=n>>>8,r[i]=n}}function g(e,t,n,i){return function(r,s){var a=r.reserve(t+1);r.buffer[a++]=e,n.call(r.buffer,s,a,i)}}function v(e,t){new s(this,t,e)}function y(e,t){new a(this,t,e)}function _(e,t){i.write(this,e,t,!1,23,4)}function x(e,t){i.write(this,e,t,!1,52,8)}t.getWriteToken=function(e){return e&&e.uint8array?((t=d())[202]=g(202,4,_),t[203]=g(203,8,x),t):u||l.hasBuffer&&e&&e.safe?function(){var e=o.slice();return e[196]=g(196,1,c.prototype.writeUInt8),e[197]=g(197,2,c.prototype.writeUInt16BE),e[198]=g(198,4,c.prototype.writeUInt32BE),e[199]=g(199,1,c.prototype.writeUInt8),e[200]=g(200,2,c.prototype.writeUInt16BE),e[201]=g(201,4,c.prototype.writeUInt32BE),e[202]=g(202,4,c.prototype.writeFloatBE),e[203]=g(203,8,c.prototype.writeDoubleBE),e[204]=g(204,1,c.prototype.writeUInt8),e[205]=g(205,2,c.prototype.writeUInt16BE),e[206]=g(206,4,c.prototype.writeUInt32BE),e[207]=g(207,8,v),e[208]=g(208,1,c.prototype.writeInt8),e[209]=g(209,2,c.prototype.writeInt16BE),e[210]=g(210,4,c.prototype.writeInt32BE),e[211]=g(211,8,y),e[217]=g(217,1,c.prototype.writeUInt8),e[218]=g(218,2,c.prototype.writeUInt16BE),e[219]=g(219,4,c.prototype.writeUInt32BE),e[220]=g(220,2,c.prototype.writeUInt16BE),e[221]=g(221,4,c.prototype.writeUInt32BE),e[222]=g(222,2,c.prototype.writeUInt16BE),e[223]=g(223,4,c.prototype.writeUInt32BE),e}():d();var t}},943:(e,t,n)=>{var i=n(826),r=n(166),s=r.Uint64BE,a=r.Int64BE,o=n(895),l=n(190),c=n(598),u=n(370).w,h=n(83).S,d="undefined"!=typeof Uint8Array,p="undefined"!=typeof Map,f=[];f[1]=212,f[2]=213,f[4]=214,f[8]=215,f[16]=216,t.getWriteType=function(e){var t,n=c.getWriteToken(e),r=e&&e.useraw,m=d&&e&&e.binarraybuffer,g=m?o.isArrayBuffer:o.isBuffer,v=m?function(e,t){b(e,new Uint8Array(t))}:b,y=p&&e&&e.usemap?function(e,t){if(!(t instanceof Map))return w(e,t);var i=t.size;n[i<16?128+i:i<=65535?222:223](e,i);var r=e.codec.encode;t.forEach((function(t,n,i){r(e,n),r(e,t)}))}:w;return{boolean:function(e,t){n[t?195:194](e,t)},function:x,number:function(e,t){var i=0|t;t===i?n[-32<=i&&i<=127?255&i:0<=i?i<=255?204:i<=65535?205:206:-128<=i?208:-32768<=i?209:210](e,i):n[203](e,t)},object:r?function(e,t){if(g(t))return function(e,t){var i=t.length;n[i<32?160+i:i<=65535?218:219](e,i),e.send(t)}(e,t);_(e,t)}:_,string:(t=r?function(e){return e<32?1:e<=65535?3:5}:function(e){return e<32?1:e<=255?2:e<=65535?3:5},function(e,i){var r=i.length,s=5+3*r;e.offset=e.reserve(s);var a=e.buffer,o=t(r),c=e.offset+o;r=l.write.call(a,i,c);var u=t(r);if(o!==u){var h=c+u-o,d=c+r;l.copy.call(a,a,h,c,d)}n[1===u?160+r:u<=3?215+u:219](e,r),e.offset+=r}),symbol:x,undefined:x};function _(e,t){if(null===t)return x(e,t);if(g(t))return v(e,t);if(i(t))return function(e,t){var i=t.length;n[i<16?144+i:i<=65535?220:221](e,i);for(var r=e.codec.encode,s=0;s{for(var n=t.w=new Array(256),i=0;i<=255;i++)n[i]=r(i);function r(e){return function(t){var n=t.reserve(1);t.buffer[n]=e}}},212:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ACESFilmicToneMapping:()=>ne,AddEquation:()=>T,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>qt,AdditiveBlending:()=>b,AlphaFormat:()=>Be,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>En,AmbientLight:()=>id,AmbientLightProbe:()=>Td,AnimationClip:()=>Th,AnimationLoader:()=>Ih,AnimationMixer:()=>np,AnimationObjectGroup:()=>ep,AnimationUtils:()=>dh,ArcCurve:()=>Yc,ArrayCamera:()=>_l,ArrowHelper:()=>qp,Audio:()=>Bd,AudioAnalyser:()=>Gd,AudioContext:()=>wd,AudioListener:()=>Dd,AudioLoader:()=>Md,AxesHelper:()=>Xp,AxisHelper:()=>wf,BackSide:()=>m,BasicDepthPacking:()=>sn,BasicShadowMap:()=>u,BinaryTextureLoader:()=>Af,Bone:()=>rc,BooleanKeyframeTrack:()=>yh,BoundingBoxHelper:()=>Mf,Box2:()=>dp,Box3:()=>ui,Box3Helper:()=>Hp,BoxBufferGeometry:()=>xs,BoxGeometry:()=>xs,BoxHelper:()=>zp,BufferAttribute:()=>Ir,BufferGeometry:()=>es,BufferGeometryLoader:()=>hd,ByteType:()=>Te,Cache:()=>Ah,Camera:()=>Ts,CameraHelper:()=>Op,CanvasRenderer:()=>Cf,CanvasTexture:()=>kc,CatmullRomCurve3:()=>eu,CineonToneMapping:()=>te,CircleBufferGeometry:()=>Bc,CircleGeometry:()=>Bc,ClampToEdgeWrapping:()=>de,Clock:()=>Cd,Color:()=>Cr,ColorKeyframeTrack:()=>_h,CompressedTexture:()=>Ic,CompressedTextureLoader:()=>kh,ConeBufferGeometry:()=>Fc,ConeGeometry:()=>Fc,CubeCamera:()=>Ls,CubeReflectionMapping:()=>se,CubeRefractionMapping:()=>ae,CubeTexture:()=>Cs,CubeTextureLoader:()=>Bh,CubeUVReflectionMapping:()=>ce,CubeUVRefractionMapping:()=>ue,CubicBezierCurve:()=>ru,CubicBezierCurve3:()=>su,CubicInterpolant:()=>fh,CullFaceBack:()=>o,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>a,Curve:()=>qc,CurvePath:()=>Uh,CustomBlending:()=>E,CustomToneMapping:()=>ie,CylinderBufferGeometry:()=>Oc,CylinderGeometry:()=>Oc,Cylindrical:()=>up,DataTexture:()=>sc,DataTexture2DArray:()=>Ra,DataTexture3D:()=>Pa,DataTextureLoader:()=>Oh,DataUtils:()=>Zp,DecrementStencilOp:()=>pn,DecrementWrapStencilOp:()=>mn,DefaultLoadingManager:()=>Ch,DepthFormat:()=>Ge,DepthStencilFormat:()=>Ve,DepthTexture:()=>Dc,DirectionalLight:()=>nd,DirectionalLightHelper:()=>kp,DiscreteInterpolant:()=>gh,DodecahedronBufferGeometry:()=>zc,DodecahedronGeometry:()=>zc,DoubleSide:()=>g,DstAlphaFactor:()=>B,DstColorFactor:()=>F,DynamicBufferAttribute:()=>df,DynamicCopyUsage:()=>Nn,DynamicDrawUsage:()=>Sn,DynamicReadUsage:()=>Cn,EdgesGeometry:()=>jc,EdgesHelper:()=>Ef,EllipseCurve:()=>Xc,EqualDepth:()=>j,EqualStencilFunc:()=>_n,EquirectangularReflectionMapping:()=>oe,EquirectangularRefractionMapping:()=>le,Euler:()=>Yi,EventDispatcher:()=>Bn,ExtrudeBufferGeometry:()=>Uu,ExtrudeGeometry:()=>Uu,FaceColors:()=>ef,FileLoader:()=>Nh,FlatShading:()=>v,Float16BufferAttribute:()=>Hr,Float32Attribute:()=>xf,Float32BufferAttribute:()=>Gr,Float64Attribute:()=>bf,Float64BufferAttribute:()=>Vr,FloatType:()=>Re,Fog:()=>Ll,FogExp2:()=>Al,Font:()=>yd,FontLoader:()=>xd,FrontSide:()=>f,Frustum:()=>Os,GLBufferAttribute:()=>sp,GLSL1:()=>kn,GLSL3:()=>Dn,GammaEncoding:()=>Qt,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>Mn,GreaterStencilFunc:()=>bn,GridHelper:()=>Cp,Group:()=>xl,HalfFloatType:()=>Pe,HemisphereLight:()=>Vh,HemisphereLightHelper:()=>Lp,HemisphereLightProbe:()=>Ed,IcosahedronBufferGeometry:()=>Hu,IcosahedronGeometry:()=>Hu,ImageBitmapLoader:()=>gd,ImageLoader:()=>Dh,ImageUtils:()=>Qn,ImmediateRenderObject:()=>gp,IncrementStencilOp:()=>dn,IncrementWrapStencilOp:()=>fn,InstancedBufferAttribute:()=>ud,InstancedBufferGeometry:()=>cd,InstancedInterleavedBuffer:()=>rp,InstancedMesh:()=>pc,Int16Attribute:()=>gf,Int16BufferAttribute:()=>Or,Int32Attribute:()=>yf,Int32BufferAttribute:()=>Ur,Int8Attribute:()=>pf,Int8BufferAttribute:()=>kr,IntType:()=>Le,InterleavedBuffer:()=>Rl,InterleavedBufferAttribute:()=>Nl,Interpolant:()=>ph,InterpolateDiscrete:()=>Ut,InterpolateLinear:()=>zt,InterpolateSmooth:()=>Ht,InvertStencilOp:()=>gn,JSONLoader:()=>Rf,KeepStencilOp:()=>un,KeyframeTrack:()=>vh,LOD:()=>Kl,LatheBufferGeometry:()=>Gu,LatheGeometry:()=>Gu,Layers:()=>Ji,LensFlare:()=>Nf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>xn,LessStencilFunc:()=>yn,Light:()=>Gh,LightProbe:()=>ad,Line:()=>xc,Line3:()=>mp,LineBasicMaterial:()=>fc,LineCurve:()=>au,LineCurve3:()=>ou,LineDashedMaterial:()=>uh,LineLoop:()=>Ec,LinePieces:()=>Qp,LineSegments:()=>Mc,LineStrip:()=>Kp,LinearEncoding:()=>Zt,LinearFilter:()=>_e,LinearInterpolant:()=>mh,LinearMipMapLinearFilter:()=>Me,LinearMipMapNearestFilter:()=>be,LinearMipmapLinearFilter:()=>we,LinearMipmapNearestFilter:()=>xe,LinearToneMapping:()=>$,Loader:()=>Rh,LoaderUtils:()=>ld,LoadingManager:()=>Lh,LogLuvEncoding:()=>en,LoopOnce:()=>Bt,LoopPingPong:()=>Ft,LoopRepeat:()=>Ot,LuminanceAlphaFormat:()=>ze,LuminanceFormat:()=>Ue,MOUSE:()=>r,Material:()=>wr,MaterialLoader:()=>od,Math:()=>Yn,MathUtils:()=>Yn,Matrix3:()=>Zn,Matrix4:()=>Fi,MaxEquation:()=>C,Mesh:()=>ys,MeshBasicMaterial:()=>Rr,MeshDepthMaterial:()=>pl,MeshDistanceMaterial:()=>fl,MeshFaceMaterial:()=>nf,MeshLambertMaterial:()=>lh,MeshMatcapMaterial:()=>ch,MeshNormalMaterial:()=>oh,MeshPhongMaterial:()=>sh,MeshPhysicalMaterial:()=>rh,MeshStandardMaterial:()=>ih,MeshToonMaterial:()=>ah,MinEquation:()=>L,MirroredRepeatWrapping:()=>pe,MixOperation:()=>Z,MultiMaterial:()=>rf,MultiplyBlending:()=>M,MultiplyOperation:()=>J,NearestFilter:()=>fe,NearestMipMapLinearFilter:()=>ye,NearestMipMapNearestFilter:()=>ge,NearestMipmapLinearFilter:()=>ve,NearestMipmapNearestFilter:()=>me,NeverDepth:()=>H,NeverStencilFunc:()=>vn,NoBlending:()=>_,NoColors:()=>$p,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>jt,NormalBlending:()=>x,NotEqualDepth:()=>Y,NotEqualStencilFunc:()=>wn,NumberKeyframeTrack:()=>xh,Object3D:()=>cr,ObjectLoader:()=>dd,ObjectSpaceNormalMap:()=>ln,OctahedronBufferGeometry:()=>Vu,OctahedronGeometry:()=>Vu,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>O,OneMinusDstColorFactor:()=>U,OneMinusSrcAlphaFactor:()=>D,OneMinusSrcColorFactor:()=>I,OrthographicCamera:()=>Zs,PCFShadowMap:()=>h,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>fa,ParametricBufferGeometry:()=>Wu,ParametricGeometry:()=>Wu,Particle:()=>af,ParticleBasicMaterial:()=>cf,ParticleSystem:()=>of,ParticleSystemMaterial:()=>uf,Path:()=>zh,PerspectiveCamera:()=>Ss,Plane:()=>ks,PlaneBufferGeometry:()=>zs,PlaneGeometry:()=>zs,PlaneHelper:()=>Gp,PointCloud:()=>sf,PointCloudMaterial:()=>lf,PointLight:()=>ed,PointLightHelper:()=>Ep,Points:()=>Rc,PointsMaterial:()=>Tc,PolarGridHelper:()=>Rp,PolyhedronBufferGeometry:()=>Uc,PolyhedronGeometry:()=>Uc,PositionalAudio:()=>Hd,PropertyBinding:()=>$d,PropertyMixer:()=>Vd,QuadraticBezierCurve:()=>lu,QuadraticBezierCurve3:()=>cu,Quaternion:()=>ai,QuaternionKeyframeTrack:()=>wh,QuaternionLinearInterpolant:()=>bh,REVISION:()=>i,RGBADepthPacking:()=>an,RGBAFormat:()=>Fe,RGBAIntegerFormat:()=>Je,RGBA_ASTC_10x10_Format:()=>yt,RGBA_ASTC_10x5_Format:()=>mt,RGBA_ASTC_10x6_Format:()=>gt,RGBA_ASTC_10x8_Format:()=>vt,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>xt,RGBA_ASTC_4x4_Format:()=>ot,RGBA_ASTC_5x4_Format:()=>lt,RGBA_ASTC_5x5_Format:()=>ct,RGBA_ASTC_6x5_Format:()=>ut,RGBA_ASTC_6x6_Format:()=>ht,RGBA_ASTC_8x5_Format:()=>dt,RGBA_ASTC_8x6_Format:()=>pt,RGBA_ASTC_8x8_Format:()=>ft,RGBA_BPTC_Format:()=>bt,RGBA_ETC2_EAC_Format:()=>at,RGBA_PVRTC_2BPPV1_Format:()=>it,RGBA_PVRTC_4BPPV1_Format:()=>nt,RGBA_S3TC_DXT1_Format:()=>Ke,RGBA_S3TC_DXT3_Format:()=>Qe,RGBA_S3TC_DXT5_Format:()=>$e,RGBDEncoding:()=>rn,RGBEEncoding:()=>$t,RGBEFormat:()=>He,RGBFormat:()=>Oe,RGBIntegerFormat:()=>Ye,RGBM16Encoding:()=>nn,RGBM7Encoding:()=>tn,RGB_ETC1_Format:()=>rt,RGB_ETC2_Format:()=>st,RGB_PVRTC_2BPPV1_Format:()=>tt,RGB_PVRTC_4BPPV1_Format:()=>et,RGB_S3TC_DXT1_Format:()=>Ze,RGFormat:()=>qe,RGIntegerFormat:()=>Xe,RawShaderMaterial:()=>Ks,Ray:()=>Oi,Raycaster:()=>ap,RectAreaLight:()=>rd,RedFormat:()=>We,RedIntegerFormat:()=>je,ReinhardToneMapping:()=>ee,RepeatWrapping:()=>he,ReplaceStencilOp:()=>hn,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>ju,RingGeometry:()=>ju,SRGB8_ALPHA8_ASTC_10x10_Format:()=>It,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Rt,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Pt,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Nt,SRGB8_ALPHA8_ASTC_12x10_Format:()=>kt,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Dt,SRGB8_ALPHA8_ASTC_4x4_Format:()=>wt,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Mt,SRGB8_ALPHA8_ASTC_5x5_Format:()=>Et,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Tt,SRGB8_ALPHA8_ASTC_6x6_Format:()=>St,SRGB8_ALPHA8_ASTC_8x5_Format:()=>At,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Lt,SRGB8_ALPHA8_ASTC_8x8_Format:()=>Ct,Scene:()=>Cl,SceneUtils:()=>Pf,ShaderChunk:()=>Hs,ShaderLib:()=>Vs,ShaderMaterial:()=>Es,ShadowMaterial:()=>nh,Shape:()=>Hh,ShapeBufferGeometry:()=>qu,ShapeGeometry:()=>qu,ShapePath:()=>vd,ShapeUtils:()=>Bu,ShortType:()=>Se,Skeleton:()=>lc,SkeletonHelper:()=>wp,SkinnedMesh:()=>ic,SmoothShading:()=>y,Sphere:()=>Ci,SphereBufferGeometry:()=>Xu,SphereGeometry:()=>Xu,Spherical:()=>cp,SphericalHarmonics3:()=>sd,SplineCurve:()=>uu,SpotLight:()=>Jh,SpotLightHelper:()=>yp,Sprite:()=>Xl,SpriteMaterial:()=>Il,SrcAlphaFactor:()=>k,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>N,StaticCopyUsage:()=>Pn,StaticDrawUsage:()=>Tn,StaticReadUsage:()=>Ln,StereoCamera:()=>Ld,StreamCopyUsage:()=>In,StreamDrawUsage:()=>An,StreamReadUsage:()=>Rn,StringKeyframeTrack:()=>Mh,SubtractEquation:()=>S,SubtractiveBlending:()=>w,TOUCH:()=>s,TangentSpaceNormalMap:()=>on,TetrahedronBufferGeometry:()=>Yu,TetrahedronGeometry:()=>Yu,TextBufferGeometry:()=>Ju,TextGeometry:()=>Ju,Texture:()=>ei,TextureLoader:()=>Fh,TorusBufferGeometry:()=>Zu,TorusGeometry:()=>Zu,TorusKnotBufferGeometry:()=>Ku,TorusKnotGeometry:()=>Ku,Triangle:()=>xr,TriangleFanDrawMode:()=>Jt,TriangleStripDrawMode:()=>Yt,TrianglesDrawMode:()=>Xt,TubeBufferGeometry:()=>Qu,TubeGeometry:()=>Qu,UVMapping:()=>re,Uint16Attribute:()=>vf,Uint16BufferAttribute:()=>Fr,Uint32Attribute:()=>_f,Uint32BufferAttribute:()=>zr,Uint8Attribute:()=>ff,Uint8BufferAttribute:()=>Dr,Uint8ClampedAttribute:()=>mf,Uint8ClampedBufferAttribute:()=>Br,Uniform:()=>ip,UniformsLib:()=>Gs,UniformsUtils:()=>Ms,UnsignedByteType:()=>Ee,UnsignedInt248Type:()=>De,UnsignedIntType:()=>Ce,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Ie,UnsignedShort565Type:()=>ke,UnsignedShortType:()=>Ae,VSMShadowMap:()=>p,Vector2:()=>Jn,Vector3:()=>oi,Vector4:()=>ni,VectorKeyframeTrack:()=>Eh,Vertex:()=>hf,VertexColors:()=>tf,VideoTexture:()=>Nc,WebGL1Renderer:()=>Sl,WebGLCubeRenderTarget:()=>Rs,WebGLMultipleRenderTargets:()=>ri,WebGLMultisampleRenderTarget:()=>si,WebGLRenderTarget:()=>ii,WebGLRenderTargetCube:()=>Lf,WebGLRenderer:()=>Tl,WebGLUtils:()=>yl,WireframeGeometry:()=>$u,WireframeHelper:()=>Tf,WrapAroundEnding:()=>Wt,XHRLoader:()=>Sf,ZeroCurvatureEnding:()=>Gt,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Vt,ZeroStencilOp:()=>cn,sRGBEncoding:()=>Kt});const i="131",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=0,o=1,l=2,c=3,u=0,h=1,d=2,p=3,f=0,m=1,g=2,v=1,y=2,_=0,x=1,b=2,w=3,M=4,E=5,T=100,S=101,A=102,L=103,C=104,R=200,P=201,N=202,I=203,k=204,D=205,B=206,O=207,F=208,U=209,z=210,H=0,G=1,V=2,W=3,j=4,q=5,X=6,Y=7,J=0,Z=1,K=2,Q=0,$=1,ee=2,te=3,ne=4,ie=5,re=300,se=301,ae=302,oe=303,le=304,ce=306,ue=307,he=1e3,de=1001,pe=1002,fe=1003,me=1004,ge=1004,ve=1005,ye=1005,_e=1006,xe=1007,be=1007,we=1008,Me=1008,Ee=1009,Te=1010,Se=1011,Ae=1012,Le=1013,Ce=1014,Re=1015,Pe=1016,Ne=1017,Ie=1018,ke=1019,De=1020,Be=1021,Oe=1022,Fe=1023,Ue=1024,ze=1025,He=Fe,Ge=1026,Ve=1027,We=1028,je=1029,qe=1030,Xe=1031,Ye=1032,Je=1033,Ze=33776,Ke=33777,Qe=33778,$e=33779,et=35840,tt=35841,nt=35842,it=35843,rt=36196,st=37492,at=37496,ot=37808,lt=37809,ct=37810,ut=37811,ht=37812,dt=37813,pt=37814,ft=37815,mt=37816,gt=37817,vt=37818,yt=37819,_t=37820,xt=37821,bt=36492,wt=37840,Mt=37841,Et=37842,Tt=37843,St=37844,At=37845,Lt=37846,Ct=37847,Rt=37848,Pt=37849,Nt=37850,It=37851,kt=37852,Dt=37853,Bt=2200,Ot=2201,Ft=2202,Ut=2300,zt=2301,Ht=2302,Gt=2400,Vt=2401,Wt=2402,jt=2500,qt=2501,Xt=0,Yt=1,Jt=2,Zt=3e3,Kt=3001,Qt=3007,$t=3002,en=3003,tn=3004,nn=3005,rn=3006,sn=3200,an=3201,on=0,ln=1,cn=0,un=7680,hn=7681,dn=7682,pn=7683,fn=34055,mn=34056,gn=5386,vn=512,yn=513,_n=514,xn=515,bn=516,wn=517,Mn=518,En=519,Tn=35044,Sn=35048,An=35040,Ln=35045,Cn=35049,Rn=35041,Pn=35046,Nn=35050,In=35042,kn="100",Dn="300 es";class Bn{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]+On[e>>16&255]+On[e>>24&255]+"-"+On[255&t]+On[t>>8&255]+"-"+On[t>>16&15|64]+On[t>>24&255]+"-"+On[63&n|128]+On[n>>8&255]+"-"+On[n>>16&255]+On[n>>24&255]+On[255&i]+On[i>>8&255]+On[i>>16&255]+On[i>>24&255]).toUpperCase()}function Gn(e,t,n){return Math.max(t,Math.min(n,e))}function Vn(e,t){return(e%t+t)%t}function Wn(e,t,n){return(1-n)*e+n*t}function jn(e){return 0==(e&e-1)&&0!==e}function qn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Xn(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Yn=Object.freeze({__proto__:null,DEG2RAD:Un,RAD2DEG:zn,generateUUID:Hn,clamp:Gn,euclideanModulo:Vn,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:Wn,damp:function(e,t,n,i){return Wn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Vn(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){return void 0!==e&&(Fn=e%2147483647),Fn=16807*Fn%2147483647,(Fn-1)/2147483646},degToRad:function(e){return e*Un},radToDeg:function(e){return e*zn},isPowerOfTwo:jn,ceilPowerOfTwo:qn,floorPowerOfTwo:Xn,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((t+i)/2),u=a((t+i)/2),h=s((t-i)/2),d=a((t-i)/2),p=s((i-t)/2),f=a((i-t)/2);switch(r){case"XYX":e.set(o*u,l*h,l*d,o*c);break;case"YZY":e.set(l*d,o*u,l*h,o*c);break;case"ZXZ":e.set(l*h,l*d,o*u,o*c);break;case"XZX":e.set(o*u,l*f,l*p,o*c);break;case"YXY":e.set(l*p,o*u,l*f,o*c);break;case"ZYZ":e.set(l*f,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class Jn{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}}Jn.prototype.isVector2=!0;class Zn{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,a,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=r,c[5]=o,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],a=n[3],o=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],_=i[7],x=i[2],b=i[5],w=i[8];return r[0]=s*f+a*v+o*x,r[3]=s*m+a*y+o*b,r[6]=s*g+a*_+o*w,r[1]=l*f+c*v+u*x,r[4]=l*m+c*y+u*b,r[7]=l*g+c*_+u*w,r[2]=h*f+d*v+p*x,r[5]=h*m+d*y+p*b,r[8]=h*g+d*_+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],a=e[5],o=e[6],l=e[7],c=e[8];return t*s*c-t*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],c=e[8],u=c*s-a*l,h=a*o-c*r,d=l*r-s*o,p=t*u+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=u*f,e[1]=(i*l-c*n)*f,e[2]=(a*n-i*s)*f,e[3]=h*f,e[4]=(c*t-i*o)*f,e[5]=(i*r-a*t)*f,e[6]=d*f,e[7]=(n*o-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,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+e,-i*l,i*o,-i*(-l*s+o*a)+a+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],a=i[6],o=i[1],l=i[4],c=i[7];return i[0]=t*r+n*o,i[3]=t*s+n*l,i[6]=t*a+n*c,i[1]=-n*r+t*o,i[4]=-n*s+t*l,i[7]=-n*a+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)}}let Kn;Zn.prototype.isMatrix3=!0;class Qn{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Kn&&(Kn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Kn.width=e.width,Kn.height=e.height;const n=Kn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Kn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}let $n=0;class ei extends Bn{constructor(e=ei.DEFAULT_IMAGE,t=ei.DEFAULT_MAPPING,n=de,i=de,r=_e,s=we,a=Fe,o=Ee,l=1,c=Zt){super(),Object.defineProperty(this,"id",{value:$n++}),this.uuid=Hn(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Jn(0,0),this.repeat=new Jn(1,1),this.center=new Jn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=Hn()),!t&&void 0===e.images[i.uuid]){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e1)switch(this.wrapS){case he:e.x=e.x-Math.floor(e.x);break;case de:e.x=e.x<0?0:1;break;case pe: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 de:e.y=e.y<0?0:1;break;case pe: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++}}function ti(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Qn.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}ei.DEFAULT_IMAGE=void 0,ei.DEFAULT_MAPPING=re,ei.prototype.isTexture=!0;class ni{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,a=.1,o=e.elements,l=o[0],c=o[4],u=o[8],h=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-h)o&&e>v?ev?o=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,a=Math.sin(a*s)/r}const r=a*n;if(o=o*e+h*r,l=l*e+d*r,c=c*e+p*r,u=u*e+f*r,e===1-a){const e=1/Math.sqrt(o*o+l*l+c*c+u*u);o*=e,l*=e,c*=e,u*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],u=r[s],h=r[s+1],d=r[s+2],p=r[s+3];return e[t]=a*p+c*u+o*d-l*h,e[t+1]=o*p+c*h+l*u-a*d,e[t+2]=l*p+c*d+a*h-o*u,e[t+3]=c*p-a*u-o*h-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,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),u=a(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*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],a=t[5],o=t[9],l=t[2],c=t[6],u=t[10],h=n+a+u;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>a&&n>u){const e=2*Math.sqrt(1+n-a-u);this._w=(c-o)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(a>u){const e=2*Math.sqrt(1+a-n-u);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+u-n-a);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(o+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(Gn(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,a=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-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 a=s*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=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(o),c=Math.atan2(l,a),u=Math.sin((1-t)*c)/l,h=Math.sin(t*c)/l;return this._w=s*u+this._w*h,this._x=n*u+this._x*h,this._y=i*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}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(){}}ai.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(ci.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ci.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,a=e.z,o=e.w,l=o*t+s*i-a*n,c=o*n+a*t-r*i,u=o*i+r*n-s*t,h=-r*t-s*n-a*i;return this.x=l*o+h*-r+c*-a-u*-s,this.y=c*o+h*-s+u*-r-l*-a,this.z=u*o+h*-a+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,a=t.y,o=t.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-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 li.copy(this).projectOnVector(e),this.sub(li)}reflect(e){return this.sub(li.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(Gn(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)}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}}oi.prototype.isVector3=!0;const li=new oi,ci=new ai;class ui{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,a=-1/0;for(let o=0,l=e.length;or&&(r=l),c>s&&(s=c),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=e.count;or&&(r=l),c>s&&(s=c),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),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,di),di.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(xi),bi.subVectors(this.max,xi),fi.subVectors(e.a,xi),mi.subVectors(e.b,xi),gi.subVectors(e.c,xi),vi.subVectors(mi,fi),yi.subVectors(gi,mi),_i.subVectors(fi,gi);let t=[0,-vi.z,vi.y,0,-yi.z,yi.y,0,-_i.z,_i.y,vi.z,0,-vi.x,yi.z,0,-yi.x,_i.z,0,-_i.x,-vi.y,vi.x,0,-yi.y,yi.x,0,-_i.y,_i.x,0];return!!Ei(t,fi,mi,gi,bi)&&(t=[1,0,0,0,1,0,0,0,1],!!Ei(t,fi,mi,gi,bi)&&(wi.crossVectors(vi,yi),t=[wi.x,wi.y,wi.z],Ei(t,fi,mi,gi,bi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return di.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(di).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)}}ui.prototype.isBox3=!0;const hi=[new oi,new oi,new oi,new oi,new oi,new oi,new oi,new oi],di=new oi,pi=new ui,fi=new oi,mi=new oi,gi=new oi,vi=new oi,yi=new oi,_i=new oi,xi=new oi,bi=new oi,wi=new oi,Mi=new oi;function Ei(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){Mi.fromArray(e,s);const a=r.x*Math.abs(Mi.x)+r.y*Math.abs(Mi.y)+r.z*Math.abs(Mi.z),o=t.dot(Mi),l=n.dot(Mi),c=i.dot(Mi);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const Ti=new ui,Si=new oi,Ai=new oi,Li=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):Ti.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){Li.subVectors(e,this.center);const t=Li.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Li.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return Ai.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Si.copy(e.center).add(Ai)),this.expandByPoint(Si.copy(e.center).sub(Ai)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ri=new oi,Pi=new oi,Ni=new oi,Ii=new oi,ki=new oi,Di=new oi,Bi=new oi;class Oi{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,Ri)),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=Ri.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ri.copy(this.direction).multiplyScalar(t).add(this.origin),Ri.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Pi.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),Ii.copy(this.origin).sub(Pi);const r=.5*e.distanceTo(t),s=-this.direction.dot(Ni),a=Ii.dot(this.direction),o=-Ii.dot(Ni),l=Ii.lengthSq(),c=Math.abs(1-s*s);let u,h,d,p;if(c>0)if(u=s*o-a,h=s*a-o,p=r*c,u>=0)if(h>=-p)if(h<=p){const e=1/c;u*=e,h*=e,d=u*(u+s*h+2*a)+h*(s*u+h+2*o)+l}else h=r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;else h=-r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;else h<=-p?(u=Math.max(0,-(-s*r+a)),h=u>0?-r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l):h<=p?(u=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(u=Math.max(0,-(s*r+a)),h=u>0?r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l);else h=s>0?-r:r,u=Math.max(0,-(s*h+a)),d=-u*u+h*(h+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(Ni).multiplyScalar(h).add(Pi),d}intersectSphere(e,t){Ri.subVectors(e.center,this.origin);const n=Ri.dot(this.direction),i=Ri.dot(Ri)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(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,a,o;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,s=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,s=(e.min.y-h.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(e.min.z-h.z)*u,o=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,o=(e.min.z-h.z)*u),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Ri)}intersectTriangle(e,t,n,i,r){ki.subVectors(t,e),Di.subVectors(n,e),Bi.crossVectors(ki,Di);let s,a=this.direction.dot(Bi);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Ii.subVectors(this.origin,e);const o=s*this.direction.dot(Di.crossVectors(Ii,Di));if(o<0)return null;const l=s*this.direction.dot(ki.cross(Ii));if(l<0)return null;if(o+l>a)return null;const c=-s*Ii.dot(Bi);return c<0?null:this.at(c/a,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 Fi{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,a,o,l,c,u,h,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]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=u,g[14]=h,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 Fi).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),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*u,i=a*c,r=a*u;t[0]=o*c,t[4]=-o*u,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-a*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*o}else if("YXZ"===e.order){const e=o*c,n=o*u,i=l*c,r=l*u;t[0]=e+r*a,t[4]=i*a-n,t[8]=s*l,t[1]=s*u,t[5]=s*c,t[9]=-a,t[2]=n*a-i,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*c,n=o*u,i=l*c,r=l*u;t[0]=e-r*a,t[4]=-s*u,t[8]=i+n*a,t[1]=n+i*a,t[5]=s*c,t[9]=r-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*c,n=s*u,i=a*c,r=a*u;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*u,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*c,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=s*c,t[9]=-a*c,t[2]=-l*c,t[6]=n*u+i,t[10]=e-r*u}else if("XZY"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*c,t[4]=-u,t[8]=l*c,t[1]=e*u+r,t[5]=s*c,t[9]=n*u-i,t[2]=i*u-n,t[6]=a*c,t[10]=r*u+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(Hi,e,Gi)}lookAt(e,t,n){const i=this.elements;return ji.subVectors(e,t),0===ji.lengthSq()&&(ji.z=1),ji.normalize(),Vi.crossVectors(n,ji),0===Vi.lengthSq()&&(1===Math.abs(n.z)?ji.x+=1e-4:ji.z+=1e-4,ji.normalize(),Vi.crossVectors(n,ji)),Vi.normalize(),Wi.crossVectors(ji,Vi),i[0]=Vi.x,i[4]=Wi.x,i[8]=ji.x,i[1]=Vi.y,i[5]=Wi.y,i[9]=ji.y,i[2]=Vi.z,i[6]=Wi.z,i[10]=ji.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],a=n[4],o=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],L=i[13],C=i[2],R=i[6],P=i[10],N=i[14],I=i[3],k=i[7],D=i[11],B=i[15];return r[0]=s*b+a*T+o*C+l*I,r[4]=s*w+a*S+o*R+l*k,r[8]=s*M+a*A+o*P+l*D,r[12]=s*E+a*L+o*N+l*B,r[1]=c*b+u*T+h*C+d*I,r[5]=c*w+u*S+h*R+d*k,r[9]=c*M+u*A+h*P+d*D,r[13]=c*E+u*L+h*N+d*B,r[2]=p*b+f*T+m*C+g*I,r[6]=p*w+f*S+m*R+g*k,r[10]=p*M+f*A+m*P+g*D,r[14]=p*E+f*L+m*N+g*B,r[3]=v*b+y*T+_*C+x*I,r[7]=v*w+y*S+_*R+x*k,r[11]=v*M+y*A+_*P+x*D,r[15]=v*E+y*L+_*N+x*B,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],a=e[5],o=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+r*o*u-i*l*u-r*a*h+n*l*h+i*a*d-n*o*d)+e[7]*(+t*o*d-t*l*h+r*s*h-i*s*d+i*l*c-r*o*c)+e[11]*(+t*l*u-t*a*d-r*s*u+n*s*d+r*a*c-n*l*c)+e[15]*(-i*a*c-t*o*u+t*a*h+i*s*u-n*s*h+n*o*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],a=e[5],o=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=u*m*l-f*h*l+f*o*d-a*m*d-u*o*g+a*h*g,y=p*h*l-c*m*l-p*o*d+s*m*d+c*o*g-s*h*g,_=c*f*l-p*u*l+p*a*d-s*f*d-c*a*g+s*u*g,x=p*u*o-c*f*o-p*a*h+s*f*h+c*a*m-s*u*m,b=t*v+n*y+i*_+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]=v*w,e[1]=(f*h*r-u*m*r-f*i*d+n*m*d+u*i*g-n*h*g)*w,e[2]=(a*m*r-f*o*r+f*i*l-n*m*l-a*i*g+n*o*g)*w,e[3]=(u*o*r-a*h*r-u*i*l+n*h*l+a*i*d-n*o*d)*w,e[4]=y*w,e[5]=(c*m*r-p*h*r+p*i*d-t*m*d-c*i*g+t*h*g)*w,e[6]=(p*o*r-s*m*r-p*i*l+t*m*l+s*i*g-t*o*g)*w,e[7]=(s*h*r-c*o*r+c*i*l-t*h*l-s*i*d+t*o*d)*w,e[8]=_*w,e[9]=(p*u*r-c*f*r-p*n*d+t*f*d+c*n*g-t*u*g)*w,e[10]=(s*f*r-p*a*r+p*n*l-t*f*l-s*n*g+t*a*g)*w,e[11]=(c*a*r-s*u*r-c*n*l+t*u*l+s*n*d-t*a*d)*w,e[12]=x*w,e[13]=(c*f*i-p*u*i+p*n*h-t*f*h-c*n*m+t*u*m)*w,e[14]=(p*a*i-s*f*i-p*n*o+t*f*o+s*n*m-t*a*m)*w,e[15]=(s*u*i-c*a*i+c*n*o-t*u*o-s*n*h+t*a*h)*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,a=e.y,o=e.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+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,a=t._z,o=t._w,l=r+r,c=s+s,u=a+a,h=r*l,d=r*c,p=r*u,f=s*c,m=s*u,g=a*u,v=o*l,y=o*c,_=o*u,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+_)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-_)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+y)*w,i[9]=(m-v)*w,i[10]=(1-(h+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(),a=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],zi.copy(this);const o=1/r,l=1/s,c=1/a;return zi.elements[0]*=o,zi.elements[1]*=o,zi.elements[2]*=o,zi.elements[4]*=l,zi.elements[5]*=l,zi.elements[6]*=l,zi.elements[8]*=c,zi.elements[9]*=c,zi.elements[10]*=c,t.setFromRotationMatrix(zi),n.x=r,n.y=s,n.z=a,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 a=this.elements,o=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),u=(n+i)/(n-i),h=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s){const a=this.elements,o=1/(t-e),l=1/(n-i),c=1/(s-r),u=(t+e)*o,h=(n+i)*l,d=(s+r)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[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}}Fi.prototype.isMatrix4=!0;const Ui=new oi,zi=new Fi,Hi=new oi(0,0,0),Gi=new oi(1,1,1),Vi=new oi,Wi=new oi,ji=new oi,qi=new Fi,Xi=new ai;class Yi{constructor(e=0,t=0,n=0,i=Yi.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],a=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Gn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Gn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Gn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Gn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Gn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Gn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,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 qi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(qi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Xi.setFromEuler(this),this.setFromQuaternion(Xi,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}toVector3(e){return e?e.set(this._x,this._y,this._z):new oi(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Yi.prototype.isEuler=!0,Yi.DefaultOrder="XYZ",Yi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ji{constructor(){this.mask=1}set(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),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}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){ur.subVectors(i,t),hr.subVectors(n,t),dr.subVectors(e,t);const s=ur.dot(ur),a=ur.dot(hr),o=ur.dot(dr),l=hr.dot(hr),c=hr.dot(dr),u=s*l-a*a;if(0===u)return r.set(-2,-1,-1);const h=1/u,d=(l*o-a*c)*h,p=(s*c-a*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pr),pr.x>=0&&pr.y>=0&&pr.x+pr.y<=1}static getUV(e,t,n,i,r,s,a,o){return this.getBarycoord(e,t,n,i,pr),o.set(0,0),o.addScaledVector(r,pr.x),o.addScaledVector(s,pr.y),o.addScaledVector(a,pr.z),o}static isFrontFacing(e,t,n,i){return ur.subVectors(n,t),hr.subVectors(e,t),ur.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}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 ur.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),.5*ur.cross(hr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return xr.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return xr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xr.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,a;fr.subVectors(i,n),mr.subVectors(r,n),vr.subVectors(e,n);const o=fr.dot(vr),l=mr.dot(vr);if(o<=0&&l<=0)return t.copy(n);yr.subVectors(e,i);const c=fr.dot(yr),u=mr.dot(yr);if(c>=0&&u<=c)return t.copy(i);const h=o*u-c*l;if(h<=0&&o>=0&&c<=0)return s=o/(o-c),t.copy(n).addScaledVector(fr,s);_r.subVectors(e,r);const d=fr.dot(_r),p=mr.dot(_r);if(p>=0&&d<=p)return t.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(n).addScaledVector(mr,a);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return gr.subVectors(r,i),a=(u-c)/(u-c+(d-p)),t.copy(i).addScaledVector(gr,a);const g=1/(m+f+h);return s=f*g,a=h*g,t.copy(n).addScaledVector(fr,s).addScaledVector(mr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let br=0;class wr extends Bn{constructor(){super(),Object.defineProperty(this,"id",{value:br++}),this.uuid=Hn(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=k,this.blendDst=D,this.blendEquation=T,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=En,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=un,this.stencilZFail=un,this.stencilZPass=un,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.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}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===v;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),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),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.specularTint&&this.specularTint.isColor&&(n.specularTint=this.specularTint.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.specularTintMap&&this.specularTintMap.isTexture&&(n.specularTintMap=this.specularTintMap.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.attenuationTint&&(n.attenuationTint=this.attenuationTint.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,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),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),"{}"!==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.fog=e.fog,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++}}wr.prototype.isMaterial=!0;const Mr={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},Er={h:0,s:0,l:0},Tr={h:0,s:0,l:0};function Sr(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 Ar(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Lr(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Cr{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){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Vn(e,1),t=Gn(t,0,1),n=Gn(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=Sr(r,i,e+1/3),this.g=Sr(r,i,e),this.b=Sr(r,i,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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,t(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(r)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)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,this;if(6===t)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,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Mr[e.toLowerCase()];return void 0!==t?this.setHex(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}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Ar(e.r),this.g=Ar(e.g),this.b=Ar(e.b),this}copyLinearToSRGB(e){return this.r=Lr(e.r),this.g=Lr(e.g),this.b=Lr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),s=Math.min(t,n,i);let a,o;const l=(s+r)/2;if(s===r)a=0,o=0;else{const e=r-s;switch(o=l<=.5?e/(r+s):e/(2-r-s),r){case t:a=(n-i)/e+(nt&&(t=e[n]);return t}const jr={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function qr(e,t){return new jr[e](t)}let Xr=0;const Yr=new Fi,Jr=new cr,Zr=new oi,Kr=new ui,Qr=new ui,$r=new oi;class es extends Bn{constructor(){super(),Object.defineProperty(this,"id",{value:Xr++}),this.uuid=Hn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Wr(e)>65535?zr:Fr)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new Zn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Yr.makeRotationFromQuaternion(e),this.applyMatrix4(Yr),this}rotateX(e){return Yr.makeRotationX(e),this.applyMatrix4(Yr),this}rotateY(e){return Yr.makeRotationY(e),this.applyMatrix4(Yr),this}rotateZ(e){return Yr.makeRotationZ(e),this.applyMatrix4(Yr),this}translate(e,t,n){return Yr.makeTranslation(e,t,n),this.applyMatrix4(Yr),this}scale(e,t,n){return Yr.makeScale(e,t,n),this.applyMatrix4(Yr),this}lookAt(e){return Jr.lookAt(e),Jr.updateMatrix(),this.applyMatrix4(Jr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n0&&(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 a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return(new es).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(),is.copy(n.boundingSphere),is.applyMatrix4(r),!1===e.ray.intersectsSphere(is))return;if(ts.copy(r).invert(),ns.copy(e.ray).applyMatrix4(ts),null!==n.boundingBox&&!1===ns.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=h.length;nn.far?null:{distance:c,point:vs.clone(),object:e}}(e,t,n,i,rs,ss,as,gs);if(p){o&&(ps.fromBufferAttribute(o,c),fs.fromBufferAttribute(o,u),ms.fromBufferAttribute(o,h),p.uv=xr.getUV(gs,rs,ss,as,ps,fs,ms,new Jn)),l&&(ps.fromBufferAttribute(l,c),fs.fromBufferAttribute(l,u),ms.fromBufferAttribute(l,h),p.uv2=xr.getUV(gs,rs,ss,as,ps,fs,ms,new Jn));const e={a:c,b:u,c:h,normal:new oi,materialIndex:0};xr.getNormal(rs,ss,as,e.normal),p.face=e}return p}ys.prototype.isMesh=!0;class xs extends es{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 a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],u=[];let h=0,d=0;function p(e,t,n,i,r,s,p,f,m,g,v){const y=s/m,_=p/g,x=s/2,b=p/2,w=f/2,M=m+1,E=g+1;let T=0,S=0;const A=new oi;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),u.push(o/m),u.push(1-s/g),T+=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}}Es.prototype.isShaderMaterial=!0;class Ts extends cr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Fi,this.projectionMatrix=new Fi,this.projectionMatrixInverse=new Fi}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)}}Ts.prototype.isCamera=!0;class Ss extends Ts{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*zn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Un*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*zn*Math.atan(Math.tan(.5*Un*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*Un*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,a=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/a,i*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=e*a/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}}Ss.prototype.isPerspectiveCamera=!0;const As=90;class Ls extends cr{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 Ss(As,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 Ss(As,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 Ss(As,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new oi(0,1,0)),this.add(s);const a=new Ss(As,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new oi(0,-1,0)),this.add(a);const o=new Ss(As,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new oi(0,0,1)),this.add(o);const l=new Ss(As,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,a,o,l]=this.children,c=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;const h=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,a),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=c}}class Cs extends ei{constructor(e,t,n,i,r,s,a,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:se,n,i,r,s,a=void 0!==a?a:Oe,o,l,c),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Cs.prototype.isCubeTexture=!0;class Rs extends ii{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new Cs(void 0,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,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Fe,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 xs(5,5,5),a=new Es({name:"CubemapFromEquirect",uniforms:bs(n),vertexShader:i,fragmentShader:r,side:m,blending:_});a.uniforms.tEquirect.value=t;const o=new ys(s,a),l=t.minFilter;return t.minFilter===we&&(t.minFilter=_e),new Ls(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.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)}}Rs.prototype.isWebGLCubeRenderTarget=!0;const Ps=new oi,Ns=new oi,Is=new Zn;class ks{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=Ps.subVectors(n,t).cross(Ns.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(Ps),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||Is.getNormalMatrix(e),i=this.coplanarPoint(Ps).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)}}ks.prototype.isPlane=!0;const Ds=new Ci,Bs=new oi;class Os{constructor(e=new ks,t=new ks,n=new ks,i=new ks,r=new ks,s=new ks){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[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],a=n[3],o=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-i,u-o,f-h,y-m).normalize(),t[1].setComponents(a+i,u+o,f+h,y+m).normalize(),t[2].setComponents(a+r,u+l,f+d,y+g).normalize(),t[3].setComponents(a-r,u-l,f-d,y-g).normalize(),t[4].setComponents(a-s,u-c,f-p,y-v).normalize(),t[5].setComponents(a+s,u+c,f+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ds.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}intersectsSprite(e){return Ds.center.set(0,0,0),Ds.radius=.7071067811865476,Ds.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}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,Bs.y=i.normal.y>0?e.max.y:e.min.y,Bs.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Bs)<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 Fs(){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 Us(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 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in vec3 f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( f90 - f0 ) * fresnel + f0;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in vec3 f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, vec3( 1.0 ), dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.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\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\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\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\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_maxMipLevel );\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\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\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#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\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\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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 texture2D( gradientMap, coord ).rgb;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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 );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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 );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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 getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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 getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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 getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\t#ifdef SPECULAR\n\t\tvec3 specularIntensityFactor = vec3( specularIntensity );\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularColorF90 = mix( specularIntensityFactor, vec3( 1.0 ), metalnessFactor );\n\t#else\n\t\tvec3 specularIntensityFactor = vec3( 1.0 );\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularColorF90 = vec3( 1.0 );\n\t#endif\n\tmaterial.specularColor = mix( min( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularColorF90 = vec3( 1.0 );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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 = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n\tvec3 specularColorF90;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), vec3( 1.0 ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularColorF90, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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 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\tgetPointDirectLightIrradiance( 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\tgetSpotDirectLightIrradiance( 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\tgetDirectionalDirectLightIrradiance( 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 );\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 );\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 = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\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\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\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",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\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",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 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",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\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\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 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.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\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 vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, 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(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, 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\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, 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\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\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_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",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}",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}",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}",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 \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}",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}",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 \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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \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}",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 \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\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#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}",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 \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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 \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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\n#ifdef USE_TRANSMISSION\n\tvarying vec4 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 \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#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\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;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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\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}",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}",shadow_vert:"#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}",sprite_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},Gs={common:{diffuse:{value:new Cr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Zn},uv2Transform:{value:new Zn},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 Jn(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 Cr(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 Cr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Zn}},sprite:{diffuse:{value:new Cr(16777215)},opacity:{value:1},center:{value:new Jn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Zn}}},Vs={basic:{uniforms:ws([Gs.common,Gs.specularmap,Gs.envmap,Gs.aomap,Gs.lightmap,Gs.fog]),vertexShader:Hs.meshbasic_vert,fragmentShader:Hs.meshbasic_frag},lambert:{uniforms:ws([Gs.common,Gs.specularmap,Gs.envmap,Gs.aomap,Gs.lightmap,Gs.emissivemap,Gs.fog,Gs.lights,{emissive:{value:new Cr(0)}}]),vertexShader:Hs.meshlambert_vert,fragmentShader:Hs.meshlambert_frag},phong:{uniforms:ws([Gs.common,Gs.specularmap,Gs.envmap,Gs.aomap,Gs.lightmap,Gs.emissivemap,Gs.bumpmap,Gs.normalmap,Gs.displacementmap,Gs.fog,Gs.lights,{emissive:{value:new Cr(0)},specular:{value:new Cr(1118481)},shininess:{value:30}}]),vertexShader:Hs.meshphong_vert,fragmentShader:Hs.meshphong_frag},standard:{uniforms:ws([Gs.common,Gs.envmap,Gs.aomap,Gs.lightmap,Gs.emissivemap,Gs.bumpmap,Gs.normalmap,Gs.displacementmap,Gs.roughnessmap,Gs.metalnessmap,Gs.fog,Gs.lights,{emissive:{value:new Cr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Hs.meshphysical_vert,fragmentShader:Hs.meshphysical_frag},toon:{uniforms:ws([Gs.common,Gs.aomap,Gs.lightmap,Gs.emissivemap,Gs.bumpmap,Gs.normalmap,Gs.displacementmap,Gs.gradientmap,Gs.fog,Gs.lights,{emissive:{value:new Cr(0)}}]),vertexShader:Hs.meshtoon_vert,fragmentShader:Hs.meshtoon_frag},matcap:{uniforms:ws([Gs.common,Gs.bumpmap,Gs.normalmap,Gs.displacementmap,Gs.fog,{matcap:{value:null}}]),vertexShader:Hs.meshmatcap_vert,fragmentShader:Hs.meshmatcap_frag},points:{uniforms:ws([Gs.points,Gs.fog]),vertexShader:Hs.points_vert,fragmentShader:Hs.points_frag},dashed:{uniforms:ws([Gs.common,Gs.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Hs.linedashed_vert,fragmentShader:Hs.linedashed_frag},depth:{uniforms:ws([Gs.common,Gs.displacementmap]),vertexShader:Hs.depth_vert,fragmentShader:Hs.depth_frag},normal:{uniforms:ws([Gs.common,Gs.bumpmap,Gs.normalmap,Gs.displacementmap,{opacity:{value:1}}]),vertexShader:Hs.normal_vert,fragmentShader:Hs.normal_frag},sprite:{uniforms:ws([Gs.sprite,Gs.fog]),vertexShader:Hs.sprite_vert,fragmentShader:Hs.sprite_frag},background:{uniforms:{uvTransform:{value:new Zn},t2D:{value:null}},vertexShader:Hs.background_vert,fragmentShader:Hs.background_frag},cube:{uniforms:ws([Gs.envmap,{opacity:{value:1}}]),vertexShader:Hs.cube_vert,fragmentShader:Hs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Hs.equirect_vert,fragmentShader:Hs.equirect_frag},distanceRGBA:{uniforms:ws([Gs.common,Gs.displacementmap,{referencePosition:{value:new oi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Hs.distanceRGBA_vert,fragmentShader:Hs.distanceRGBA_frag},shadow:{uniforms:ws([Gs.lights,Gs.fog,{color:{value:new Cr(0)},opacity:{value:1}}]),vertexShader:Hs.shadow_vert,fragmentShader:Hs.shadow_frag}};function Ws(e,t,n,i,r){const s=new Cr(0);let a,o,l=0,c=null,u=0,h=null;function d(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),l=t,d(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(e){l=e,d(s,l)},render:function(n,r){let p=!1,g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=t.get(g));const v=e.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(g=null),null===g?d(s,l):g&&g.isColor&&(d(g,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===ce)?(void 0===o&&(o=new ys(new xs(1,1,1),new Es({name:"BackgroundCubeMaterial",uniforms:bs(Vs.cube.uniforms),vertexShader:Vs.cube.vertexShader,fragmentShader:Vs.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=g,o.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,c===g&&u===g.version&&h===e.toneMapping||(o.material.needsUpdate=!0,c=g,u=g.version,h=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new ys(new zs(2,2),new Es({name:"BackgroundMaterial",uniforms:bs(Vs.background.uniforms),vertexShader:Vs.background.vertexShader,fragmentShader:Vs.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),c===g&&u===g.version&&h===e.toneMapping||(a.material.needsUpdate=!0,c=g,u=g.version,h=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function js(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=d(null);let c=l;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function h(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function d(e){const t=[],n=[],i=[];for(let e=0;e=0){const s=l[t];if(void 0!==s){const t=s.normalized,r=s.itemSize,a=n.get(s);if(void 0===a)continue;const l=a.buffer,c=a.type,u=a.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,a=n.stride,h=s.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===o._maxInstanceCount&&(o._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),e.bindBuffer(34962,l),v(i,r,c,t,a*u,h*u)}else s.isInstancedBufferAttribute?(m(i,s.meshPerAttribute),void 0===o._maxInstanceCount&&(o._maxInstanceCount=s.meshPerAttribute*s.count)):f(i),e.bindBuffer(34962,l),v(i,r,c,t,0,0)}else if("instanceMatrix"===t){const t=n.get(r.instanceMatrix);if(void 0===t)continue;const s=t.buffer,a=t.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),e.bindBuffer(34962,s),e.vertexAttribPointer(i+0,4,a,!1,64,0),e.vertexAttribPointer(i+1,4,a,!1,64,16),e.vertexAttribPointer(i+2,4,a,!1,64,32),e.vertexAttribPointer(i+3,4,a,!1,64,48)}else if("instanceColor"===t){const t=n.get(r.instanceColor);if(void 0===t)continue;const s=t.buffer,a=t.type;m(i,1),e.bindBuffer(34962,s),e.vertexAttribPointer(i,3,a,!1,12,0)}else if(void 0!==u){const n=u[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(i,n);break;case 3:e.vertexAttrib3fv(i,n);break;case 4:e.vertexAttrib4fv(i,n);break;default:e.vertexAttrib1fv(i,n)}}}}g()}(r,l,h,y),null!==_&&e.bindBuffer(34963,n.get(_).buffer))},reset:y,resetDefaultState:_,dispose:function(){y();for(const e in o){const t=o[e];for(const e in t){const n=t[e];for(const e in n)h(n[e].object),delete n[e];delete t[e]}delete o[e]}},releaseStatesOfGeometry:function(e){if(void 0===o[e.id])return;const t=o[e.id];for(const e in t){const n=t[e];for(const e in n)h(n[e].object),delete n[e];delete t[e]}delete o[e.id]},releaseStatesOfProgram:function(e){for(const t in o){const n=o[t];if(void 0===n[e.id])continue;const i=n[e.id];for(const e in i)h(i[e].object),delete i[e];delete n[e.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function qs(e,t,n,i){const r=i.isWebGL2;let s;this.setMode=function(e){s=e},this.render=function(t,i){e.drawArrays(s,t,i),n.update(i,s,1)},this.renderInstances=function(i,a,o){if(0===o)return;let l,c;if(r)l=e,c="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,i,a,o),n.update(a,s,o)}}function Xs(e,t,n){let i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&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 a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,u=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),y=h>0,_=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:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:s?e.getParameter(36183):0}}function Ys(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new ks,o=new Zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(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;o.getNormalMatrix(r),(null===c||c.length0){const a=e.getRenderTarget(),o=new Rs(s.height/2);return o.fromEquirectangularTexture(e,r),t.set(r,o),e.setRenderTarget(a),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Vs.physical={uniforms:ws([Vs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Jn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Cr(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Jn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new Cr(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new Cr(1,1,1)},specularTintMap:{value:null}}]),vertexShader:Hs.meshphysical_vert,fragmentShader:Hs.meshphysical_frag};class Zs extends Ts{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,a=i+t,o=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,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,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}}Zs.prototype.isOrthographicCamera=!0;class Ks extends Es{constructor(e){super(e),this.type="RawShaderMaterial"}}Ks.prototype.isRawShaderMaterial=!0;const Qs=Math.pow(2,8),$s=[.125,.215,.35,.446,.526,.582],ea=5+$s.length,ta={[Zt]:0,[Kt]:1,[$t]:2,[tn]:3,[nn]:4,[rn]:5,[Qt]:6},na=new Rr({side:m,depthWrite:!1,depthTest:!1}),ia=new ys(new xs,na),ra=new Zs,{_lodPlanes:sa,_sizeLods:aa,_sigmas:oa}=ga(),la=new Cr;let ca=null;const ua=(1+Math.sqrt(5))/2,ha=1/ua,da=[new oi(1,1,1),new oi(-1,1,1),new oi(1,1,-1),new oi(-1,1,-1),new oi(0,ua,ha),new oi(0,ua,-ha),new oi(ha,0,ua),new oi(-ha,0,ua),new oi(ua,ha,0),new oi(-ua,ha,0)];function pa(e){const t=Math.max(e.r,e.g,e.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class fa{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(20),n=new oi(0,1,0);return new Ks({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:ta[Zt]},outputEncoding:{value:ta[Zt]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){ca=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=xa(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=_a(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e2?Qs:0,Qs,Qs),o.setRenderTarget(i),h&&o.render(ia,r),o.render(e,r)}o.toneMapping=u,o.outputEncoding=c,o.autoClear=l}_textureToCubeUV(e,t){const n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=xa()):null==this._equirectShader&&(this._equirectShader=_a());const i=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new ys(sa[0],i),s=i.uniforms;s.envMap.value=e,e.isCubeTexture||s.texelSize.value.set(1/e.image.width,1/e.image.height),s.inputEncoding.value=ta[e.encoding],s.outputEncoding.value=ta[t.texture.encoding],ya(t,0,0,3*Qs,2*Qs),n.setRenderTarget(t),n.render(r,ra)}_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:e4?i-8+4:0),3*v,2*v),o.setRenderTarget(t),o.render(c,ra)}}function ma(e){return void 0!==e&&e.type===Ee&&(e.encoding===Zt||e.encoding===Kt||e.encoding===Qt)}function ga(){const e=[],t=[],n=[];let i=8;for(let r=0;r4?a=$s[r-8+4-1]:0==r&&(a=0),n.push(a);const o=1/(s-1),l=-o/2,c=1+o/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*h),v=new Float32Array(f*d*h),y=new Float32Array(m*d*h);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];g.set(i,p*d*e),v.set(u,f*d*e);const r=[e,e,e,e,e,e];y.set(r,m*d*e)}const _=new es;_.setAttribute("position",new Ir(g,p)),_.setAttribute("uv",new Ir(v,f)),_.setAttribute("faceIndex",new Ir(y,m)),e.push(_),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function va(e){const t=new ii(3*Qs,3*Qs,e);return t.texture.mapping=ce,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function ya(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function _a(){const e=new Jn(1,1);return new Ks({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:ta[Zt]},outputEncoding:{value:ta[Zt]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}function xa(){return new Ks({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:ta[Zt]},outputEncoding:{value:ta[Zt]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}function ba(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&&(r.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping,a=s===oe||s===le,o=s===se||s===ae;if(a||o){if(t.has(r))return t.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){const s=e.getRenderTarget();null===n&&(n=new fa(e));const o=a?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,o),e.setRenderTarget(s),r.addEventListener("dispose",i),o.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function wa(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")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Ma(e,t,n,i){const r={},s=new WeakMap;function a(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(t.remove(l),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let a=0;if(null!==i){const e=i.array;a=i.version;for(let t=0,i=e.length;t65535?zr:Fr)(n,1);o.version=a;const l=s.get(e);l&&t.remove(l),s.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",a),r[t.id]=!0,n.memory.geometries++),t},update:function(e){const n=e.attributes;for(const e in n)t.update(n[e],34962);const i=e.morphAttributes;for(const e in i){const n=i[e];for(let e=0,i=n.length;e0)return e;const r=t*n;let s=Ba[r];if(void 0===s&&(s=new Float32Array(r),Ba[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 Ga(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function qo(e){return e.replace(jo,Xo)}function Xo(e,t){const n=Hs[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return qo(n)}const Yo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Jo=/#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 Zo(e){return e.replace(Jo,Qo).replace(Yo,Ko)}function Ko(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Qo(0,t,n,i)}function Qo(e,t,n,i){let r="";for(let e=parseInt(t);e0?e.gammaFactor:1,g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission>0)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Go).join("\n")}(n),v=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),y=r.createProgram();let _,x,b=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(_=[v].filter(Go).join("\n"),_.length>0&&(_+="\n"),x=[g,v].filter(Go).join("\n"),x.length>0&&(x+="\n")):(_=[$o(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,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 "+u:"",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.specularTintMap?"#define USE_SPECULARTINTMAP":"",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.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.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",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","#ifdef USE_MORPHTARGETS","\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(Go).join("\n"),x=[g,$o(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+m,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 "+u:"",n.envMap?"#define "+f:"",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.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",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":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Hs.tonemapping_pars_fragment:"",n.toneMapping!==Q?Ho("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Hs.encodings_pars_fragment,n.map?Uo("mapTexelToLinear",n.mapEncoding):"",n.matcap?Uo("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Uo("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Uo("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularTintMap?Uo("specularTintMapTexelToLinear",n.specularTintMapEncoding):"",n.lightMap?Uo("lightMapTexelToLinear",n.lightMapEncoding):"",zo("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Go).join("\n")),a=qo(a),a=Vo(a,n),a=Wo(a,n),o=qo(o),o=Vo(o,n),o=Wo(o,n),a=Zo(a),o=Zo(o),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",_=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#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+o,M=Do(r,35633,b+_+a),E=Do(r,35632,w);if(r.attachShader(y,M),r.attachShader(y,E),void 0!==n.index0AttributeName?r.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(y).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(E).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(y,35714)){i=!1;const t=Fo(r,M,"vertex"),n=Fo(r,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(y,35715),"gl.getProgramInfoLog",e,t,n)}else""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:_},fragmentShader:{log:n,prefix:x}})}let T,S;return r.deleteShader(M),r.deleteShader(E),this.getUniforms=function(){return void 0===T&&(T=new ko(r,y)),T},this.getAttributes=function(){return void 0===S&&(S=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,maxBones:T,useVertexTexture:u,morphTargets:x.geometry&&void 0!==x.geometry.morphAttributes.position,morphNormals:x.geometry&&void 0!==x.geometry.morphAttributes.normal,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&v.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,alphaTest:s.alphaTest,doubleSided:s.side===g,flipSided:s.side===m,depthPacking:void 0!==s.depthPacking&&s.depthPacking,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:l||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);if(!1===t.isRawShaderMaterial){for(let e=0;e0?r.push(u):!0===n.transparent?s.push(u):i.push(u)},unshift:function(e,t,n,a,l,c){const u=o(e,t,n,a,l,c);n.transmission>0?r.unshift(u):!0===n.transparent?s.unshift(u):i.unshift(u)},finish:function(){for(let e=n,i=t.length;e1&&i.sort(e||il),r.length>1&&r.sort(t||rl),s.length>1&&s.sort(t||rl)}}}function al(e){let t=new WeakMap;return{get:function(n,i){let r;return!1===t.has(n)?(r=new sl(e),t.set(n,[r])):i>=t.get(n).length?(r=new sl(e),t.get(n).push(r)):r=t.get(n)[i],r},dispose:function(){t=new WeakMap}}}function ol(){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 Cr};break;case"SpotLight":n={position:new oi,direction:new oi,color:new Cr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oi,color:new Cr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oi,skyColor:new Cr,groundColor:new Cr};break;case"RectAreaLight":n={color:new Cr,position:new oi,halfWidth:new oi,halfHeight:new oi}}return e[t.id]=n,n}}}let ll=0;function cl(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function ul(e,t){const n=new ol,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 Jn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Jn,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,a=new Fi,o=new Fi;return{setup:function(s){let a=0,o=0,l=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,u=0,h=0,d=0,p=0,f=0,m=0,g=0;s.sort(cl);for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Gs.LTC_FLOAT_1,r.rectAreaLTC2=Gs.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Gs.LTC_HALF_1,r.rectAreaLTC2=Gs.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=l;const v=r.hash;v.directionalLength===c&&v.pointLength===u&&v.spotLength===h&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=c,r.spot.length=h,r.rectArea.length=d,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=u,v.spotLength=h,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=ll++)},setupView:function(e,t){let n=0,i=0,l=0,c=0,u=0;const h=t.matrixWorldInverse;for(let t=0,d=e.length;t=n.get(i).length?(s=new hl(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class pl extends wr{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=sn,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!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}}pl.prototype.isMeshDepthMaterial=!0;class fl extends wr{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.fog=!1,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 ml(e,t,n){let i=new Os;const r=new Jn,s=new Jn,a=new ni,o=new pl({depthPacking:an}),l=new fl,c={},u=n.maxTextureSize,d={0:m,1:f,2:g},v=new Es({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Jn},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 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, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=v.clone();y.defines.HORIZONTAL_PASS=1;const x=new es;x.setAttribute("position",new Ir(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new ys(x,v),w=this;function M(n,i){const r=t.update(b);v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,v,b,null),y.uniforms.shadow_pass.value=n.mapPass.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,y,b,null)}function E(t,n,i,r,s,a,u){let h=null;const f=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==f?f:!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const e=h.uuid,t=i.uuid;let n=c[e];void 0===n&&(n={},c[e]=n);let r=n[t];void 0===r&&(r=h.clone(),n[t]=r),h=r}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=u===p?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,!0===r.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(r.matrixWorld),h.nearDistance=s,h.farDistance=a),h}function T(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&o===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;lu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/f.x),r.x=s.x*f.x,h.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/f.y),r.y=s.y*f.y,h.mapSize.y=s.y)),null===h.map&&!h.isPointLightShadow&&this.type===p){const e={minFilter:_e,magFilter:_e,format:Fe};h.map=new ii(r.x,r.y,e),h.map.texture.name=c.name+".shadowMap",h.mapPass=new ii(r.x,r.y,e),h.camera.updateProjectionMatrix()}if(null===h.map){const e={minFilter:fe,magFilter:fe,format:Fe};h.map=new ii(r.x,r.y,e),h.map.texture.name=c.name+".shadowMap",h.camera.updateProjectionMatrix()}e.setRenderTarget(h.map),e.clear();const m=h.getViewportCount();for(let e=0;e=1):-1!==ce.indexOf("OpenGL ES")&&(le=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),oe=le>=2);let ue=null,he={};const de=e.getParameter(3088),pe=e.getParameter(2978),fe=(new ni).fromArray(de),me=(new ni).fromArray(pe);function ge(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?Xn:Math.floor,s=i(r*e.width),a=i(r*e.height);void 0===p&&(p=m(s,a));const o=n?m(s,a):p;return o.width=s,o.height=a,o.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return jn(e.width)&&jn(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==fe&&e.minFilter!==_e}function _(t,n,r,s,a=1){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log2(Math.max(r,s,a))}function x(n,i,r){if(!1===o)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 s=i;return 6403===i&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===i&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===i&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function b(e){return e===fe||e===me||e===ve?9728:9729}function w(t){const n=t.target;n.removeEventListener("dispose",w),function(t){const n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}(n),n.isVideoTexture&&d.delete(n),a.memory.textures--}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(t){if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),a.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(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function S(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;R(t,i),n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const a=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,u=[];for(let e=0;e<6;e++)u[e]=a||l?l?i.image[e].image:i.image[e]:g(i.image[e],!1,!0,c);const h=u[0],d=v(h)||o,p=s.convert(i.format),f=s.convert(i.type),m=x(i.internalFormat,p,f);let b;if(C(34067,i,d),a){for(let e=0;e<6;e++){b=u[e].mipmaps;for(let t=0;t1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function R(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",w),t.__webglTexture=e.createTexture(),a.memory.textures++)}function P(t,i,r){let a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),R(t,i),n.activeTexture(33984+r),n.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const l=function(e){return!o&&(e.wrapS!==de||e.wrapT!==de||e.minFilter!==fe&&e.minFilter!==_e)}(i)&&!1===v(i.image),c=g(i.image,l,!1,u),h=v(c)||o,d=s.convert(i.format);let p,f=s.convert(i.type),m=x(i.internalFormat,d,f);C(a,i,h);const b=i.mipmaps;if(i.isDepthTexture)m=6402,o?m=i.type===Re?36012:i.type===Ce?33190:i.type===De?35056:33189:i.type===Re&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Ge&&6402===m&&i.type!==Ae&&i.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ae,f=s.convert(i.type)),i.format===Ve&&6402===m&&(m=34041,i.type!==De&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=De,f=s.convert(i.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(i.isDataTexture)if(b.length>0&&h){for(let e=0,t=b.length;e0&&h){for(let e=0,t=b.length;e=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=T,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?P(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?P(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=S,this.setupRenderTarget=function(t){const l=t.texture,c=i.get(t),u=i.get(l);t.addEventListener("dispose",M),!0!==t.isWebGLMultipleRenderTargets&&(u.__webglTexture=e.createTexture(),u.__version=l.version,a.memory.textures++);const h=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=!0===t.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=v(t)||o;if(!o||l.format!==Oe||l.type!==Re&&l.type!==Pe||(l.format=Fe,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){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;to+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class Ml extends Bn{constructor(e,t){super();const n=this,i=e.state;let r=null,s=1,a=null,o="local-floor",l=null,c=null,u=null,h=null,d=null;const p=[],f=new Map,m=new Ss;m.layers.enable(1),m.viewport=new ni;const g=new Ss;g.layers.enable(2),g.viewport=new ni;const v=[m,g],y=new _l;y.layers.enable(1),y.layers.enable(2);let _=null,x=null;function b(e){const t=f.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function w(){f.forEach((function(e,t){e.disconnect(t)})),f.clear(),_=null,x=null,i.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),L.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function M(e){const t=r.inputSources;for(let e=0;e0&&(e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationTint.value.copy(t.attenuationTint),e.specularIntensity.value=t.specularIntensity,e.specularTint.value.copy(t.specularTint),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularTintMap&&(e.specularTintMap.value=t.specularTintMap)}(e,i,a):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===m&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===m&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===m&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===m&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(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.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.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 Tl(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,o=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let h=null,d=null;const p=[],v=[];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.gammaFactor=2,this.outputEncoding=Zt,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1;const y=this;let _=!1,x=0,b=0,w=null,M=-1,E=null;const T=new ni,S=new ni;let A=null,L=t.width,C=t.height,R=1,P=null,N=null;const I=new ni(0,0,L,C),k=new ni(0,0,L,C);let D=!1;const B=[],O=new Os;let F=!1,U=!1,z=null;const H=new Fi,G=new oi,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return null===w?R:1}let j,q,X,Y,J,Z,K,$,ee,te,ne,ie,re,se,ae,oe,le,ce,ue,he,pe,me,ge,ve=n;function ye(e,n){for(let i=0;i0&&Ie(i,e,t),r.length>0&&function(e,t,n,i){if(null===z){const e=!0===a&&!0===q.isWebGL2;z=new(e?si:ii)(1024,1024,{generateMipmaps:!0,type:null!==me.convert(Pe)?Pe:Ee,minFilter:we,magFilter:fe,wrapS:de,wrapT:de})}const r=y.getRenderTarget();y.setRenderTarget(z),y.clear();const s=y.toneMapping;y.toneMapping=Q,Ie(e,n,i),y.toneMapping=s,Z.updateMultisampleRenderTarget(z),Z.updateRenderTargetMipmap(z),y.setRenderTarget(r),Ie(t,n,i)}(i,r,e,t),s.length>0&&Ie(s,e,t),null!==w&&(Z.updateMultisampleRenderTarget(w),Z.updateRenderTargetMipmap(w)),!0===e.isScene&&e.onAfterRender(y,e,t),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1),ge.resetDefaultState(),M=-1,E=null,v.pop(),d=v.length>0?v[v.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return w},this.setRenderTarget=function(e,t=0,n=0){w=e,x=t,b=n,e&&void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e);let i=null,r=!1,s=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const a=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t],r=!0):i=e.isWebGLMultisampleRenderTarget?J.get(e).__webglMultisampledFramebuffer:a,T.copy(e.viewport),S.copy(e.scissor),A=e.scissorTest}else T.copy(I).multiplyScalar(R).floor(),S.copy(k).multiplyScalar(R).floor(),A=D;if(X.bindFramebuffer(36160,i)&&q.drawBuffers){let t=!1;if(e)if(e.isWebGLMultipleRenderTargets){const n=e.texture;if(B.length!==n.length||36064!==B[0]){for(let e=0,t=n.length;e=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ve.readPixels(t,n,i,r,me.convert(o),me.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==w?J.get(w).__webglFramebuffer:null;X.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);let a=me.convert(t.format);q.isWebGL2&&(6407===a&&(a=32849),6408===a&&(a=32856)),Z.setTexture2D(t,0),ve.copyTexImage2D(3553,n,a,e.x,e.y,r,s,0),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,a=me.convert(n.format),o=me.convert(n.type);Z.setTexture2D(n,0),ve.pixelStorei(37440,n.flipY),ve.pixelStorei(37441,n.premultiplyAlpha),ve.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ve.texSubImage2D(3553,i,e.x,e.y,r,s,a,o,t.image.data):t.isCompressedTexture?ve.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):ve.texSubImage2D(3553,i,e.x,e.y,a,o,t.image),0===i&&n.generateMipmaps&&ve.generateMipmap(3553),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(y.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,a=e.max.y-e.min.y+1,o=e.max.z-e.min.z+1,l=me.convert(i.format),c=me.convert(i.type);let u;if(i.isDataTexture3D)Z.setTexture3D(i,0),u=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(i,0),u=35866}ve.pixelStorei(37440,i.flipY),ve.pixelStorei(37441,i.premultiplyAlpha),ve.pixelStorei(3317,i.unpackAlignment);const h=ve.getParameter(3314),d=ve.getParameter(32878),p=ve.getParameter(3316),f=ve.getParameter(3315),m=ve.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ve.pixelStorei(3314,g.width),ve.pixelStorei(32878,g.height),ve.pixelStorei(3316,e.min.x),ve.pixelStorei(3315,e.min.y),ve.pixelStorei(32877,e.min.z),n.isDataTexture||n.isDataTexture3D?ve.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ve.compressedTexSubImage3D(u,r,t.x,t.y,t.z,s,a,o,l,g.data)):ve.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,l,c,g),ve.pixelStorei(3314,h),ve.pixelStorei(32878,d),ve.pixelStorei(3316,p),ve.pixelStorei(3315,f),ve.pixelStorei(32877,m),0===r&&i.generateMipmaps&&ve.generateMipmap(u),X.unbindTexture()},this.initTexture=function(e){Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){x=0,b=0,w=null,X.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Sl extends Tl{}Sl.prototype.isWebGL1Renderer=!0;class Al{constructor(e,t=25e-5){this.name="",this.color=new Cr(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 Cr(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 cr{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 Rl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Hn()}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:o,point:Dl.clone(),uv:xr.getUV(Dl,Hl,Gl,Vl,Wl,jl,ql,new Jn),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 Yl(e,t,n,i,r,s){Fl.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Ul.x=s*Fl.x-r*Fl.y,Ul.y=r*Fl.x+s*Fl.y):Ul.copy(Fl),e.copy(t),e.x+=Ul.x,e.y+=Ul.y,e.applyMatrix4(zl)}Xl.prototype.isSprite=!0;const Jl=new oi,Zl=new oi;class Kl extends cr{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){Jl.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Jl);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Jl.setFromMatrixPosition(e.matrixWorld),Zl.setFromMatrixPosition(this.matrixWorld);const n=Jl.distanceTo(Zl)/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;io)continue;h.applyMatrix4(this.matrixWorld);const d=e.ray.origin.distanceTo(h);de.far||t.push({distance:d,point:u.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;no)continue;h.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(h);ie.far||t.push({distance:i,point:u.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.")}}}xc.prototype.isLine=!0;const bc=new oi,wc=new oi;class Mc extends xc{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 Pc(e,t,n,i,r,s,a){const o=Ac.distanceSqToPoint(e);if(or.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:a})}}Rc.prototype.isPoints=!0;class Nc extends ei{constructor(e,t,n,i,r,s,a,o,l){super(e,t,n,i,r,s,a,o,l),this.format=void 0!==a?a:Oe,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)}}Nc.prototype.isVideoTexture=!0;class Ic extends ei{constructor(e,t,n,i,r,s,a,o,l,c,u,h){super(null,s,a,o,l,c,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}Ic.prototype.isCompressedTexture=!0;class kc extends ei{constructor(e,t,n,i,r,s,a,o,l){super(e,t,n,i,r,s,a,o,l),this.needsUpdate=!0}}kc.prototype.isCanvasTexture=!0;class Dc extends ei{constructor(e,t,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:Ge)!==Ge&&c!==Ve)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Ge&&(n=Ae),void 0===n&&c===Ve&&(n=De),super(null,i,r,s,a,o,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==a?a:fe,this.minFilter=void 0!==o?o:fe,this.flipY=!1,this.generateMipmaps=!1}}Dc.prototype.isDepthTexture=!0;class Bc extends es{constructor(e=1,t=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],s=[],a=[],o=[],l=new oi,c=new Jn;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,u=3;r<=t;r++,u+=3){const h=n+r/t*i;l.x=e*Math.cos(h),l.y=e*Math.sin(h),s.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(s[u]/e+1)/2,c.y=(s[u+1]/e+1)/2,o.push(c.x,c.y)}for(let e=1;e<=t;e++)r.push(e,e+1,0);this.setIndex(r),this.setAttribute("position",new Gr(s,3)),this.setAttribute("normal",new Gr(a,3)),this.setAttribute("uv",new Gr(o,2))}static fromJSON(e){return new Bc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Oc extends es{constructor(e=1,t=1,n=1,i=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],u=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,s=new Jn,f=new oi;let v=0;const y=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=i;e++)u.push(0,m*_,0),h.push(0,_,0),d.push(.5,.5),p++;const x=p;for(let e=0;e<=i;e++){const t=e/i*o+a,n=Math.cos(t),r=Math.sin(t);f.x=y*r,f.y=m*_,f.z=y*n,u.push(f.x,f.y,f.z),h.push(0,_,0),s.x=.5*n+.5,s.y=.5*r*_+.5,d.push(s.x,s.y),p++}for(let e=0;e0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Gr(u,3)),this.setAttribute("normal",new Gr(h,3)),this.setAttribute("uv",new Gr(d,2))}static fromJSON(e){return new Oc(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fc extends Oc{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,a=2*Math.PI){super(0,e,t,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(e){return new Fc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Uc extends es{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 a(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?a:a.clone().lerp(o,e/l)}for(let e=0;e.9&&a<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Gr(r,3)),this.setAttribute("normal",new Gr(r.slice(),3)),this.setAttribute("uv",new Gr(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Uc(e.vertices,e.indices,e.radius,e.details)}}class zc extends Uc{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 zc(e.radius,e.detail)}}const Hc=new oi,Gc=new oi,Vc=new oi,Wc=new xr;class jc extends es{constructor(e,t){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1,!0===e.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.cos(Un*t),i=e.getIndex(),r=e.getAttribute("position"),s=i?i.count:r.count,a=[0,0,0],o=["a","b","c"],l=new Array(3),c={},u=[];for(let e=0;e0)){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),a=this.getPoint(r),o=t||(s.isVector2?new Jn:new oi);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oi,i=[],r=[],s=[],a=new oi,o=new Fi;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new oi),i[t].normalize()}r[0]=new oi,s[0]=new oi;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),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(),a.crossVectors(i[t-1],i[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(Gn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Gn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.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 Xc extends qc{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=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=a,this.aRotation=o}getPoint(e,t){const n=t||new Jn,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?a=i[(l-1)%r]:(Zc.subVectors(i[0],i[1]).add(i[0]),a=Zc);const u=i[l%r],h=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return n.set(tu(a,o.x,l.x,c.x,u.x),tu(a,o.y,l.y,c.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t0)for(s=t;s=t;s-=i)a=Iu(s,e[s],e[s+1],a);return a&&Au(a,a.next)&&(ku(a),a=a.next),a}function pu(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Au(i,i.next)&&0!==Su(i.prev,i,i.next))i=i.next;else{if(ku(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function fu(e,t,n,i,r,s,a){if(!e)return;!a&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=wu(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,a,o,l,c=1;do{for(n=e,e=null,s=null,a=0;n;){for(a++,i=n,o=0,t=0;t0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(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(a>1)}(r)}(e,i,r,s);let o,l,c=e;for(;e.prev!==e.next;)if(o=e.prev,l=e.next,s?gu(e,i,r,s):mu(e))t.push(o.i/n),t.push(e.i/n),t.push(l.i/n),ku(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?fu(e=vu(pu(e),t,n),t,n,i,r,s,2):2===a&&yu(e,t,n,i,r,s):fu(pu(e),t,n,i,r,s,1);break}}function mu(e){const t=e.prev,n=e,i=e.next;if(Su(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(Eu(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Su(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function gu(e,t,n,i){const r=e.prev,s=e,a=e.next;if(Su(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,u=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,h=wu(o,l,t,n,i),d=wu(c,u,t,n,i);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Eu(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Su(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Eu(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Su(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Eu(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Su(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Eu(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Su(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function vu(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Au(r,s)&&Lu(r,i,i.next,s)&&Pu(r,s)&&Pu(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),ku(i),ku(i.next),i=e=s),i=i.next}while(i!==e);return pu(i)}function yu(e,t,n,i,r,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Tu(a,e)){let o=Nu(a,e);return a=pu(a,a.next),o=pu(o,o.next),fu(a,t,n,i,r,s),void fu(o,t,n,i,r,s)}e=e.next}a=a.next}while(a!==e)}function _u(e,t){return e.x-t.x}function xu(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,a=-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>a){if(a=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&&Eu(rs.x||n.x===s.x&&bu(s,n)))&&(s=n,h=u)),n=n.next}while(n!==o);return s}(e,t)){const n=Nu(t,e);pu(t,t.next),pu(n,n.next)}}function bu(e,t){return Su(e.prev,e,t.prev)<0&&Su(t.next,e,e.next)<0}function wu(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 Mu(e){let t=e,n=e;do{(t.x=0&&(e-a)*(i-o)-(n-a)*(t-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function Tu(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&&Lu(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Pu(e,t)&&Pu(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)&&(Su(e.prev,e,t.prev)||Su(e,t.prev,t))||Au(e,t)&&Su(e.prev,e,e.next)>0&&Su(t.prev,t,t.next)>0)}function Su(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Au(e,t){return e.x===t.x&&e.y===t.y}function Lu(e,t,n,i){const r=Ru(Su(e,t,n)),s=Ru(Su(e,t,i)),a=Ru(Su(n,i,e)),o=Ru(Su(n,i,t));return r!==s&&a!==o||!(0!==r||!Cu(e,n,t))||!(0!==s||!Cu(e,i,t))||!(0!==a||!Cu(n,e,i))||!(0!==o||!Cu(n,t,i))}function Cu(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 Ru(e){return e>0?1:e<0?-1:0}function Pu(e,t){return Su(e.prev,e,e.next)<0?Su(e,t,e.next)>=0&&Su(e,e.prev,t)>=0:Su(e,t,e.prev)<0||Su(e,e.next,t)<0}function Nu(e,t){const n=new Du(e.i,e.x,e.y),i=new Du(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 Iu(e,t,n,i){const r=new Du(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 ku(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 Du(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 Bu{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){o=c=e[0],l=u=e[1];for(let t=n;tc&&(c=h),d>u&&(u=d);p=Math.max(c-o,u-l),p=0!==p?1/p:0}return fu(s,a,n,o,l,p),a}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function Fu(e,t){for(let n=0;nNumber.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(l*l+c*c),p=t.x-o/h,f=t.y+a/h,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(a*c-o*l);i=p+a*m-e.x,r=f+o*m-e.y;const g=i*i+r*r;if(g<=2)return new Jn(i,r);s=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(c)&&(e=!0),e?(i=-o,r=a,s=Math.sqrt(u)):(i=a,r=o,s=Math.sqrt(u/2))}return new Jn(i/s,r/s)}const P=[];for(let e=0,t=S.length,n=t-1,i=e+1;e=0;e--){const t=e/p,n=u*Math.cos(t*Math.PI/2),i=h*Math.sin(t*Math.PI/2)+d;for(let e=0,t=S.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*p;e=0?(e(i-o,p,u),h.subVectors(c,u)):(e(i+o,p,u),h.subVectors(u,c)),p-o>=0?(e(i,p-o,u),d.subVectors(c,u)):(e(i,p+o,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),s.push(l.x,l.y,l.z),a.push(i,p)}}for(let e=0;e0)&&d.push(t,r,l),(e!==n-1||o=i)){l.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(o=s.tracks[e].times[0]);for(let e=0;e=i.times[h]){const e=h*l+o,t=e+l-o;d=dh.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=o,n=l-o;e.evaluate(s),d=dh.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new ai).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let e=0;e=r)break e;{const a=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=dh.arraySlice(n,r,s),this.values=dh.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&&dh.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=dh.arraySlice(this.times),t=dh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ht,r=e.length-1;let s=1;for(let a=1;a0){e[s]=e[r];for(let e=r*n,i=s*n,a=0;a!==n;++a)t[i+a]=t[e+a];++s}return s!==e.length?(this.times=dh.arraySlice(e,0,s),this.values=dh.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=dh.arraySlice(this.times,0),t=dh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}vh.prototype.TimeBufferType=Float32Array,vh.prototype.ValueBufferType=Float32Array,vh.prototype.DefaultInterpolation=zt;class yh extends vh{}yh.prototype.ValueTypeName="bool",yh.prototype.ValueBufferType=Array,yh.prototype.DefaultInterpolation=Ut,yh.prototype.InterpolantFactoryMethodLinear=void 0,yh.prototype.InterpolantFactoryMethodSmooth=void 0;class _h extends vh{}_h.prototype.ValueTypeName="color";class xh extends vh{}xh.prototype.ValueTypeName="number";class bh extends ph{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t);let l=e*a;for(let e=l+a;l!==e;l+=4)ai.slerpFlat(r,0,s,l-a,s,l,o);return r}}class wh extends vh{InterpolantFactoryMethodLinear(e){return new bh(this.times,this.values,this.getValueSize(),e)}}wh.prototype.ValueTypeName="quaternion",wh.prototype.DefaultInterpolation=zt,wh.prototype.InterpolantFactoryMethodSmooth=void 0;class Mh extends vh{}Mh.prototype.ValueTypeName="string",Mh.prototype.ValueBufferType=Array,Mh.prototype.DefaultInterpolation=Ut,Mh.prototype.InterpolantFactoryMethodLinear=void 0,Mh.prototype.InterpolantFactoryMethodSmooth=void 0;class Eh extends vh{}Eh.prototype.ValueTypeName="vector";class Th{constructor(e,t=-1,n,i=jt){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Hn(),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(Sh(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(vh.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=[],a=[];dh.flattenJSON(n,s,a,i),0!==s.length&&r.push(new e(t,s,a))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e0||0===e.search(/^data\:image\/jpeg/);r.format=i?Oe:Fe,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class Uh extends qc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new au(t,e))}getPoint(e){const t=e*this.getLength(),n=this.getCurveLengths();let i=0;for(;i=t){const e=n[i]-t,r=this.curves[i],s=r.getLength(),a=0===s?0:1-e/s;return r.getPointAt(a)}i++}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 Hh extends zh{constructor(e){super(e),this.uuid=Hn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;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 Cr).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Jn).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new oi).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new ni).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Zn).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Fi).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 Jn).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.specularTintMap&&(i.specularTintMap=n(e.specularTintMap)),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 Jn).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),i}setTextures(e){return this.textures=e,this}}class ld{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 Lh(t);r=new Dh(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new Dh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;tNumber.EPSILON){if(l<0&&(n=t[s],o=-o,a=t[r],l=-l),e.ya.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return i}const r=Bu.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let a,o,l;const c=[];if(1===s.length)return o=s[0],l=new Hh,l.curves=o.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1;const t=[];for(let e=0,t=d.length;e0&&(e||(m=h))}for(let e=0,t=d.length;e0){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]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let 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){ai.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;ai.multiplyQuaternionsFlat(e,s,e,t,e,n),ai.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]*s+e[n+a]*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 Wd=new RegExp("[\\[\\]\\.:\\/]","g"),jd="[^\\[\\]\\.:\\/]",qd="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Xd=/((?:WC+[\/:])*)/.source.replace("WC",jd),Yd=/(WCOD+)?/.source.replace("WCOD",qd),Jd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jd),Zd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jd),Kd=new RegExp("^"+Xd+Yd+Jd+Zd+"$"),Qd=["material","materials","bones"];class $d{constructor(e,t,n){this.path=t,this.parsedPath=n||$d.parseTrackName(t),this.node=$d.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 $d.Composite(e,t,n):new $d(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Wd,"")}static parseTrackName(e){const t=Kd.exec(e);if(!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!==Qd.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(!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[o]=s,e[s]=a;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 a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=t[o];if(void 0!==l)if(delete t[o],l0&&(t[a.uuid]=l),e[l]=a,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,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,s.push(e),a.push(t),r.push(u);for(let n=c,i=o.length;n!==i;++n){const i=o[n];u[n]=new $d(i,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];t[e[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}ep.prototype.isAnimationObjectGroup=!0;class tp{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,a=new Array(s),o={endingStart:Gt,endingEnd:Gt};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);a[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ot,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 a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[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),a=this._updateWeight(e);if(a>0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case qt:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(a);break;case jt:default:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,a)}}}_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===Ft;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(n===Bt){-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 a=this.repetitions-r;if(a<=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===a){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=Vt,i.endingEnd=Vt):(i.endingStart=e?this.zeroSlopeAtStart?Vt:Gt:Wt,i.endingEnd=t?this.zeroSlopeAtEnd?Vt:Gt:Wt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=t,a[1]=r+e,o[1]=n,this}}class np extends Bn{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,a=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let u=c[l];if(void 0!==u)s[e]=u;else{if(u=s[e],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;u=new Vd($d.create(n,l,i),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,l),s[e]=u}a[e].resultBuffer=u.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 a=0;a!==n;++a)t[a]._update(i,e,r,s);const a=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)a[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 hp.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)}}dp.prototype.isBox2=!0;const pp=new oi,fp=new oi;class mp{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){pp.subVectors(e,this.start),fp.subVectors(this.end,this.start);const n=fp.dot(fp);let i=fp.dot(pp)/n;return t&&(i=Gn(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)}}class gp extends cr{constructor(e){super(),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}gp.prototype.isImmediateRenderObject=!0;const vp=new oi;class yp extends cr{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new es,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 Xp extends Mc{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 es;n.setAttribute("position",new Gr(t,3)),n.setAttribute("color",new Gr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new fc({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new Cr,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()}}const Yp=new Float32Array(1),Jp=new Int32Array(Yp.buffer);class Zp{static toHalfFloat(e){Yp[0]=e;const t=Jp[0];let n=t>>16&32768,i=t>>12&2047;const r=t>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&t,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}}const Kp=0,Qp=1,$p=0,ef=1,tf=2;function nf(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function rf(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}function sf(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Rc(e,t)}function af(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Xl(e)}function of(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Rc(e,t)}function lf(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Tc(e)}function cf(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Tc(e)}function uf(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Tc(e)}function hf(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new oi(e,t,n)}function df(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Ir(e,t).setUsage(Sn)}function pf(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new kr(e,t)}function ff(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Dr(e,t)}function mf(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Br(e,t)}function gf(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Or(e,t)}function vf(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Fr(e,t)}function yf(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ur(e,t)}function _f(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new zr(e,t)}function xf(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Gr(e,t)}function bf(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Vr(e,t)}function wf(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Xp(e)}function Mf(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new zp(e,t)}function Ef(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Mc(new jc(e.geometry),new fc({color:void 0!==t?t:16777215}))}function Tf(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Mc(new $u(e.geometry),new fc({color:void 0!==t?t:16777215}))}function Sf(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Nh(e)}function Af(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Oh(e)}function Lf(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Rs(e,n)}function Cf(){console.error("THREE.CanvasRenderer has been removed")}function Rf(){console.error("THREE.JSONLoader has been removed.")}qc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(qc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},zh.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},Cp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},wp.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Rh.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ld.extractUrlBase(e)},Rh.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.")}},dp.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},dp.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},dp.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},dp.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},ui.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ui.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ui.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ui.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ui.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Ci.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Os.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},mp.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Zn.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Zn.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Zn.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},Zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Zn.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Fi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Fi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Fi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new oi).setFromMatrixColumn(this,3)},Fi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Fi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Fi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Fi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Fi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Fi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Fi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Fi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Fi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Fi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Fi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Fi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Fi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Fi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Fi.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)},Fi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},ks.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},ai.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},ai.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Oi.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Oi.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Oi.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},xr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},xr.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},xr.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},xr.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},xr.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},xr.barycoordFromPoint=function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),xr.getBarycoord(e,t,n,i,r)},xr.normal=function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),xr.getNormal(e,t,n,i)},Hh.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Hh.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Uu(this,e)},Hh.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new qu(this,e)},Jn.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Jn.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Jn.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()},ni.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},ni.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},cr.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},cr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},cr.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},cr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},cr.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(cr.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.")}}}),ys.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(ys.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Xt},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.")}}}),ic.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ss.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(Gh.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(Ir.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)}}}),Ir.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Sn:Tn),this},Ir.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ir.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},es.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},es.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 Ir(arguments[1],arguments[2])))},es.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)},es.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},es.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},es.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},es.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(es.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}}}),Rl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Sn:Tn),this},Rl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Uu.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Uu.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Uu.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Cl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},ip.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(wr.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 Cr}},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===v}},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(Es.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}}}),Tl.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)},Tl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},Tl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Tl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Tl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Tl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Tl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Tl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Tl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Tl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Tl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Tl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Tl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Tl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Tl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},Tl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Tl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Tl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Tl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Tl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Tl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Tl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Tl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Tl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Tl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Tl.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?Kt:Zt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(ml.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.")}}}),Object.defineProperties(ii.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}}}),Bd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return(new Md).load(e,(function(e){t.setBuffer(e)})),this},Gd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ls.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Ls.prototype.clear=function(e,t,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,i)},Qn.crossOrigin=void 0,Qn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new Fh;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Qn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new Bh;r.setCrossOrigin(this.crossOrigin);const s=r.load(e,n,void 0,i);return t&&(s.mapping=t),s},Qn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Qn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Pf={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 Nf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"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)},886:(e,t,n)=>{"use strict";n.d(t,{z:()=>o});var i=n(212);const r={type:"change"},s={type:"start"},a={type:"end"};class o 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 u.phi},this.getAzimuthalAngle=function(){return u.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=o.NONE},this.update=function(){const t=new i.Vector3,s=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),a=s.clone().invert(),m=new i.Vector3,g=new i.Quaternion,v=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(s),u.setFromVector3(t),n.autoRotate&&l===o.NONE&&A(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(u.theta+=h.theta*n.dampingFactor,u.phi+=h.phi*n.dampingFactor):(u.theta+=h.theta,u.phi+=h.phi);let i=n.minAzimuthAngle,y=n.maxAzimuthAngle;return isFinite(i)&&isFinite(y)&&(i<-Math.PI?i+=v:i>Math.PI&&(i-=v),y<-Math.PI?y+=v:y>Math.PI&&(y-=v),u.theta=i<=y?Math.max(i,Math.min(y,u.theta)):u.theta>(i+y)/2?Math.max(i,u.theta):Math.min(y,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=d,u.radius=Math.max(n.minDistance,Math.min(n.maxDistance,u.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),t.setFromSpherical(u),t.applyQuaternion(a),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(h.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",Y),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,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,u=new i.Spherical,h=new i.Spherical;let d=1;const p=new i.Vector3;let f=!1;const m=new i.Vector2,g=new i.Vector2,v=new i.Vector2,y=new i.Vector2,_=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,E=[],T={};function S(){return Math.pow(.95,n.zoomSpeed)}function A(e){h.theta-=e}function L(e){h.phi-=e}const C=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 a=e.length();a*=Math.tan(n.object.fov/2*Math.PI/180),C(2*t*a/r.clientHeight,n.object.matrix),R(2*i*a/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(C(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 N(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 k(e){m.set(e.clientX,e.clientY)}function D(e){y.set(e.clientX,e.clientY)}function B(){if(1===E.length)m.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);m.set(e,t)}}function O(){if(1===E.length)y.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);y.set(e,t)}}function F(){const e=E[0].pageX-E[1].pageX,t=E[0].pageY-E[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function U(e){if(1==E.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)}v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*v.x/t.clientHeight),L(2*Math.PI*v.y/t.clientHeight),m.copy(g)}function z(e){if(1===E.length)_.set(e.pageX,e.pageY);else{const t=K(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);_.set(n,i)}x.subVectors(_,y).multiplyScalar(n.panSpeed),P(x.x,x.y),y.copy(_)}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)),N(M.y),b.copy(w)}function G(e){!1!==n.enabled&&(0===E.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",W)),function(e){E.push(e)}(e),"touch"===e.pointerType?function(e){switch(Z(e),E.length){case 1:switch(n.touches.ONE){case i.TOUCH.ROTATE:if(!1===n.enableRotate)return;B(),l=o.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===n.enablePan)return;O(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(n.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&F(),n.enablePan&&O(),l=o.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&F(),n.enableRotate&&B(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.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=o.DOLLY;break;case i.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;D(e),l=o.PAN}else{if(!1===n.enableRotate)return;k(e),l=o.ROTATE}break;case i.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;k(e),l=o.ROTATE}else{if(!1===n.enablePan)return;D(e),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&n.dispatchEvent(s)}(e))}function V(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),l){case o.TOUCH_ROTATE:if(!1===n.enableRotate)return;U(e),n.update();break;case o.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case o.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 o.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&H(e),n.enableRotate&&U(e)}(e),n.update();break;default:l=o.NONE}}(e):function(e){if(!1!==n.enabled)switch(l){case o.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;A(2*Math.PI*v.x/t.clientHeight),L(2*Math.PI*v.y/t.clientHeight),m.copy(g),n.update()}(e);break;case o.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,b),M.y>0?N(S()):M.y<0&&I(S()),b.copy(w),n.update()}(e);break;case o.PAN:if(!1===n.enablePan)return;!function(e){_.set(e.clientX,e.clientY),x.subVectors(_,y).multiplyScalar(n.panSpeed),P(x.x,x.y),y.copy(_),n.update()}(e)}}(e))}function W(e){!1!==n.enabled&&(e.pointerType,n.dispatchEvent(a),l=o.NONE,J(e),0===E.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",W)))}function j(e){J(e)}function q(e){!1===n.enabled||!1===n.enableZoom||l!==o.NONE&&l!==o.ROTATE||(e.preventDefault(),n.dispatchEvent(s),function(e){e.deltaY<0?I(S()):e.deltaY>0&&N(S()),n.update()}(e),n.dispatchEvent(a))}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 Y(e){!1!==n.enabled&&e.preventDefault()}function J(e){delete T[e.pointerId];for(let t=0;t{"use strict";n.d(t,{G:()=>s});var i=n(212);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,a=!1,o=!1;switch(r.image_type){case 9:s=!0,a=!0;break;case 1:a=!0;break;case 10:s=!0;break;case 2:break;case 11:s=!0,o=!0;break;case 3:o=!0}const l=new Uint8Array(r.width*r.height*4),c=function(e,t,n,i,r){let s,a;const o=n.pixel_size>>3,l=n.width*n.height*o;if(t&&(a=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;s=new Uint8Array(l);let a=0;const c=new Uint8Array(o);for(;a>4){default:case 2:a=0,c=1,h=t,l=0,u=1,d=n;break;case 0:a=0,c=1,h=t,l=n-1,u=-1,d=-1;break;case 3:a=t-1,c=-1,h=-1,l=0,u=1,d=n;break;case 1:a=t-1,c=-1,h=-1,l=n-1,u=-1,d=-1}if(o)switch(r.pixel_size){case 8:!function(e,t,n,i,s,a,o,l){let c,u,h,d=0;const p=r.width;for(h=t;h!==i;h+=n)for(u=s;u!==o;u+=a,d++)c=l[d],e[4*(u+p*h)+0]=c,e[4*(u+p*h)+1]=c,e[4*(u+p*h)+2]=c,e[4*(u+p*h)+3]=255}(e,l,u,d,a,c,h,i);break;case 16:!function(e,t,n,i,s,a,o,l){let c,u,h=0;const d=r.width;for(u=t;u!==i;u+=n)for(c=s;c!==o;c+=a,h+=2)e[4*(c+d*u)+0]=l[h+0],e[4*(c+d*u)+1]=l[h+0],e[4*(c+d*u)+2]=l[h+0],e[4*(c+d*u)+3]=l[h+1]}(e,l,u,d,a,c,h,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,s,a,o,l,c){const u=c;let h,d,p,f=0;const m=r.width;for(p=t;p!==i;p+=n)for(d=s;d!==o;d+=a,f++)h=l[f],e[4*(d+m*p)+3]=255,e[4*(d+m*p)+2]=u[3*h+0],e[4*(d+m*p)+1]=u[3*h+1],e[4*(d+m*p)+0]=u[3*h+2]}(e,l,u,d,a,c,h,i,s);break;case 16:!function(e,t,n,i,s,a,o,l){let c,u,h,d=0;const p=r.width;for(h=t;h!==i;h+=n)for(u=s;u!==o;u+=a,d+=2)c=l[d+0]+(l[d+1]<<8),e[4*(u+p*h)+0]=(31744&c)>>7,e[4*(u+p*h)+1]=(992&c)>>2,e[4*(u+p*h)+2]=(31&c)>>3,e[4*(u+p*h)+3]=32768&c?0:255}(e,l,u,d,a,c,h,i);break;case 24:!function(e,t,n,i,s,a,o,l){let c,u,h=0;const d=r.width;for(u=t;u!==i;u+=n)for(c=s;c!==o;c+=a,h+=3)e[4*(c+d*u)+3]=255,e[4*(c+d*u)+2]=l[h+0],e[4*(c+d*u)+1]=l[h+1],e[4*(c+d*u)+0]=l[h+2]}(e,l,u,d,a,c,h,i);break;case 32:!function(e,t,n,i,s,a,o,l){let c,u,h=0;const d=r.width;for(u=t;u!==i;u+=n)for(c=s;c!==o;c+=a,h+=4)e[4*(c+d*u)+2]=l[h+0],e[4*(c+d*u)+1]=l[h+1],e[4*(c+d*u)+0]=l[h+2],e[4*(c+d*u)+3]=l[h+3]}(e,l,u,d,a,c,h,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,a=""===s.path?i.LoaderUtils.extractUrlBase(e):s.path,o=new i.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,(function(n){try{t(s.parse(n,a))}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,a)),o.length>0&&t.push(new i.QuaternionKeyframeTrack(r+".quaternion",s,o)),l.length>0&&t.push(new i.VectorKeyframeTrack(r+".scale",s,l)),t}function E(e,t,n){let i,r,s,a=!0;for(r=0,s=e.length;r=0;){const i=e[t];if(null!==i.value[n])return i;t--}return null}function S(e,t,n){for(;t>>0));switch(n=n.toLowerCase(),n){case"tga":t=qe;break;default:t=je}return t}(r);if(void 0!==t){const n=t.load(r),s=e.extra;if(void 0!==s&&void 0!==s.technique&&!1===c(s.technique)){const e=s.technique;n.wrapS=e.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,n.wrapT=e.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,n.offset.set(e.offsetU||0,e.offsetV||0),n.repeat.set(e.repeatU||1,e.repeatV||1)}else n.wrapS=i.RepeatWrapping,n.wrapT=i.RepeatWrapping;return n}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",r),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}a.name=e.name||"";const l=r.parameters;for(const e in l){const t=l[e];switch(e){case"diffuse":t.color&&a.color.fromArray(t.color),t.texture&&(a.map=o(t.texture));break;case"specular":t.color&&a.specular&&a.specular.fromArray(t.color),t.texture&&(a.specularMap=o(t.texture));break;case"bump":t.texture&&(a.normalMap=o(t.texture));break;case"ambient":t.texture&&(a.lightMap=o(t.texture));break;case"shininess":t.float&&a.shininess&&(a.shininess=t.float);break;case"emission":t.color&&a.emissive&&a.emissive.fromArray(t.color),t.texture&&(a.emissiveMap=o(t.texture))}}let u=l.transparent,h=l.transparency;if(void 0===h&&u&&(h={float:1}),void 0===u&&h&&(u={opaque:"A_ONE",data:{color:[1,1,1,1]}}),u&&h)if(u.data.texture)a.transparent=!0;else{const e=u.data.color;switch(u.opaque){case"A_ONE":a.opacity=e[3]*h.float;break;case"RGB_ZERO":a.opacity=1-e[0]*h.float;break;case"A_ZERO":a.opacity=1-e[3]*h.float;break;case"RGB_ONE":a.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',u.opaque)}a.opacity<1&&(a.transparent=!0)}return void 0!==s&&void 0!==s.technique&&1===s.technique.double_sided&&(a.side=i.DoubleSide),a}function Z(e){return f(Ze.materials[e],J)}function K(e){for(let t=0;t0?n+s:n;t.inputs[a]={id:e,offset:r},t.stride=Math.max(t.stride,r+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=o(i.textContent);break;case"p":t.p=o(i.textContent)}}return t}function ce(e){let t=0;for(let n=0,i=e.length;n0&&t0&&d.setAttribute("position",new i.Float32BufferAttribute(s.array,s.stride)),a.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(a.array,a.stride)),c.array.length>0&&d.setAttribute("color",new i.Float32BufferAttribute(c.array,c.stride)),o.array.length>0&&d.setAttribute("uv",new i.Float32BufferAttribute(o.array,o.stride)),l.array.length>0&&d.setAttribute("uv2",new i.Float32BufferAttribute(l.array,l.stride)),u.length>0&&d.setAttribute("skinIndex",new i.Float32BufferAttribute(u,4)),h.length>0&&d.setAttribute("skinWeight",new i.Float32BufferAttribute(h,4)),r.data=d,r.type=e[0].type,r.materialKeys=p,r}function de(e,t,n,i){const r=e.p,s=e.stride,a=e.vcount;function o(e){let t=r[e+n]*c;const s=t+c;for(;t4)for(let t=1,i=n-2;t<=i;t++){const n=e+s*t,i=e+s*(t+1);o(e+0*s),o(n),o(i)}e+=s*n}}else for(let e=0,t=r.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ye(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(212);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,a=""===this.path?i.LoaderUtils.extractUrlBase(e):this.path,o=new i.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(s.parse(n,a))}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+/,a={};for(let e=0;e=0?t.substring(0,s):t;o=o.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===o)i={name:l},a[l]=i;else if("ka"===o||"kd"===o||"ks"===o||"ke"===o){const e=l.split(r,3);i[o]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[o]=l}const o=new s(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(a),o}}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 i=t.getTextureParams(n,r),s=t.loadTexture((a=t.baseUrl,"string"!=typeof(o=i.url)||""===o?"":/^https?:\/\//i.test(o)?o:a+o));var a,o;s.repeat.copy(i.scale),s.offset.copy(i.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,r[e]=s}for(const e in n){const t=n[e];let a;if(""!==t)switch(e.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(t);break;case"ks":r.specular=(new i.Color).fromArray(t);break;case"ke":r.emissive=(new i.Color).fromArray(t);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":a=parseFloat(t),a<1&&(r.opacity=a,r.transparent=!0);break;case"tr":a=parseFloat(t),this.options&&this.options.invertTrProperty&&(a=1-a),a>0&&(r.opacity=1-a,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 a=void 0!==this.manager?this.manager:i.DefaultLoadingManager;let o=a.getHandler(e);null===o&&(o=new i.TextureLoader(a)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const l=o.load(e,n,r,s);return void 0!==t&&(l.mapping=t),l}}},637:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var i=n(212);class r extends i.Loader{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.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,a=(e>>10&31)/31):(r=l,s=c,a=u)}for(let l=1;l<=3;l++){const c=n+12*l,u=3*e*3+3*(l-1);f[u]=t.getFloat32(c,!0),f[u+1]=t.getFloat32(c+4,!0),f[u+2]=t.getFloat32(c+8,!0),m[u]=i,m[u+1]=h,m[u+2]=p,d&&(o[u]=r,o[u+1]=s,o[u+2]=a)}}return p.setAttribute("position",new i.BufferAttribute(f,3)),p.setAttribute("normal",new i.BufferAttribute(m,3)),d&&(p.setAttribute("color",new i.BufferAttribute(o,3)),p.hasColors=!0,p.alpha=h),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 a=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,o=new RegExp("vertex"+a+a+a,"g"),l=new RegExp("normal"+a+a+a,"g"),c=[],u=[],h=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));)h.x=parseFloat(d[1]),h.y=parseFloat(d[2]),h.z=parseFloat(d[3]),t++;for(;null!==(d=o.exec(n));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),u.push(h.x,h.y,h.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(u,3)),t}("string"!=typeof(r=e)?i.LoaderUtils.decodeText(new Uint8Array(r)):r);var r}}},678:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});var i=n(212);class r{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),a={},o={},l=e[0].morphTargetsRelative,c=new i.BufferGeometry;let u=0;for(let i=0;i[])))}const p=Math.log10(1/t),f=Math.pow(10,p);for(let t=0;t{"use strict";n.d(t,{eW:()=>E,oe:()=>x});var i=n(212);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 a=e[s];a?(i=a.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 a}),"DataTransport",/_DataTransport/,!0)+s.buildUglifiedNameAssignment((function(){return l}),"GeometryTransport",/_GeometryTransport/,!0)+s.buildUglifiedNameAssignment((function(){return c}),"MeshTransport",/_MeshTransport/,!0)+s.buildUglifiedNameAssignment((function(){return o}),"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 a="";return s!==t&&(a="const "+(i?t:s)+" = "+(i?s:t)+";\n"),a}}class a{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 o extends a{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 a{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"),a=this.main.geometry.getAttribute("skinWeight"),o=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(a,e),this._addBufferAttributeToTransferable(o,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 o}loadData(e){return super.loadData(e),this.main.type="MeshTransport",this.main.meshName=e.meshName,this.main.materialsTransport=(new o).loadData(e.materialsTransport.main),this}setParams(e){return super.setParams(e),this}setMaterialsTransport(e){return e instanceof o&&(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 u{static serializePrototype(e,t,n,i){let r,s=[],a="";i?(a=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")}a+=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 a=!this.supportsTaskType(e);if(a){let a=new m(e,this.maxParallelExecutions,r,this.verbose);a.setFunctions(t,n,i),a.setDependencyDescriptions(s),this.taskTypes.set(e,a)}return a}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 v extends Worker{constructor(e,t,n){super(t,n),this.id=e}getId(){return this.id}}class y{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 _(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 a=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),a.parser._onError(t)}),e||r("An invalid url was provided. Unable to continue!");const o=new URL(e,window.location.href).href;let l=o;const c=o.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)+"%";a.parser._onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(s);const u=new i.FileLoader(this.manager);u.setPath(this.path||this.resourcePath),u.setResponseType("arraybuffer"),u.load(l,(function(e){a.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}}_(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,a=0,o="",l=0;for(;l0&&(i[s++]=o),o="";break;case 47:o.length>0&&(i[s++]=o),a++,o="";break;case 10:this._processLine(i,s,a,o,l),o="",s=0,a=0;break;case 13:break;default:o+=String.fromCharCode(r)}this._processLine(i,s,a,o,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,a="",o=0;for(;o0&&(n[r++]=a),a="";break;case"/":a.length>0&&(n[r++]=a),s++,a="";break;case"\n":this._processLine(n,r,s,a,o),a="",r=0,s=0;break;case"\r":break;default:a+=i}this._processLine(n,r,a,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(a=t-1,0===n)for(this._checkFaceType(0),l=2,o=a;l0?s-1:s+r.vertices.length/3),o=r.colors.length>0?a:null;const l=i.vertices;if(l.push(r.vertices[a++]),l.push(r.vertices[a++]),l.push(r.vertices[a]),null!==o){const e=i.colors;e.push(r.colors[o++]),e.push(r.colors[o++]),e.push(r.colors[o])}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 a=i.indexMappings[r];null==a?(a=this.rawMesh.subGroupInUse.vertices.length/3,s(),i.indexMappings[r]=a,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(a)}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,a=0,o=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:a,absoluteNormalCount:o,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),a=e.absoluteIndexCount>0?new Uint32Array(e.absoluteIndexCount):null,o=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 u;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!=o&&n.setAttribute("color",new i.BufferAttribute(o,3,!1)),null!==a&&n.setIndex(new i.BufferAttribute(a,1,!1));let h=0,d=0,p=0,f=0,m=0,g=0,v=0;const y=t.length>1,_=[],x=null!==o;let b,w,M,E,T,S=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(u=t[e],T=u.materialName,b=0===u.smoothingGroup,this.rawMesh.faceType<4?(E=T,x&&(E+="_vertexColor"),b&&(E+="_flat")):E=6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",w=this.materials[T],M=this.materials[E],null==w&&null==M&&(E=x?"defaultVertexColorMaterial":"defaultMaterial",M=this.materials[E],this.logging.enabled&&console.info('object_group "'+u.objectName+"_"+u.groupName+'" was defined with unresolvable material "'+T+'"! Assigning "'+E+'".')),null==M){const e={materialNameOrg:T,materialProperties:{name:E,vertexColors:x?2:0,flatShading:b}};M=r.cloneMaterial(this.materials,e,this.logging.enabled&&this.logging.debug),A.cloneInstructions.push(e)}if(y&&(v=this.useIndices?u.indices.length:u.vertices.length/3,n.addGroup(g,v,S),M=this.materials[E],_[S]=M,A.multiMaterialNames[S]=M.name,g+=v,S++),s.set(u.vertices,h),h+=u.vertices.length,null!==a&&(a.set(u.indices,d),d+=u.indices.length),null!==o&&(o.set(u.colors,p),p+=u.colors.length),null!==l&&(l.set(u.normals,f),f+=u.normals.length),null!==c&&(c.set(u.uvs,m),m+=u.uvs.length),this.logging.enabled&&this.logging.debug){let e="";S>0&&(e="\n\t\tmaterialIndex: "+S);const t="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+u.groupName+"\n\t\tIndex: "+u.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+u.materialName+"\n\t\tsmoothingGroup: "+u.smoothingGroup+e+"\n\t\tobjectName: "+u.objectName+"\n\t\t#vertices: "+u.vertices.length/3+"\n\t\t#indices: "+u.indices.length+"\n\t\t#colors: "+u.colors.length/3+"\n\t\t#uvs: "+u.uvs.length/2+"\n\t\t#normals: "+u.normals.length/3;console.debug(t)}}let L;this.outputObjectCount++,null==n.getAttribute("normal")&&n.computeVertexNormals();const C=y?_:M;L=0===A.geometryType?new i.Mesh(n,C):1===A.geometryType?new i.LineSegments(n,C):new i.Points(n,C),L.name=e.name,this._onAssetAvailable(L,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:u.serializeClass(a)},{code:u.serializeClass(l)},{code:u.serializeClass(c)},{code:u.serializeClass(o)},{code:u.serializeClass(r)},{code:u.serializeClass(b)},{code:u.serializeClass(h)},{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 o).loadData(n);e.obj2={parser:new b,buffer:null,materials:i.getMaterials()},e.obj2.parser._onMeshAlter=(t,n)=>{const i=new o;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 a("execComplete",e.obj2.parser.objectId).postMessage(e)},e.obj2.parser.callbacks.onProgress=t=>{e.obj2.parser.logging.debug&&console.debug("WorkerRunner: progress: "+t)},h.applyProperties(e.obj2.parser,i.getParams(),!1);const s=i.getBuffer("modelData");null!=s&&(e.obj2.buffer=s),new a("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 a).loadData(n);h.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 a).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 a("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 a).loadData(e),t instanceof a&&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)}}_(M,"OBJLOADER2_PARALLEL_VERSION",x.OBJLOADER2_VERSION),_(M,"DEFAULT_JSM_WORKER_PATH","/src/loaders/tmOBJLoader2.js"),_(M,"DEFAULT_JSM_THREEJS_PATH","/node_modules/three/build/three.min.js");class E{static link(e,t){"function"==typeof t.setMaterials&&t.setMaterials(E.addMaterialsFromMtlLoader(e),!0)}static addMaterialsFromMtlLoader(e){let t={};return void 0!==e.preload&&e.preload instanceof Function&&(e.preload(),t=e.materials),t}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.d=(e,t)=>{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});var three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(678),wwobjloader2__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(973),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(225),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(864),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(637),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(886),THREE=__webpack_require__(212),msgpack=__webpack_require__(374),dat=__webpack_require__(376).ZP;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=three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_2__.O.mergeBufferGeometries(i,!0),t&&(s.material=n)):s=new THREE.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.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_3__.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_4__.j).parse(e.data.buffer);return t.uuid=e.uuid,t}return console.error("Unsupported mesh type:",e),null}return null}__webpack_require__(583);class ExtensibleObjectLoader extends THREE.ObjectLoader{delegate(e,t,n,i){let r={};if(void 0===n)return r;let s=[];for(let t of n){let n=e(t);null!==n?r[n.uuid]=n:s.push(t)}return Object.assign(r,t(s,i))}parseTextures(e,t){return this.delegate(handle_special_texture,super.parseTextures,e,t)}parseGeometries(e,t){return this.delegate(handle_special_geometry,super.parseGeometries,e,t)}parseObject(e,t,n){if("_meshfile_object"==e.type){let t,n,i=new THREE.LoadingManager,r=void 0===e.url?void 0:THREE.LoaderUtils.extractUrlBase(e.url);if(i.setURLModifier((t=>void 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_5__.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_3__.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_4__.j).parse(e.data.buffer,r),t.uuid=e.uuid,n=t.material}let s=new THREE.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.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(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.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.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.AnimationMixer,this.loader=new THREE.ObjectLoader,this.clock=new THREE.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.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.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=Object.values(this.loader.parseAnimations([n.clip]))[0],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){let n=[t,e];var i=new Uint8Array(6);for(let e=0;e<2;e++){let t=n[e];for(let n=0;n<1;n++){let r=3*(1*e+n);for(let e=0;e<3;e++)i[r+e]=t[e]}}var r=new THREE.DataTexture(i,1,2,THREE.RGBFormat);return r.magFilter=THREE.LinearFilter,r.encoding=THREE.LinearEncoding,r.matrixAutoUpdate=!1,r.matrix.set(.5,0,.25,0,.5,.25,0,0,1),r.needsUpdate=!0,r}class Viewer{constructor(e,t,n){this.dom_element=e,void 0===n?(this.renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=THREE.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.scene=create_default_scene(),this.gui_controllers={},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),requestAnimationFrame((()=>this.set_3d_pane_size())),(t||void 0===t)&&this.animate()}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.Matrix4;e.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],e.toArray());let t=new THREE.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.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.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.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.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new THREE.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var s=new THREE.GridHelper(20,40);s.rotateX(Math.PI/2),this.set_object(["Grid"],s);var a=new THREE.AxesHelper(.5);this.set_object(["Axes"],a)}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=window.innerHeight),"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(){return this.render(),this.renderer.domElement.toDataURL()}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_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){let handler={};name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value?(handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(eval(callback))):(handler[name]=eval(callback),this.gui_controllers[name]=this.gui.add(handler,name))}set_control_value(e,t){e in this.gui_controllers&&this.gui_controllers[e]instanceof dat.controllers.NumberController&&(this.gui_controllers[e].setValue(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])}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_control"==e.type)this.set_control(e.name,e.callback,e.value,e.min,e.max,e.step);else if("set_control_value"==e.type)this.set_control_value(e.name,e.value);else if("delete_control"==e.type)this.delete_control(e.name);else if("capture_image"==e.type){let e=this.capture_image();this.connection.send(JSON.stringify({type:"img",data:e}))}else"save_image"==e.type&&this.save_image();this.set_dirty()}handle_command_bytearray(e){let t=msgpack.decode(e);this.handle_command(t)}handle_command_message(e){this.num_messages_received++,this.handle_command_bytearray(new Uint8Array(e.data))}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(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MeshCat=e():t.MeshCat=e()}(self,(function(){return(()=>{var __webpack_modules__={583:(t,e,n)=>{var i;t=n.nmd(t),function(){if(void 0!==t.exports)var r=n(617),o=n(549),s=n(468);var a={function:!0,object:!0};function l(t){return t&&t.Object===Object?t:null}parseFloat,parseInt;var c=a[typeof e]&&e&&!e.nodeType?e:void 0,h=a.object&&t&&!t.nodeType?t: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(t){return String("0000000"+t).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(t,e,n){for(var i=atob(this.toDataURL(e,n).split(",")[1]),r=i.length,o=new Uint8Array(r),s=0;s=c.frameLimit||c.timeLimit&&t>=c.timeLimit)&&(G(),V());var e=new Date(null);e.setSeconds(t),c.motionBlurFrames>2?y.textContent="CCapture "+c.format+" | "+d+" frames ("+p+" inter) | "+e.toISOString().substr(11,8):y.textContent="CCapture "+c.format+" | "+d+" frames | "+e.toISOString().substr(11,8)}(),W("Frame: "+d+" "+p);for(var o=0;o=h[o].triggerTime&&(H(h[o].callback),h.splice(o,1));for(o=0;o=u[o].triggerTime&&(H(u[o].callback),u[o].triggerTime+=u[o].time);f.forEach((function(t){H(t,n-g)})),f=[]}function V(t){t||(t=function(t){return o(t,l.filename+l.extension,l.mimeType),!1}),l.save(t)}function W(t){e&&console.log(t)}return{start:function(){!function(){function t(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),z.push(this)),this._hookedTime+c.startTime}W("Capturer start"),i=window.Date.now(),n=i+c.startTime,s=window.performance.now(),r=s+c.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(t,e){var i={callback:t,time:e,triggerTime:n+e};return h.push(i),W("Timeout set to "+i.time),i},window.clearTimeout=function(t){for(var e=0;e2?(function(t){A.width===t.width&&A.height===t.height||(A.width=t.width,A.height=t.height,S=new Uint16Array(A.height*A.width*4),L.fillStyle="#0",L.fillRect(0,0,A.width,A.height))}(t),function(t){L.drawImage(t,0,0),T=L.getImageData(0,0,A.width,A.height);for(var e=0;e=.5*c.motionBlurFrames?function(){for(var t=T.data,e=0;e0&&this.frames.length/this.settings.framerate>=this.settings.autoSaveTime?this.save(function(t){this.filename=this.baseFilename+"-part-"+m(this.part),o(t,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+m(this.part),this.step()}.bind(this)):this.step()},x.prototype.save=function(t){this.videoWriter.complete().then(t)},x.prototype.dispose=function(t){this.frames=[]},w.prototype=Object.create(v.prototype),w.prototype.start=function(){this.encoder.start(this.settings)},w.prototype.add=function(t){this.encoder.add(t)},w.prototype.save=function(t){this.callback=t,this.encoder.end()},w.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},M.prototype=Object.create(v.prototype),M.prototype.add=function(t){this.stream||(this.stream=t.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(t){this.chunks.push(t.data)}.bind(this)),this.step()},M.prototype.save=function(t){this.mediaRecorder.onstop=function(e){var n=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],t(n)}.bind(this),this.mediaRecorder.stop()},E.prototype=Object.create(v.prototype),E.prototype.add=function(t){this.sizeSet||(this.encoder.setOption("width",t.width),this.encoder.setOption("height",t.height),this.sizeSet=!0),this.canvas.width=t.width,this.canvas.height=t.height,this.ctx.drawImage(t,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},E.prototype.save=function(t){this.callback=t,this.encoder.render()},(p||d||{}).CCapture=S,void 0===(i=function(){return S}.call(e,n,e,t))||(t.exports=i)}()},549:t=>{void 0!==t.exports&&(t.exports=function(t,e,n){var i,r,o,s=window,a="application/octet-stream",l=n||a,c=t,h=document,u=h.createElement("a"),d=function(t){return String(t)},p=s.Blob||s.MozBlob||s.WebKitBlob||d,f=s.MSBlobBuilder||s.WebKitBlobBuilder||s.BlobBuilder,m=e||"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(t){for(var e=t.split(/[:;,]/),n=e[1],i=("base64"==e[2]?atob:decodeURIComponent)(e.pop()),r=i.length,o=0,s=new Uint8Array(r);o{t.exports=function t(e,n,i){function r(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,(function(t){return r(e[s][1][t]||t)}),c,c.exports,t,e,n,i)}return n[s].exports}for(var o=void 0,s=0;s0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var n,i,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(n=this._events[t]).length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},{}],2:[function(t,e,n){var i=t("./TypedNeuQuant.js"),r=t("./LZWEncoder.js");function o(){this.page=-1,this.pages=[],this.newPage()}o.pageSize=4096,o.charMap={};for(var s=0;s<256;s++)o.charMap[s]=String.fromCharCode(s);function a(t,e){this.width=~~t,this.height=~~e,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 o}o.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(o.pageSize),this.cursor=0},o.prototype.getData=function(){for(var t="",e=0;e=o.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},o.prototype.writeUTFBytes=function(t){for(var e=t.length,n=0;n=0&&(this.dispose=t)},a.prototype.setRepeat=function(t){this.repeat=t},a.prototype.setTransparent=function(t){this.transparent=t},a.prototype.addFrame=function(t){this.image=t,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(t){t<1&&(t=1),this.sample=t},a.prototype.setDither=function(t){!0===t&&(t="FloydSteinberg"),this.dither=t},a.prototype.setGlobalPalette=function(t){this.globalPalette=t},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(t){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var n=0,i=0;i=0&&x+h=0&&w+c>16,(65280&t)>>8,255&t,e)},a.prototype.findClosestRGB=function(t,e,n,i){if(null===this.colorTab)return-1;if(this.neuQuant&&!i)return this.neuQuant.lookupRGB(t,e,n);for(var r=0,o=16777216,s=this.colorTab.length,a=0,l=0;a=0&&(e=7&this.dispose),e<<=2,this.out.writeByte(0|e|t),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 t=768-this.colorTab.length,e=0;e>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},e.exports=a},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(t,e,n){var i=5003,r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];e.exports=function(t,e,n,o){var s,a,l,c,h,u,d=Math.max(2,o),p=new Uint8Array(256),f=new Int32Array(i),m=new Int32Array(i),g=0,v=0,y=!1;function _(t,e){p[a++]=t,a>=254&&w(e)}function b(t){x(i),v=h+2,y=!0,S(h,t)}function x(t){for(var e=0;e0&&(t.writeByte(a),t.writeBytes(p,0,a),a=0)}function M(t){return(1<0?s|=t<=8;)_(255&s,e),s>>=8,g-=8;if((v>l||y)&&(y?(l=M(n_bits=c),y=!1):(++n_bits,l=12==n_bits?4096:M(n_bits))),t==u){for(;g>0;)_(255&s,e),s>>=8,g-=8;w(e)}}this.encode=function(n){n.writeByte(d),remaining=t*e,curPixel=0,function(t,e){var n,r,o,s,d,p;for(c=t,y=!1,n_bits=c,l=M(n_bits),u=1+(h=1<=0){d=5003-o,0===o&&(d=1);do{if((o-=d)<0&&(o+=5003),f[o]===n){s=m[o];continue t}}while(f[o]>=0)}S(s,e),s=r,v<4096?(m[o]=v++,f[o]=n):b(e)}else s=m[o];S(s,e),S(u,e)}(d+1,n),n.writeByte(0)}}},{}],4:[function(t,e,n){var i=256,r=1024,o=1<<18;e.exports=function(t,e){var n,s,a,l,c;function h(t,e,i,o,s){n[e][0]-=t*(n[e][0]-i)/r,n[e][1]-=t*(n[e][1]-o)/r,n[e][2]-=t*(n[e][2]-s)/r}function u(t,e,r,s,a){for(var l,h,u=Math.abs(e-t),d=Math.min(e+t,i),p=e+1,f=e-1,m=1;pu;)h=c[m++],pu&&((l=n[f--])[0]-=h*(l[0]-r)/o,l[1]-=h*(l[1]-s)/o,l[2]-=h*(l[2]-a)/o)}function d(t,e,r){var o,s,c,h,u,d=~(1<<31),p=d,f=-1,m=f;for(o=0;o>12))>10,l[o]-=u,a[o]+=u<<10;return l[f]+=64,a[f]-=65536,m}this.buildColormap=function(){(function(){var t,e;for(n=[],s=new Int32Array(256),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(32),t=0;t>6;for(_<=1&&(_=0),n=0;n<_;n++)c[n]=v*(256*(_*_-n*n)/(_*_));p<1509?(e=1,i=3):i=p%499!=0?1497:p%491!=0?1473:p%487!=0?1461:1509;var b=0;for(n=0;n=p&&(b-=p),0===g&&(g=1),++n%g==0)for(v-=v/f,(_=(y-=y/30)>>6)<=1&&(_=0),l=0;l<_;l++)c[l]=v*(256*(_*_-l*l)/(_*_))}(),function(){for(var t=0;t>=4,n[t][1]>>=4,n[t][2]>>=4,n[t][3]=t}(),function(){var t,e,r,o,a,l,c=0,h=0;for(t=0;t>1,e=c+1;e>1,e=c+1;e<256;e++)s[e]=255}()},this.getColormap=function(){for(var t=[],e=[],r=0;r=0;)u=c?u=i:(u++,l<0&&(l=-l),(o=a[0]-t)<0&&(o=-o),(l+=o)=0&&((l=e-(a=n[d])[1])>=c?d=-1:(d--,l<0&&(l=-l),(o=a[0]-t)<0&&(o=-o),(l+=o)e;0<=e?++t:--t)n.push(null);return n}.call(this),e=this.spawnWorkers(),!0===this.options.globalPalette)this.renderNextFrame();else for(t=0,n=e;0<=n?tn;0<=n?++t:--t)this.renderNextFrame();return this.emit("start"),this.emit("progress",0)},i.prototype.abort=function(){for(var t;null!=(t=this.activeWorkers.shift());)this.log("killing active worker"),t.terminate();return this.running=!1,this.emit("abort")},i.prototype.spawnWorkers=function(){var t,e,n,i;return t=Math.min(this.options.workers,this.frames.length),function(){n=[];for(var i=e=this.freeWorkers.length;e<=t?it;e<=t?i++:i--)n.push(i);return n}.apply(this).forEach((i=this,function(t){var e;return i.log("spawning worker "+t),(e=new Worker(i.options.workerScript)).onmessage=function(t){return i.activeWorkers.splice(i.activeWorkers.indexOf(e),1),i.freeWorkers.push(e),i.frameFinished(t.data)},i.freeWorkers.push(e)})),t},i.prototype.frameFinished=function(t){var e,n;if(this.log("frame "+t.index+" finished - "+this.activeWorkers.length+" active"),this.finishedFrames++,this.emit("progress",this.finishedFrames/this.frames.length),this.imageParts[t.index]=t,!0===this.options.globalPalette&&(this.options.globalPalette=t.globalPalette,this.log("global palette analyzed"),this.frames.length>2))for(e=1,n=this.freeWorkers.length;1<=n?en;1<=n?++e:--e)this.renderNextFrame();return s.call(this.imageParts,null)>=0?this.renderNextFrame():this.finishRendering()},i.prototype.finishRendering=function(){var t,e,n,i,r,o,s,a,l,c,h,u,d,p,f,m;for(a=0,r=0,l=(p=this.imageParts).length;r=this.frames.length))return t=this.frames[this.nextFrame++],n=this.freeWorkers.shift(),e=this.getTask(t),this.log("starting frame "+(e.index+1)+" of "+this.frames.length),this.activeWorkers.push(n),n.postMessage(e)},i.prototype.getContextData=function(t){return t.getImageData(0,0,this.options.width,this.options.height).data},i.prototype.getImageData=function(t){var e;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(e=this._canvas.getContext("2d")).setFill=this.options.background,e.fillRect(0,0,this.options.width,this.options.height),e.drawImage(t,0,0),this.getContextData(e)},i.prototype.getTask=function(t){var e,n;if(n={index:e=this.frames.indexOf(t),last:e===this.frames.length-1,delay:t.delay,dispose:t.dispose,transparent:t.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!=t.data)n.data=t.data;else if(null!=t.context)n.data=this.getContextData(t.context);else{if(null==t.image)throw new Error("Invalid frame");n.data=this.getImageData(t.image)}return n},i.prototype.log=function(){var t;if(t=1<=arguments.length?a.call(arguments,0):[],this.options.debug)return console.log.apply(console,t)},i}(i)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(t,e,n){var i,r;i=t("./GIFEncoder.js"),r=function(t){var e,n,r,o;return e=new i(t.width,t.height),0===t.index?e.writeHeader():e.firstFrame=!1,e.setTransparent(t.transparent),e.setDispose(t.dispose),e.setRepeat(t.repeat),e.setDelay(t.delay),e.setQuality(t.quality),e.setDither(t.dither),e.setGlobalPalette(t.globalPalette),e.addFrame(t.data),t.last&&e.finish(),!0===t.globalPalette&&(t.globalPalette=e.getGlobalPalette()),r=e.stream(),t.data=r.pages,t.cursor=r.cursor,t.pageSize=r.constructor.pageSize,t.canTransfer?(o=function(){var e,i,r,o;for(o=[],e=0,i=(r=t.data).length;e{!function(){"use strict";var t=["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 e(t){var e,n=new Uint8Array(t);for(e=0;e>18&63]+t[o>>12&63]+t[o>>6&63]+t[63&o];switch(a.length%4){case 1:a+="=";break;case 2:a+="=="}return a}}(),function(){"use strict";var t,e=window.utils;t=[{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=t,window.header.format=function(n,i){var r=e.clean(512),o=0;return t.forEach((function(t){var e,i,s=n[t.field]||"";for(e=0,i=s.length;ei&&(e.push({blocks:r,length:n}),r=[],n=0),r.push(t),n+=t.headerLength+t.inputLength})),e.push({blocks:r,length:n}),e.forEach((function(e){var n=new Uint8Array(e.length),i=0;e.blocks.forEach((function(t){n.set(t.header,i),i+=t.headerLength,n.set(t.input,i),i+=t.inputLength})),t.push(n)})),t.push(new Uint8Array(1024)),new Blob(t,{type:"octet/stream"})},o.prototype.clear=function(){this.written=0,this.out=i.clean(e)},void 0!==t.exports?t.exports=o:window.Tar=o}()},376:(t,e,n)=>{"use strict";function i(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),c=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+c+",a:"+s+"}":"unknown format"}n.d(e,{ZP:()=>ht});var r=Array.prototype.forEach,o=Array.prototype.slice,s={BREAK:{},extend:function(t){return this.each(o.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(o.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=o.call(arguments);return function(){for(var e=o.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(r&&t.forEach&&t.forEach===r)t.forEach(e,n);else if(t.length===t.length+0){var i,o=void 0;for(o=0,i=t.length;o1?s.toArray(arguments):arguments[0];return s.each(a,(function(e){if(e.litmus(t))return s.each(e.conversions,(function(e,n){if(l=e.read(t),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=e,s.BREAK})),s.BREAK})),c},u=void 0,d={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(u=8*e)|t&~(255<-1?e.length-e.indexOf(".")-1:0}var P=function(t){function e(t,n,i){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,s.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 v(e,t),m(e,[{key:"setValue",value:function(t){var n=t;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(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=R(t),this}}]),e}(w),O=function(t){function e(t,n,i){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,a=void 0;function l(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function c(t){var e=a-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),a=t.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 t=parseFloat(o.__input.value);s.isNaN(t)||o.setValue(t)})),T.bind(r.__input,"blur",(function(){l()})),T.bind(r.__input,"mousedown",(function(t){T.bind(window,"mousemove",c),T.bind(window,"mouseup",h),a=t.clientY})),T.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,l())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return v(e,t),m(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P);function N(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var B=function(t){function e(t,n,i,r,o){f(this,e);var s=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(N(t.clientX,e.left,e.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(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(e,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 s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),T.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(t)})),T.bind(s.__background,"touchstart",(function(t){1===t.touches.length&&(T.bind(window,"touchmove",h),T.bind(window,"touchend",u),h(t))})),T.addClass(s.__background,"slider"),T.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return v(e,t),m(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P),I=function(t){function e(t,n,i){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,T.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),T.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return v(e,t),m(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(w),D=function(t){function e(t,n){f(this,e);var i=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new _(i.getValue()),i.__temp=new _(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(t){13===t.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 o,a=document.createElement("div");function l(t){g(t),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",u),T.bind(window,"touchend",u)}function c(t){v(t),T.bind(window,"mousemove",v),T.bind(window,"touchmove",v),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",v),T.unbind(window,"touchmove",v),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var t=h(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function m(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function g(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function v(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return s.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),s.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}),s.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),s.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),s.extend(a.style,{width:"100%",height:"100%",background:"none"}),U(a,"top","rgba(0,0,0,0)","#000"),s.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.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 v(e,t),m(e,[{key:"updateDisplay",value:function(){var t=h(this.getValue());if(!1!==t){var e=!1;s.each(_.COMPONENTS,(function(n){if(!s.isUndefined(t[n])&&!s.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&s.extend(this.__color.__state,t)}s.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;s.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(),s.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(w),k=["-moz-","-o-","-webkit-","-ms-",""];function U(t,e,n,i){t.style.background="",s.each(k,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+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(t,e){var n=t[e];return s.isArray(arguments[2])||s.isObject(arguments[2])?new L(t,e,arguments[2]):s.isNumber(n)?s.isNumber(arguments[2])&&s.isNumber(arguments[3])?s.isNumber(arguments[4])?new B(t,e,arguments[2],arguments[3],arguments[4]):new B(t,e,arguments[2],arguments[3]):s.isNumber(arguments[4])?new O(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new O(t,e,{min:arguments[2],max:arguments[3]}):s.isString(n)?new C(t,e):s.isFunction(n)?new I(t,e,""):s.isBoolean(n)?new A(t,e):null},G=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},H=function(){function t(){f(this,t),this.backgroundElement=document.createElement("div"),s.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"),s.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 e=this;T.bind(this.backgroundElement,"click",(function(){e.hide()}))}return m(t,[{key:"show",value:function(){var t=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(),s.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",T.unbind(t.domElement,"webkitTransitionEnd",e),T.unbind(t.domElement,"transitionend",e),T.unbind(t.domElement,"oTransitionEnd",e)};T.bind(this.domElement,"webkitTransitionEnd",e),T.bind(this.domElement,"transitionend",e),T.bind(this.domElement,"oTransitionEnd",e),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"}}]),t}();!function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}}(function(t){if("undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".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 j="Default",V=function(){try{return!!window.localStorage}catch(t){return!1}}(),W=void 0,q=!0,X=void 0,Y=!1,J=[],Z=function t(e){var n=this,i=e||{};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=s.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=s.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),s.isUndefined(i.load)?i.load={preset:j}:i.preset&&(i.load.preset=i.preset),s.isUndefined(i.parent)&&i.hideable&&J.push(this),i.resizable=s.isUndefined(i.parent)&&i.resizable,i.autoPlace&&s.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=V&&"true"===localStorage.getItem(nt(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(t){n.parent?n.getRoot().preset=t:i.load.preset=t,function(t){for(var e=0;e1){var i=n.__li.nextElementSibling;return n.remove(),et(t,n.object,n.property,{before:i,factoryArgs:[s.toArray(arguments)]})}if(s.isArray(e)||s.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),et(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof B){var i=new O(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});s.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),T.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof O){var r=function(e){if(s.isNumber(n.__min)&&s.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=et(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=s.compose(r,n.min),n.max=s.compose(r,n.max)}else n instanceof A?(T.bind(e,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof I?(T.bind(e,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(e,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(e,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof D&&(T.addClass(e,"color"),n.updateDisplay=s.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=s.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&$(t.getRoot(),!0),e}),n.setValue)}(t,c,r),t.__controllers.push(r),r}function nt(t,e){return document.location.href+"."+e}function it(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function rt(t,e){e.style.display=t.useLocalStorage?"block":"none"}function ot(t){var e=t.__save_row=document.createElement("li");T.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),T.addClass(e,"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 o=document.createElement("span");o.innerHTML="Revert",T.addClass(o,"button"),T.addClass(o,"revert");var a=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?s.each(t.load.remembered,(function(e,n){it(t,n,n===t.preset)})):it(t,j,!1),T.bind(a,"change",(function(){for(var e=0;e0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=lt(this)),t.folders={},s.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=lt(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=lt(this,!0)),this.load.remembered[t]=lt(this),this.preset=t,it(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){s.each(this.__controllers,(function(e){this.getRoot().load.remembered?tt(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),s.each(this.__folders,(function(t){t.revert(t)})),t||$(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&ct(this.__listening)},updateDisplay:function(){s.each(this.__controllers,(function(t){t.updateDisplay()})),s.each(this.__folders,(function(t){t.updateDisplay()}))}});const ht={color:{Color:_,math:d,interpret:h},controllers:{Controller:w,BooleanController:A,OptionController:L,StringController:C,NumberController:P,NumberControllerBox:O,NumberControllerSlider:B,FunctionController:I,ColorController:D},dom:{dom:T},gui:{GUI:Z},GUI:Z}},258:t=>{!function(e){t.exports=e;var n={on:function(t,e){return o(this,t).push(e),this},once:function(t,e){var n=this;return i.originalListener=e,o(n,t).push(i),n;function i(){r.call(n,t,i),e.apply(this,arguments)}},off:r,emit:function(t,e){var n=this,i=o(n,t,!0);if(!i)return!1;var r=arguments.length;if(1===r)i.forEach(a);else if(2===r)i.forEach(l);else{var s=Array.prototype.slice.call(arguments,1);i.forEach(c)}return!!i.length;function a(t){t.call(n)}function l(t){t.call(n,e)}function c(t){t.apply(n,s)}}};function i(t){for(var e in n)t[e]=n[e];return t}function r(t,e){var n,i=this;if(arguments.length){if(e){if(n=o(i,t,!0)){if(!(n=n.filter(s)).length)return r.call(i,t);i.listeners[t]=n}}else if((n=i.listeners)&&(delete n[t],!Object.keys(n).length))return r.call(i)}else delete i.listeners;return i;function s(t){return t!==e&&t.originalListener!==e}}function o(t,e,n){if(!n||t.listeners){var i=t.listeners||(t.listeners={});return i[e]||(i[e]=[])}}i(e.prototype),e.mixin=i}((function t(){if(!(this instanceof t))return new t}))},645:(t,e)=>{e.read=function(t,e,n,i,r){var o,s,a=8*r-i-1,l=(1<>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+u],u+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+u],u+=d,h-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=c}return(p?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var s,a,l,c=8*o-r-1,h=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=h?(a=0,s=h):s+u>=1?(a=(e*l-1)*Math.pow(2,r),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;t[n+p]=255&a,p+=f,a/=256,r-=8);for(s=s<0;t[n+p]=255&s,p+=f,s/=256,c-=8);t[n+p-f]|=128*m}},166:function(t,e){!function(t){var e,n="undefined",i=n!==typeof Buffer&&Buffer,r=n!==typeof Uint8Array&&Uint8Array,o=n!==typeof ArrayBuffer&&ArrayBuffer,s=[0,0,0,0,0,0,0,0],a=Array.isArray||function(t){return!!t&&"[object Array]"==Object.prototype.toString.call(t)},l=4294967296;function c(a,c,b){var x=c?0:4,w=c?4:0,M=c?0:3,E=c?1:2,S=c?2:1,T=c?3:0,A=c?g:y,L=c?v:_,C=O.prototype,R="is"+a,P="_"+R;return C.buffer=void 0,C.offset=0,C[P]=!0,C.toNumber=N,C.toString=function(t){var e=this.buffer,n=this.offset,i=I(e,n+x),r=I(e,n+w),o="",s=!b&&2147483648&i;for(s&&(i=~i,r=l-r),t=t||10;;){var a=i%t*l+r;if(i=Math.floor(i/t),r=Math.floor(a/t),o=(a%t).toString(t)+o,!i&&!r)break}return s&&(o="-"+o),o},C.toJSON=N,C.toArray=h,i&&(C.toBuffer=u),r&&(C.toArrayBuffer=d),O[R]=function(t){return!(!t||!t[P])},t[a]=O,O;function O(t,i,a,c){return this instanceof O?function(t,i,a,c,h){r&&o&&(i instanceof o&&(i=new r(i)),c instanceof o&&(c=new r(c))),i||a||c||e?(p(i,a)||(h=a,c=i,a=0,i=new(e||Array)(8)),t.buffer=i,t.offset=a|=0,n!==typeof c&&("string"==typeof c?function(t,e,n,i){var r=0,o=n.length,s=0,a=0;"-"===n[0]&&r++;for(var c=r;r=0))break;a=a*i+h,s=s*i+Math.floor(a/l),a%=l}c&&(s=~s,a?a=l-a:s++),B(t,e+x,s),B(t,e+w,a)}(i,a,c,h||10):p(c,h)?f(i,a,c,h):"number"==typeof h?(B(i,a+x,c),B(i,a+w,h)):c>0?A(i,a,c):c<0?L(i,a,c):f(i,a,s,0))):t.buffer=m(s,0)}(this,t,i,a,c):new O(t,i,a,c)}function N(){var t=this.buffer,e=this.offset,n=I(t,e+x),i=I(t,e+w);return b||(n|=0),n?n*l+i:i}function B(t,e,n){t[e+T]=255&n,n>>=8,t[e+S]=255&n,n>>=8,t[e+E]=255&n,n>>=8,t[e+M]=255&n}function I(t,e){return 16777216*t[e+M]+(t[e+E]<<16)+(t[e+S]<<8)+t[e+T]}}function h(t){var n=this.buffer,i=this.offset;return e=null,!1!==t&&0===i&&8===n.length&&a(n)?n:m(n,i)}function u(t){var n=this.buffer,r=this.offset;if(e=i,!1!==t&&0===r&&8===n.length&&Buffer.isBuffer(n))return n;var o=new i(8);return f(o,0,n,r),o}function d(t){var n=this.buffer,i=this.offset,s=n.buffer;if(e=r,!1!==t&&0===i&&s instanceof o&&8===s.byteLength)return s;var a=new r(8);return f(a,0,n,i),a.buffer}function p(t,e){var n=t&&t.length;return e|=0,n&&e+8<=n&&"string"!=typeof t[e]}function f(t,e,n,i){e|=0,i|=0;for(var r=0;r<8;r++)t[e++]=255&n[i++]}function m(t,e){return Array.prototype.slice.call(t,e,e+8)}function g(t,e,n){for(var i=e+8;i>e;)t[--i]=255&n,n/=256}function v(t,e,n){var i=e+8;for(n++;i>e;)t[--i]=255&-n^255,n/=256}function y(t,e,n){for(var i=e+8;e{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},374:(t,e,n)=>{e.encode=n(764).encode,e.decode=n(299).decode,e.Encoder=n(883).Encoder,e.Decoder=n(441).Decoder,e.createCodec=n(832).createCodec,e.codec=n(766).codec},679:function(t){function e(t){return t&&t.isBuffer&&t}t.exports=e("undefined"!=typeof Buffer&&Buffer)||e(this.Buffer)||e("undefined"!=typeof window&&window.Buffer)||this.Buffer},947:(t,e)=>{e.copy=function(t,e,n,i){var r;n||(n=0),i||0===i||(i=this.length),e||(e=0);var o=i-n;if(t===this&&n=0;r--)t[r+e]=this[r+n];else for(r=0;r=65536?(s-=65536,o+=String.fromCharCode(55296+(s>>>10),56320+(1023&s))):o+=String.fromCharCode(s));return o},e.write=function(t,e){for(var n=this,i=e||(e|=0),r=t.length,o=0,s=0;s>>6,n[i++]=128|63&o):o<55296||o>57343?(n[i++]=224|o>>>12,n[i++]=128|o>>>6&63,n[i++]=128|63&o):(o=65536+(o-55296<<10|t.charCodeAt(s++)-56320),n[i++]=240|o>>>18,n[i++]=128|o>>>12&63,n[i++]=128|o>>>6&63,n[i++]=128|63&o);return i-e}},683:(t,e,n)=>{var i=n(895),r=t.exports=o(0);function o(t){return new Array(t)}r.alloc=o,r.concat=i.concat,r.from=function(t){if(!i.isBuffer(t)&&i.isView(t))t=i.Uint8Array.from(t);else if(i.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return i.from.call(r,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(t)}},580:(t,e,n)=>{var i=n(895),r=i.global,o=t.exports=i.hasBuffer?s(0):[];function s(t){return new r(t)}o.alloc=i.hasBuffer&&r.alloc||s,o.concat=i.concat,o.from=function(t){if(!i.isBuffer(t)&&i.isView(t))t=i.Uint8Array.from(t);else if(i.isArrayBuffer(t))t=new Uint8Array(t);else{if("string"==typeof t)return i.from.call(o,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return r.from&&1!==r.from.length?r.from(t):new r(t)}},190:(t,e,n)=>{var i=n(947);e.copy=l,e.slice=c,e.toString=function(t,e,n){var o=!s&&r.isBuffer(this)?this.toString:i.toString;return o.apply(this,arguments)},e.write=("write",function(){return(this.write||i.write).apply(this,arguments)});var r=n(895),o=r.global,s=r.hasBuffer&&"TYPED_ARRAY_SUPPORT"in o,a=s&&!o.TYPED_ARRAY_SUPPORT;function l(t,e,n,o){var s=r.isBuffer(this),l=r.isBuffer(t);if(s&&l)return this.copy(t,e,n,o);if(a||s||l||!r.isView(this)||!r.isView(t))return i.copy.call(this,t,e,n,o);var h=n||null!=o?c.call(this,n,o):this;return t.set(h,e),h.length}function c(t,e){var n=this.slice||!a&&this.subarray;if(n)return n.call(this,t,e);var i=r.alloc.call(this,e-t);return l.call(this,i,0,t,e),i}},37:(t,e,n)=>{var i=n(895),r=t.exports=i.hasArrayBuffer?o(0):[];function o(t){return new Uint8Array(t)}r.alloc=o,r.concat=i.concat,r.from=function(t){if(i.isView(t)){var e=t.byteOffset,n=t.byteLength;(t=t.buffer).byteLength!==n&&(t.slice?t=t.slice(e,e+n):(t=new Uint8Array(t)).byteLength!==n&&(t=Array.prototype.slice.call(t,e,e+n)))}else{if("string"==typeof t)return i.from.call(r,t);if("number"==typeof t)throw new TypeError('"value" argument must not be a number')}return new Uint8Array(t)}},895:(t,e,n)=>{var i=e.global=n(679),r=e.hasBuffer=i&&!!i.isBuffer,o=e.hasArrayBuffer="undefined"!=typeof ArrayBuffer,s=e.isArray=n(826);e.isArrayBuffer=o?function(t){return t instanceof ArrayBuffer||f(t)}:v;var a=e.isBuffer=r?i.isBuffer:v,l=e.isView=o?ArrayBuffer.isView||y("ArrayBuffer","buffer"):v;e.alloc=p,e.concat=function(t,n){n||(n=0,Array.prototype.forEach.call(t,(function(t){n+=t.length})));var i=this!==e&&this||t[0],r=p.call(i,n),o=0;return Array.prototype.forEach.call(t,(function(t){o+=d.copy.call(t,r,o)})),r},e.from=function(t){return"string"==typeof t?m.call(this,t):g(this).from(t)};var c=e.Array=n(683),h=e.Buffer=n(580),u=e.Uint8Array=n(37),d=e.prototype=n(190);function p(t){return g(this).alloc(t)}var f=y("ArrayBuffer");function m(t){var e=3*t.length,n=p.call(this,e),i=d.write.call(n,t);return e!==i&&(n=d.slice.call(n,0,i)),n}function g(t){return a(t)?h:l(t)?u:s(t)?c:r?h:o?u:c}function v(){return!1}function y(t,e){return t="[object "+t+"]",function(n){return null!=n&&{}.toString.call(e?n[e]:n)===t}}},877:(t,e,n)=>{var i=n(826);e.createCodec=a,e.install=function(t){for(var e in t)o.prototype[e]=s(o.prototype[e],t[e])},e.filter=function(t){return i(t)?function(t){return t=t.slice(),function(n){return t.reduce(e,n)};function e(t,e){return e(t)}}(t):t};var r=n(895);function o(t){if(!(this instanceof o))return new o(t);this.options=t,this.init()}function s(t,e){return t&&e?function(){return t.apply(this,arguments),e.apply(this,arguments)}:t||e}function a(t){return new o(t)}o.prototype.init=function(){var t=this.options;return t&&t.uint8array&&(this.bufferish=r.Uint8Array),this},e.preset=a({preset:!0})},766:(t,e,n)=>{n(350),n(312),e.codec={preset:n(877).preset}},170:(t,e,n)=>{e.T=r;var i=n(350).preset;function r(t){if(!(this instanceof r))return new r(t);if(t&&(this.options=t,t.codec)){var e=this.codec=t.codec;e.bufferish&&(this.bufferish=e.bufferish)}}n(822).k.mixin(r.prototype),r.prototype.codec=i,r.prototype.fetch=function(){return this.codec.decode(this)}},299:(t,e,n)=>{e.decode=function(t,e){var n=new i(e);return n.write(t),n.read()};var i=n(170).T},441:(t,e,n)=>{e.Decoder=o;var i=n(258),r=n(170).T;function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}o.prototype=new r,i.mixin(o.prototype),o.prototype.decode=function(t){arguments.length&&this.write(t),this.flush()},o.prototype.push=function(t){this.emit("data",t)},o.prototype.end=function(t){this.decode(t),this.emit("end")}},517:(t,e,n)=>{e.F=r;var i=n(312).preset;function r(t){if(!(this instanceof r))return new r(t);if(t&&(this.options=t,t.codec)){var e=this.codec=t.codec;e.bufferish&&(this.bufferish=e.bufferish)}}n(822).I.mixin(r.prototype),r.prototype.codec=i,r.prototype.write=function(t){this.codec.encode(this,t)}},764:(t,e,n)=>{e.encode=function(t,e){var n=new i(e);return n.write(t),n.read()};var i=n(517).F},883:(t,e,n)=>{e.Encoder=o;var i=n(258),r=n(517).F;function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}o.prototype=new r,i.mixin(o.prototype),o.prototype.encode=function(t){this.write(t),this.emit("data",this.read())},o.prototype.end=function(t){arguments.length&&this.encode(t),this.flush(),this.emit("end")}},83:(t,e,n)=>{e.S=function t(e,n){if(!(this instanceof t))return new t(e,n);this.buffer=i.from(e),this.type=n};var i=n(895)},431:(t,e,n)=>{e.setExtPackers=function(t){t.addExtPacker(14,Error,[u,l]),t.addExtPacker(1,EvalError,[u,l]),t.addExtPacker(2,RangeError,[u,l]),t.addExtPacker(3,ReferenceError,[u,l]),t.addExtPacker(4,SyntaxError,[u,l]),t.addExtPacker(5,TypeError,[u,l]),t.addExtPacker(6,URIError,[u,l]),t.addExtPacker(10,RegExp,[h,l]),t.addExtPacker(11,Boolean,[c,l]),t.addExtPacker(12,String,[c,l]),t.addExtPacker(13,Date,[Number,l]),t.addExtPacker(15,Number,[c,l]),"undefined"!=typeof Uint8Array&&(t.addExtPacker(17,Int8Array,s),t.addExtPacker(18,Uint8Array,s),t.addExtPacker(19,Int16Array,s),t.addExtPacker(20,Uint16Array,s),t.addExtPacker(21,Int32Array,s),t.addExtPacker(22,Uint32Array,s),t.addExtPacker(23,Float32Array,s),"undefined"!=typeof Float64Array&&t.addExtPacker(24,Float64Array,s),"undefined"!=typeof Uint8ClampedArray&&t.addExtPacker(25,Uint8ClampedArray,s),t.addExtPacker(26,ArrayBuffer,s),t.addExtPacker(29,DataView,s)),r.hasBuffer&&t.addExtPacker(27,o,r.from)};var i,r=n(895),o=r.global,s=r.Uint8Array.from,a={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1};function l(t){return i||(i=n(764).encode),i(t)}function c(t){return t.valueOf()}function h(t){(t=RegExp.prototype.toString.call(t).split("/")).shift();var e=[t.pop()];return e.unshift(t.join("/")),e}function u(t){var e={};for(var n in a)e[n]=t[n];return e}},600:(t,e,n)=>{e.setExtUnpackers=function(t){t.addExtUnpacker(14,[a,c(Error)]),t.addExtUnpacker(1,[a,c(EvalError)]),t.addExtUnpacker(2,[a,c(RangeError)]),t.addExtUnpacker(3,[a,c(ReferenceError)]),t.addExtUnpacker(4,[a,c(SyntaxError)]),t.addExtUnpacker(5,[a,c(TypeError)]),t.addExtUnpacker(6,[a,c(URIError)]),t.addExtUnpacker(10,[a,l]),t.addExtUnpacker(11,[a,h(Boolean)]),t.addExtUnpacker(12,[a,h(String)]),t.addExtUnpacker(13,[a,h(Date)]),t.addExtUnpacker(15,[a,h(Number)]),"undefined"!=typeof Uint8Array&&(t.addExtUnpacker(17,h(Int8Array)),t.addExtUnpacker(18,h(Uint8Array)),t.addExtUnpacker(19,[u,h(Int16Array)]),t.addExtUnpacker(20,[u,h(Uint16Array)]),t.addExtUnpacker(21,[u,h(Int32Array)]),t.addExtUnpacker(22,[u,h(Uint32Array)]),t.addExtUnpacker(23,[u,h(Float32Array)]),"undefined"!=typeof Float64Array&&t.addExtUnpacker(24,[u,h(Float64Array)]),"undefined"!=typeof Uint8ClampedArray&&t.addExtUnpacker(25,h(Uint8ClampedArray)),t.addExtUnpacker(26,u),t.addExtUnpacker(29,[u,h(DataView)])),r.hasBuffer&&t.addExtUnpacker(27,h(o))};var i,r=n(895),o=r.global,s={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1};function a(t){return i||(i=n(299).decode),i(t)}function l(t){return RegExp.apply(null,t)}function c(t){return function(e){var n=new t;for(var i in s)n[i]=e[i];return n}}function h(t){return function(e){return new t(e)}}function u(t){return new Uint8Array(t).buffer}},832:(t,e,n)=>{n(350),n(312),e.createCodec=n(877).createCodec},822:(t,e,n)=>{e.k=o,e.I=s;var i=n(895),r="BUFFER_SHORTAGE";function o(){if(!(this instanceof o))return new o}function s(){if(!(this instanceof s))return new s}function a(){return this.buffers&&this.buffers.length?(this.flush(),this.pull()):this.fetch()}function l(t){(this.buffers||(this.buffers=[])).push(t)}function c(t){return function(e){for(var n in t)e[n]=t[n];return e}}o.mixin=c({bufferish:i,write:function(t){var e=this.offset?i.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=e?t?this.bufferish.concat([e,t]):e:t,this.offset=0},fetch:function(){throw new Error("method not implemented: fetch()")},flush:function(){for(;this.offsetthis.buffer.length)throw new Error(r);return this.offset=n,e},offset:0}),o.mixin(o.prototype),s.mixin=c({bufferish:i,write:function(){throw new Error("method not implemented: write()")},fetch:function(){var t=this.start;if(t1?this.bufferish.concat(t):t[0];return t.length=0,e},read:a,reserve:function(t){var e=0|t;if(this.buffer){var n=this.buffer.length,i=0|this.offset,r=i+e;if(rthis.minBufferSize)this.flush(),this.push(t);else{var n=this.reserve(e);i.prototype.copy.call(t,this.buffer,n)}},maxBufferSize:65536,minBufferSize:2048,offset:0,start:0}),s.mixin(s.prototype)},350:(t,e,n)=>{var i=n(83).S,r=n(600),o=n(76).readUint8,s=n(738),a=n(877);function l(){var t=this.options;return this.decode=function(t){var e=s.getReadToken(t);return function(t){var n=o(t),i=e[n];if(!i)throw new Error("Invalid type: "+(n?"0x"+n.toString(16):n));return i(t)}}(t),t&&t.preset&&r.setExtUnpackers(this),this}a.install({addExtUnpacker:function(t,e){(this.extUnpackers||(this.extUnpackers=[]))[t]=a.filter(e)},getExtUnpacker:function(t){return(this.extUnpackers||(this.extUnpackers=[]))[t]||function(e){return new i(e,t)}},init:l}),e.preset=l.call(a.preset)},76:(t,e,n)=>{var i=n(645),r=n(166),o=r.Uint64BE,s=r.Int64BE;e.getReadFormat=function(t){var e=a.hasArrayBuffer&&t&&t.binarraybuffer,n=t&&t.int64;return{map:c&&t&&t.usemap?u:h,array:d,str:p,bin:e?m:f,ext:g,uint8:v,uint16:_,uint32:x,uint64:M(8,n?T:E),int8:y,int16:b,int32:w,int64:M(8,n?A:S),float32:M(4,L),float64:M(8,C)}},e.readUint8=v;var a=n(895),l=n(190),c="undefined"!=typeof Map;function h(t,e){var n,i={},r=new Array(e),o=new Array(e),s=t.codec.decode;for(n=0;n{var i=n(76);function r(t){var e,n=new Array(256);for(e=0;e<=127;e++)n[e]=o(e);for(e=128;e<=143;e++)n[e]=a(e-128,t.map);for(e=144;e<=159;e++)n[e]=a(e-144,t.array);for(e=160;e<=191;e++)n[e]=a(e-160,t.str);for(n[192]=o(null),n[193]=null,n[194]=o(!1),n[195]=o(!0),n[196]=s(t.uint8,t.bin),n[197]=s(t.uint16,t.bin),n[198]=s(t.uint32,t.bin),n[199]=s(t.uint8,t.ext),n[200]=s(t.uint16,t.ext),n[201]=s(t.uint32,t.ext),n[202]=t.float32,n[203]=t.float64,n[204]=t.uint8,n[205]=t.uint16,n[206]=t.uint32,n[207]=t.uint64,n[208]=t.int8,n[209]=t.int16,n[210]=t.int32,n[211]=t.int64,n[212]=a(1,t.ext),n[213]=a(2,t.ext),n[214]=a(4,t.ext),n[215]=a(8,t.ext),n[216]=a(16,t.ext),n[217]=s(t.uint8,t.str),n[218]=s(t.uint16,t.str),n[219]=s(t.uint32,t.str),n[220]=s(t.uint16,t.array),n[221]=s(t.uint32,t.array),n[222]=s(t.uint16,t.map),n[223]=s(t.uint32,t.map),e=224;e<=255;e++)n[e]=o(e-256);return n}function o(t){return function(){return t}}function s(t,e){return function(n){var i=t(n);return e(n,i)}}function a(t,e){return function(n){return e(n,t)}}e.getReadToken=function(t){var e=i.getReadFormat(t);return t&&t.useraw?function(t){var e,n=r(t).slice();for(n[217]=n[196],n[218]=n[197],n[219]=n[198],e=160;e<=191;e++)n[e]=a(e-160,t.bin);return n}(e):r(e)}},312:(t,e,n)=>{var i=n(83).S,r=n(431),o=n(943),s=n(877);function a(){var t=this.options;return this.encode=function(t){var e=o.getWriteType(t);return function(t,n){var i=e[typeof n];if(!i)throw new Error('Unsupported type "'+typeof n+'": '+n);i(t,n)}}(t),t&&t.preset&&r.setExtPackers(this),this}s.install({addExtPacker:function(t,e,n){n=s.filter(n);var r=e.name;function o(e){return n&&(e=n(e)),new i(e,t)}r&&"Object"!==r?(this.extPackers||(this.extPackers={}))[r]=o:(this.extEncoderList||(this.extEncoderList=[])).unshift([e,o])},getExtPacker:function(t){var e=this.extPackers||(this.extPackers={}),n=t.constructor,i=n&&n.name&&e[n.name];if(i)return i;for(var r=this.extEncoderList||(this.extEncoderList=[]),o=r.length,s=0;s{var i=n(645),r=n(166),o=r.Uint64BE,s=r.Int64BE,a=n(370).w,l=n(895),c=l.global,h=l.hasBuffer&&"TYPED_ARRAY_SUPPORT"in c&&!c.TYPED_ARRAY_SUPPORT,u=l.hasBuffer&&c.prototype||{};function d(){var t=a.slice();return t[196]=p(196),t[197]=f(197),t[198]=m(198),t[199]=p(199),t[200]=f(200),t[201]=m(201),t[202]=g(202,4,u.writeFloatBE||_,!0),t[203]=g(203,8,u.writeDoubleBE||b,!0),t[204]=p(204),t[205]=f(205),t[206]=m(206),t[207]=g(207,8,v),t[208]=p(208),t[209]=f(209),t[210]=m(210),t[211]=g(211,8,y),t[217]=p(217),t[218]=f(218),t[219]=m(219),t[220]=f(220),t[221]=m(221),t[222]=f(222),t[223]=m(223),t}function p(t){return function(e,n){var i=e.reserve(2),r=e.buffer;r[i++]=t,r[i]=n}}function f(t){return function(e,n){var i=e.reserve(3),r=e.buffer;r[i++]=t,r[i++]=n>>>8,r[i]=n}}function m(t){return function(e,n){var i=e.reserve(5),r=e.buffer;r[i++]=t,r[i++]=n>>>24,r[i++]=n>>>16,r[i++]=n>>>8,r[i]=n}}function g(t,e,n,i){return function(r,o){var s=r.reserve(e+1);r.buffer[s++]=t,n.call(r.buffer,o,s,i)}}function v(t,e){new o(this,e,t)}function y(t,e){new s(this,e,t)}function _(t,e){i.write(this,t,e,!1,23,4)}function b(t,e){i.write(this,t,e,!1,52,8)}e.getWriteToken=function(t){return t&&t.uint8array?((e=d())[202]=g(202,4,_),e[203]=g(203,8,b),e):h||l.hasBuffer&&t&&t.safe?function(){var t=a.slice();return t[196]=g(196,1,c.prototype.writeUInt8),t[197]=g(197,2,c.prototype.writeUInt16BE),t[198]=g(198,4,c.prototype.writeUInt32BE),t[199]=g(199,1,c.prototype.writeUInt8),t[200]=g(200,2,c.prototype.writeUInt16BE),t[201]=g(201,4,c.prototype.writeUInt32BE),t[202]=g(202,4,c.prototype.writeFloatBE),t[203]=g(203,8,c.prototype.writeDoubleBE),t[204]=g(204,1,c.prototype.writeUInt8),t[205]=g(205,2,c.prototype.writeUInt16BE),t[206]=g(206,4,c.prototype.writeUInt32BE),t[207]=g(207,8,v),t[208]=g(208,1,c.prototype.writeInt8),t[209]=g(209,2,c.prototype.writeInt16BE),t[210]=g(210,4,c.prototype.writeInt32BE),t[211]=g(211,8,y),t[217]=g(217,1,c.prototype.writeUInt8),t[218]=g(218,2,c.prototype.writeUInt16BE),t[219]=g(219,4,c.prototype.writeUInt32BE),t[220]=g(220,2,c.prototype.writeUInt16BE),t[221]=g(221,4,c.prototype.writeUInt32BE),t[222]=g(222,2,c.prototype.writeUInt16BE),t[223]=g(223,4,c.prototype.writeUInt32BE),t}():d();var e}},943:(t,e,n)=>{var i=n(826),r=n(166),o=r.Uint64BE,s=r.Int64BE,a=n(895),l=n(190),c=n(598),h=n(370).w,u=n(83).S,d="undefined"!=typeof Uint8Array,p="undefined"!=typeof Map,f=[];f[1]=212,f[2]=213,f[4]=214,f[8]=215,f[16]=216,e.getWriteType=function(t){var e,n=c.getWriteToken(t),r=t&&t.useraw,m=d&&t&&t.binarraybuffer,g=m?a.isArrayBuffer:a.isBuffer,v=m?function(t,e){x(t,new Uint8Array(e))}:x,y=p&&t&&t.usemap?function(t,e){if(!(e instanceof Map))return w(t,e);var i=e.size;n[i<16?128+i:i<=65535?222:223](t,i);var r=t.codec.encode;e.forEach((function(e,n,i){r(t,n),r(t,e)}))}:w;return{boolean:function(t,e){n[e?195:194](t,e)},function:b,number:function(t,e){var i=0|e;e===i?n[-32<=i&&i<=127?255&i:0<=i?i<=255?204:i<=65535?205:206:-128<=i?208:-32768<=i?209:210](t,i):n[203](t,e)},object:r?function(t,e){if(g(e))return function(t,e){var i=e.length;n[i<32?160+i:i<=65535?218:219](t,i),t.send(e)}(t,e);_(t,e)}:_,string:(e=r?function(t){return t<32?1:t<=65535?3:5}:function(t){return t<32?1:t<=255?2:t<=65535?3:5},function(t,i){var r=i.length,o=5+3*r;t.offset=t.reserve(o);var s=t.buffer,a=e(r),c=t.offset+a;r=l.write.call(s,i,c);var h=e(r);if(a!==h){var u=c+h-a,d=c+r;l.copy.call(s,s,u,c,d)}n[1===h?160+r:h<=3?215+h:219](t,r),t.offset+=r}),symbol:b,undefined:b};function _(t,e){if(null===e)return b(t,e);if(g(e))return v(t,e);if(i(e))return function(t,e){var i=e.length;n[i<16?144+i:i<=65535?220:221](t,i);for(var r=t.codec.encode,o=0;o{for(var n=e.w=new Array(256),i=0;i<=255;i++)n[i]=r(i);function r(t){return function(e){var n=e.reserve(1);e.buffer[n]=t}}},212:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ACESFilmicToneMapping:()=>nt,AddEquation:()=>S,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>qe,AdditiveBlending:()=>x,AlphaFormat:()=>Dt,AlwaysDepth:()=>H,AlwaysStencilFunc:()=>En,AmbientLight:()=>Eu,AmbientLightProbe:()=>Xu,AnimationClip:()=>Ph,AnimationLoader:()=>Fh,AnimationMixer:()=>Ed,AnimationObjectGroup:()=>wd,AnimationUtils:()=>yh,ArcCurve:()=>Xh,ArrayCamera:()=>Aa,ArrowHelper:()=>fp,Audio:()=>id,AudioAnalyser:()=>cd,AudioContext:()=>Vu,AudioListener:()=>nd,AudioLoader:()=>Wu,AxesHelper:()=>mp,AxisHelper:()=>hf,BackSide:()=>m,BasicDepthPacking:()=>on,BasicShadowMap:()=>h,BinaryTextureLoader:()=>mf,Bone:()=>cl,BooleanKeyframeTrack:()=>Eh,BoundingBoxHelper:()=>uf,Box2:()=>Bd,Box3:()=>$n,Box3Helper:()=>cp,BoxBufferGeometry:()=>ho,BoxGeometry:()=>Hl,BoxHelper:()=>lp,BufferAttribute:()=>Er,BufferGeometry:()=>jr,BufferGeometryLoader:()=>Ou,ByteType:()=>St,Cache:()=>Nh,Camera:()=>go,CameraHelper:()=>op,CanvasRenderer:()=>yf,CanvasTexture:()=>Il,CatmullRomCurve3:()=>$h,CineonToneMapping:()=>et,CircleBufferGeometry:()=>jl,CircleGeometry:()=>Vl,ClampToEdgeWrapping:()=>dt,Clock:()=>Ku,ClosedSplineCurve3:()=>af,Color:()=>vr,ColorKeyframeTrack:()=>Sh,CompressedTexture:()=>Bl,CompressedTextureLoader:()=>zh,ConeBufferGeometry:()=>Yl,ConeGeometry:()=>Xl,CubeCamera:()=>_o,CubeGeometry:()=>Hl,CubeReflectionMapping:()=>ot,CubeRefractionMapping:()=>st,CubeTexture:()=>bo,CubeTextureLoader:()=>Hh,CubeUVReflectionMapping:()=>ct,CubeUVRefractionMapping:()=>ht,CubicBezierCurve:()=>iu,CubicBezierCurve3:()=>ru,CubicInterpolant:()=>bh,CullFaceBack:()=>a,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>s,Curve:()=>Wh,CurvePath:()=>uu,CustomBlending:()=>E,CustomToneMapping:()=>it,CylinderBufferGeometry:()=>Wl,CylinderGeometry:()=>ql,Cylindrical:()=>Od,DataTexture:()=>wo,DataTexture2DArray:()=>qo,DataTexture3D:()=>Xo,DataTextureLoader:()=>jh,DecrementStencilOp:()=>pn,DecrementWrapStencilOp:()=>mn,DefaultLoadingManager:()=>Ih,DepthFormat:()=>Ht,DepthStencilFormat:()=>jt,DepthTexture:()=>Dl,DirectionalLight:()=>Mu,DirectionalLightHelper:()=>np,DiscreteInterpolant:()=>wh,DodecahedronBufferGeometry:()=>Zl,DodecahedronGeometry:()=>Kl,DoubleSide:()=>g,DstAlphaFactor:()=>D,DstColorFactor:()=>U,DynamicBufferAttribute:()=>Zp,DynamicCopyUsage:()=>On,DynamicDrawUsage:()=>Tn,DynamicReadUsage:()=>Cn,EdgesGeometry:()=>nc,EdgesHelper:()=>df,EllipseCurve:()=>qh,EqualDepth:()=>W,EqualStencilFunc:()=>_n,EquirectangularReflectionMapping:()=>at,EquirectangularRefractionMapping:()=>lt,Euler:()=>Oi,EventDispatcher:()=>Dn,ExtrudeBufferGeometry:()=>Rc,ExtrudeGeometry:()=>Oc,Face3:()=>yr,Face4:()=>Ip,FaceColors:()=>Fp,FileLoader:()=>Uh,FlatShading:()=>v,Float32Attribute:()=>of,Float32BufferAttribute:()=>Or,Float64Attribute:()=>sf,Float64BufferAttribute:()=>Nr,FloatType:()=>Rt,Fog:()=>Ia,FogExp2:()=>Ba,Font:()=>zu,FontLoader:()=>Hu,FrontSide:()=>f,Frustum:()=>So,GLBufferAttribute:()=>Ad,GLSL1:()=>Bn,GLSL3:()=>In,GammaEncoding:()=>Qe,Geometry:()=>Gl,GeometryUtils:()=>vf,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>Mn,GreaterStencilFunc:()=>xn,GridHelper:()=>Kd,Group:()=>La,HalfFloatType:()=>Pt,HemisphereLight:()=>mu,HemisphereLightHelper:()=>Zd,HemisphereLightProbe:()=>qu,IcosahedronBufferGeometry:()=>Nc,IcosahedronGeometry:()=>Bc,ImageBitmapLoader:()=>Uu,ImageLoader:()=>Gh,ImageUtils:()=>jn,ImmediateRenderObject:()=>Ud,IncrementStencilOp:()=>dn,IncrementWrapStencilOp:()=>fn,InstancedBufferAttribute:()=>Pu,InstancedBufferGeometry:()=>Ru,InstancedInterleavedBuffer:()=>Td,InstancedMesh:()=>fl,Int16Attribute:()=>tf,Int16BufferAttribute:()=>Lr,Int32Attribute:()=>nf,Int32BufferAttribute:()=>Rr,Int8Attribute:()=>Kp,Int8BufferAttribute:()=>Sr,IntType:()=>Lt,InterleavedBuffer:()=>ka,InterleavedBufferAttribute:()=>Fa,Interpolant:()=>_h,InterpolateDiscrete:()=>Fe,InterpolateLinear:()=>ze,InterpolateSmooth:()=>Ge,InvertStencilOp:()=>gn,JSONLoader:()=>_f,KeepStencilOp:()=>hn,KeyframeTrack:()=>Mh,LOD:()=>rl,LatheBufferGeometry:()=>Ic,LatheGeometry:()=>Dc,Layers:()=>Ii,LensFlare:()=>xf,LessDepth:()=>j,LessEqualDepth:()=>V,LessEqualStencilFunc:()=>bn,LessStencilFunc:()=>yn,Light:()=>fu,LightProbe:()=>Au,Line:()=>xl,Line3:()=>kd,LineBasicMaterial:()=>ml,LineCurve:()=>ou,LineCurve3:()=>su,LineDashedMaterial:()=>gh,LineLoop:()=>Sl,LinePieces:()=>kp,LineSegments:()=>El,LineStrip:()=>Dp,LinearEncoding:()=>Ze,LinearFilter:()=>_t,LinearInterpolant:()=>xh,LinearMipMapLinearFilter:()=>Mt,LinearMipMapNearestFilter:()=>xt,LinearMipmapLinearFilter:()=>wt,LinearMipmapNearestFilter:()=>bt,LinearToneMapping:()=>$,Loader:()=>Dh,LoaderUtils:()=>Cu,LoadingManager:()=>Bh,LogLuvEncoding:()=>tn,LoopOnce:()=>De,LoopPingPong:()=>Ue,LoopRepeat:()=>ke,LuminanceAlphaFormat:()=>zt,LuminanceFormat:()=>Ft,MOUSE:()=>r,Material:()=>br,MaterialLoader:()=>Lu,Math:()=>Fn,MathUtils:()=>Fn,Matrix3:()=>Gn,Matrix4:()=>Ei,MaxEquation:()=>C,Mesh:()=>ao,MeshBasicMaterial:()=>xr,MeshDepthMaterial:()=>xa,MeshDistanceMaterial:()=>wa,MeshFaceMaterial:()=>Gp,MeshLambertMaterial:()=>fh,MeshMatcapMaterial:()=>mh,MeshNormalMaterial:()=>ph,MeshPhongMaterial:()=>uh,MeshPhysicalMaterial:()=>hh,MeshStandardMaterial:()=>ch,MeshToonMaterial:()=>dh,MinEquation:()=>L,MirroredRepeatWrapping:()=>pt,MixOperation:()=>Z,MultiMaterial:()=>Hp,MultiplyBlending:()=>M,MultiplyOperation:()=>J,NearestFilter:()=>ft,NearestMipMapLinearFilter:()=>yt,NearestMipMapNearestFilter:()=>gt,NearestMipmapLinearFilter:()=>vt,NearestMipmapNearestFilter:()=>mt,NeverDepth:()=>G,NeverStencilFunc:()=>vn,NoBlending:()=>_,NoColors:()=>Up,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>We,NormalBlending:()=>b,NotEqualDepth:()=>Y,NotEqualStencilFunc:()=>wn,NumberKeyframeTrack:()=>Th,Object3D:()=>Ji,ObjectLoader:()=>Bu,ObjectSpaceNormalMap:()=>ln,OctahedronBufferGeometry:()=>kc,OctahedronGeometry:()=>Uc,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>k,OneMinusDstColorFactor:()=>F,OneMinusSrcAlphaFactor:()=>I,OneMinusSrcColorFactor:()=>N,OrthographicCamera:()=>xu,PCFShadowMap:()=>u,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>Lp,ParametricBufferGeometry:()=>Fc,ParametricGeometry:()=>zc,Particle:()=>Vp,ParticleBasicMaterial:()=>Xp,ParticleSystem:()=>Wp,ParticleSystemMaterial:()=>Yp,Path:()=>du,PerspectiveCamera:()=>vo,Plane:()=>$i,PlaneBufferGeometry:()=>Lo,PlaneGeometry:()=>Gc,PlaneHelper:()=>hp,PointCloud:()=>jp,PointCloudMaterial:()=>qp,PointLight:()=>bu,PointLightHelper:()=>qd,Points:()=>Pl,PointsMaterial:()=>Tl,PolarGridHelper:()=>Qd,PolyhedronBufferGeometry:()=>Jl,PolyhedronGeometry:()=>Hc,PositionalAudio:()=>ld,PropertyBinding:()=>xd,PropertyMixer:()=>hd,QuadraticBezierCurve:()=>au,QuadraticBezierCurve3:()=>lu,Quaternion:()=>Jn,QuaternionKeyframeTrack:()=>Lh,QuaternionLinearInterpolant:()=>Ah,REVISION:()=>i,RGBADepthPacking:()=>sn,RGBAFormat:()=>Ut,RGBAIntegerFormat:()=>Jt,RGBA_ASTC_10x10_Format:()=>ye,RGBA_ASTC_10x5_Format:()=>me,RGBA_ASTC_10x6_Format:()=>ge,RGBA_ASTC_10x8_Format:()=>ve,RGBA_ASTC_12x10_Format:()=>_e,RGBA_ASTC_12x12_Format:()=>be,RGBA_ASTC_4x4_Format:()=>ae,RGBA_ASTC_5x4_Format:()=>le,RGBA_ASTC_5x5_Format:()=>ce,RGBA_ASTC_6x5_Format:()=>he,RGBA_ASTC_6x6_Format:()=>ue,RGBA_ASTC_8x5_Format:()=>de,RGBA_ASTC_8x6_Format:()=>pe,RGBA_ASTC_8x8_Format:()=>fe,RGBA_BPTC_Format:()=>xe,RGBA_ETC2_EAC_Format:()=>se,RGBA_PVRTC_2BPPV1_Format:()=>ie,RGBA_PVRTC_4BPPV1_Format:()=>ne,RGBA_S3TC_DXT1_Format:()=>Kt,RGBA_S3TC_DXT3_Format:()=>Qt,RGBA_S3TC_DXT5_Format:()=>$t,RGBDEncoding:()=>rn,RGBEEncoding:()=>$e,RGBEFormat:()=>Gt,RGBFormat:()=>kt,RGBIntegerFormat:()=>Yt,RGBM16Encoding:()=>nn,RGBM7Encoding:()=>en,RGB_ETC1_Format:()=>re,RGB_ETC2_Format:()=>oe,RGB_PVRTC_2BPPV1_Format:()=>ee,RGB_PVRTC_4BPPV1_Format:()=>te,RGB_S3TC_DXT1_Format:()=>Zt,RGFormat:()=>qt,RGIntegerFormat:()=>Xt,RawShaderMaterial:()=>lh,Ray:()=>Mi,Raycaster:()=>Ld,RectAreaLight:()=>Su,RedFormat:()=>Vt,RedIntegerFormat:()=>Wt,ReinhardToneMapping:()=>tt,RepeatWrapping:()=>ut,ReplaceStencilOp:()=>un,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>jc,RingGeometry:()=>Vc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Ne,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Re,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Pe,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Oe,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Be,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Ie,SRGB8_ALPHA8_ASTC_4x4_Format:()=>we,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Me,SRGB8_ALPHA8_ASTC_5x5_Format:()=>Ee,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Se,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Te,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Ae,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Le,SRGB8_ALPHA8_ASTC_8x8_Format:()=>Ce,Scene:()=>Da,SceneUtils:()=>bf,ShaderChunk:()=>Co,ShaderLib:()=>Po,ShaderMaterial:()=>mo,ShadowMaterial:()=>ah,Shape:()=>pu,ShapeBufferGeometry:()=>Wc,ShapeGeometry:()=>qc,ShapePath:()=>Fu,ShapeUtils:()=>Ac,ShortType:()=>Tt,Skeleton:()=>ll,SkeletonHelper:()=>Vd,SkinnedMesh:()=>ol,SmoothShading:()=>y,Sphere:()=>mi,SphereBufferGeometry:()=>Xc,SphereGeometry:()=>Yc,Spherical:()=>Pd,SphericalHarmonics3:()=>Tu,Spline:()=>cf,SplineCurve:()=>cu,SplineCurve3:()=>lf,SpotLight:()=>yu,SpotLightHelper:()=>zd,Sprite:()=>tl,SpriteMaterial:()=>za,SrcAlphaFactor:()=>B,SrcAlphaSaturateFactor:()=>z,SrcColorFactor:()=>O,StaticCopyUsage:()=>Pn,StaticDrawUsage:()=>Sn,StaticReadUsage:()=>Ln,StereoCamera:()=>Zu,StreamCopyUsage:()=>Nn,StreamDrawUsage:()=>An,StreamReadUsage:()=>Rn,StringKeyframeTrack:()=>Ch,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>o,TangentSpaceNormalMap:()=>an,TetrahedronBufferGeometry:()=>Jc,TetrahedronGeometry:()=>Zc,TextBufferGeometry:()=>Kc,TextGeometry:()=>Qc,Texture:()=>Wn,TextureLoader:()=>Vh,TorusBufferGeometry:()=>$c,TorusGeometry:()=>th,TorusKnotBufferGeometry:()=>eh,TorusKnotGeometry:()=>nh,Triangle:()=>hr,TriangleFanDrawMode:()=>Je,TriangleStripDrawMode:()=>Ye,TrianglesDrawMode:()=>Xe,TubeBufferGeometry:()=>ih,TubeGeometry:()=>rh,UVMapping:()=>rt,Uint16Attribute:()=>ef,Uint16BufferAttribute:()=>Cr,Uint32Attribute:()=>rf,Uint32BufferAttribute:()=>Pr,Uint8Attribute:()=>Qp,Uint8BufferAttribute:()=>Tr,Uint8ClampedAttribute:()=>$p,Uint8ClampedBufferAttribute:()=>Ar,Uniform:()=>Sd,UniformsLib:()=>Ro,UniformsUtils:()=>fo,UnsignedByteType:()=>Et,UnsignedInt248Type:()=>It,UnsignedIntType:()=>Ct,UnsignedShort4444Type:()=>Ot,UnsignedShort5551Type:()=>Nt,UnsignedShort565Type:()=>Bt,UnsignedShortType:()=>At,VSMShadowMap:()=>p,Vector2:()=>zn,Vector3:()=>Zn,Vector4:()=>qn,VectorKeyframeTrack:()=>Rh,Vertex:()=>Jp,VertexColors:()=>zp,VideoTexture:()=>Nl,WebGL1Renderer:()=>Na,WebGLCubeRenderTarget:()=>xo,WebGLMultisampleRenderTarget:()=>Yn,WebGLRenderTarget:()=>Xn,WebGLRenderTargetCube:()=>gf,WebGLRenderer:()=>Oa,WebGLUtils:()=>Ta,WireframeGeometry:()=>oh,WireframeHelper:()=>pf,WrapAroundEnding:()=>Ve,XHRLoader:()=>ff,ZeroCurvatureEnding:()=>He,ZeroFactor:()=>R,ZeroSlopeEnding:()=>je,ZeroStencilOp:()=>cn,sRGBEncoding:()=>Ke});const i="122",r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},o={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=0,a=1,l=2,c=3,h=0,u=1,d=2,p=3,f=0,m=1,g=2,v=1,y=2,_=0,b=1,x=2,w=3,M=4,E=5,S=100,T=101,A=102,L=103,C=104,R=200,P=201,O=202,N=203,B=204,I=205,D=206,k=207,U=208,F=209,z=210,G=0,H=1,j=2,V=3,W=4,q=5,X=6,Y=7,J=0,Z=1,K=2,Q=0,$=1,tt=2,et=3,nt=4,it=5,rt=300,ot=301,st=302,at=303,lt=304,ct=306,ht=307,ut=1e3,dt=1001,pt=1002,ft=1003,mt=1004,gt=1004,vt=1005,yt=1005,_t=1006,bt=1007,xt=1007,wt=1008,Mt=1008,Et=1009,St=1010,Tt=1011,At=1012,Lt=1013,Ct=1014,Rt=1015,Pt=1016,Ot=1017,Nt=1018,Bt=1019,It=1020,Dt=1021,kt=1022,Ut=1023,Ft=1024,zt=1025,Gt=Ut,Ht=1026,jt=1027,Vt=1028,Wt=1029,qt=1030,Xt=1031,Yt=1032,Jt=1033,Zt=33776,Kt=33777,Qt=33778,$t=33779,te=35840,ee=35841,ne=35842,ie=35843,re=36196,oe=37492,se=37496,ae=37808,le=37809,ce=37810,he=37811,ue=37812,de=37813,pe=37814,fe=37815,me=37816,ge=37817,ve=37818,ye=37819,_e=37820,be=37821,xe=36492,we=37840,Me=37841,Ee=37842,Se=37843,Te=37844,Ae=37845,Le=37846,Ce=37847,Re=37848,Pe=37849,Oe=37850,Ne=37851,Be=37852,Ie=37853,De=2200,ke=2201,Ue=2202,Fe=2300,ze=2301,Ge=2302,He=2400,je=2401,Ve=2402,We=2500,qe=2501,Xe=0,Ye=1,Je=2,Ze=3e3,Ke=3001,Qe=3007,$e=3002,tn=3003,en=3004,nn=3005,rn=3006,on=3200,sn=3201,an=0,ln=1,cn=0,hn=7680,un=7681,dn=7682,pn=7683,fn=34055,mn=34056,gn=5386,vn=512,yn=513,_n=514,bn=515,xn=516,wn=517,Mn=518,En=519,Sn=35044,Tn=35048,An=35040,Ln=35045,Cn=35049,Rn=35041,Pn=35046,On=35050,Nn=35042,Bn="100",In="300 es";function Dn(){}Object.assign(Dn.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+kn[t>>16&255]+kn[t>>24&255]+"-"+kn[255&e]+kn[e>>8&255]+"-"+kn[e>>16&15|64]+kn[e>>24&255]+"-"+kn[63&n|128]+kn[n>>8&255]+"-"+kn[n>>16&255]+kn[n>>24&255]+kn[255&i]+kn[i>>8&255]+kn[i>>16&255]+kn[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Un=t%2147483647),Un=16807*Un%2147483647,(Un-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),c=o((e+i)/2),h=s((e+i)/2),u=o((e-i)/2),d=s((e-i)/2),p=o((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(a*h,l*u,l*d,a*c);break;case"YZY":t.set(l*d,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*d,a*h,a*c);break;case"XZX":t.set(a*h,l*f,l*p,a*c);break;case"YXY":t.set(l*p,a*h,l*f,a*c);break;case"ZYZ":t.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};class zn{constructor(t=0,e=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}class Gn{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),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(t,e,n,i,r,o,s,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=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],v=i[1],y=i[4],_=i[7],b=i[2],x=i[5],w=i[8];return r[0]=o*f+s*v+a*b,r[3]=o*m+s*y+a*x,r[6]=o*g+s*_+a*w,r[1]=l*f+c*v+h*b,r[4]=l*m+c*y+h*x,r[7]=l*g+c*_+h*w,r[2]=u*f+d*v+p*b,r[5]=u*m+d*y+p*x,r[8]=u*g+d*_+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8];return e*o*c-e*s*l-n*r*c+n*s*a+i*r*l-i*o*a}getInverse(t,e){void 0!==e&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");const n=t.elements,i=this.elements,r=n[0],o=n[1],s=n[2],a=n[3],l=n[4],c=n[5],h=n[6],u=n[7],d=n[8],p=d*l-c*u,f=c*h-d*a,m=u*a-l*h,g=r*p+o*f+s*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return i[0]=p*v,i[1]=(s*u-d*o)*v,i[2]=(c*o-s*l)*v,i[3]=f*v,i[4]=(d*r-s*h)*v,i[5]=(s*a-c*r)*v,i[6]=m*v,i[7]=(o*h-u*r)*v,i[8]=(l*r-o*a)*v,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).getInverse(this).transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),l=Math.sin(r);this.set(n*a,n*l,-n*(a*o+l*s)+o+t,-i*l,i*a,-i*(-l*o+a*s)+s+e,0,0,1)}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],l=i[4],c=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*l,i[6]=e*s+n*c,i[1]=-n*r+e*a,i[4]=-n*o+e*l,i[7]=-n*s+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}let Hn;const jn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Hn&&(Hn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Hn.width=t.width,Hn.height=t.height;const n=Hn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Hn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};let Vn=0;function Wn(t,e,n,i,r,o,s,a,l,c){Object.defineProperty(this,"id",{value:Vn++}),this.uuid=Fn.generateUUID(),this.name="",this.image=void 0!==t?t:Wn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Wn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:dt,this.wrapT=void 0!==i?i:dt,this.magFilter=void 0!==r?r:_t,this.minFilter=void 0!==o?o:wt,this.anisotropy=void 0!==l?l:1,this.format=void 0!==s?s:Ut,this.internalFormat=null,this.type=void 0!==a?a:Et,this.offset=new zn(0,0),this.repeat=new zn(1,1),this.center=new zn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Ze,this.version=0,this.onUpdate=null}Wn.DEFAULT_IMAGE=void 0,Wn.DEFAULT_MAPPING=rt,Wn.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Wn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=Fn.generateUUID()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t1)switch(this.wrapS){case ut:t.x=t.x-Math.floor(t.x);break;case dt:t.x=t.x<0?0:1;break;case pt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ut:t.y=t.y-Math.floor(t.y);break;case dt:t.y=t.y<0?0:1;break;case pt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Wn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});class qn{constructor(t=0,e=0,n=0,i=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=.01,s=.1,a=t.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&&t>v?tv?a=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[o],u=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-s*d,t[e+2]=l*p+c*d+s*u-a*h,t[e+3]=c*p-s*h-a*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(o){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: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}inverse(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+o*s+i*l-r*a,this._y=i*c+o*a+r*s-n*l,this._z=r*c+o*l+n*a-i*s,this._w=o*c-n*s-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=o*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}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}class Zn{constructor(t=0,e=0,n=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Qn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Qn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*i-s*n,c=a*n+s*e-r*i,h=a*i+r*n-o*e,u=-r*e-o*n-s*i;return this.x=l*a+u*-r+c*-s-h*-o,this.y=c*a+u*-o+h*-r-l*-s,this.z=h*a+u*-s+l*-o-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Kn.copy(this).projectOnVector(t),this.sub(Kn)}reflect(t){return this.sub(Kn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}const Kn=new Zn,Qn=new Jn;class $n{constructor(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new Zn(1/0,1/0,1/0),this.max=void 0!==e?e:new Zn(-1/0,-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;ar&&(r=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;ar&&(r=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Zn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,ni),ni.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(hi),ui.subVectors(this.max,hi),ri.subVectors(t.a,hi),oi.subVectors(t.b,hi),si.subVectors(t.c,hi),ai.subVectors(oi,ri),li.subVectors(si,oi),ci.subVectors(ri,si);let e=[0,-ai.z,ai.y,0,-li.z,li.y,0,-ci.z,ci.y,ai.z,0,-ai.x,li.z,0,-li.x,ci.z,0,-ci.x,-ai.y,ai.x,0,-li.y,li.x,0,-ci.y,ci.x,0];return!!ti(e,ri,oi,si,ui)&&(e=[1,0,0,0,1,0,0,0,1],!!ti(e,ri,oi,si,ui)&&(di.crossVectors(ai,li),e=[di.x,di.y,di.z],ti(e,ri,oi,si,ui)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Zn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return ni.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(ni).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ei[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ei[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ei[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ei[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ei[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ei[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ei[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ei[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ei)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}function ti(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){pi.fromArray(t,o);const s=r.x*Math.abs(pi.x)+r.y*Math.abs(pi.y)+r.z*Math.abs(pi.z),a=e.dot(pi),l=n.dot(pi),c=i.dot(pi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const ei=[new Zn,new Zn,new Zn,new Zn,new Zn,new Zn,new Zn,new Zn],ni=new Zn,ii=new $n,ri=new Zn,oi=new Zn,si=new Zn,ai=new Zn,li=new Zn,ci=new Zn,hi=new Zn,ui=new Zn,di=new Zn,pi=new Zn,fi=new $n;class mi{constructor(t,e){this.center=void 0!==t?t:new Zn,this.radius=void 0!==e?e:-1}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):fi.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new $n),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}}const gi=new Zn,vi=new Zn,yi=new Zn,_i=new Zn,bi=new Zn,xi=new Zn,wi=new Zn;class Mi{constructor(t,e){this.origin=void 0!==t?t:new Zn,this.direction=void 0!==e?e:new Zn(0,0,-1)}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Zn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,gi)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Zn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=gi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(gi.copy(this.direction).multiplyScalar(e).add(this.origin),gi.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){vi.copy(t).add(e).multiplyScalar(.5),yi.copy(e).sub(t).normalize(),_i.copy(this.origin).sub(vi);const r=.5*t.distanceTo(e),o=-this.direction.dot(yi),s=_i.dot(this.direction),a=-_i.dot(yi),l=_i.lengthSq(),c=Math.abs(1-o*o);let h,u,d,p;if(c>0)if(h=o*a-s,u=o*s-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+o*u+2*s)+u*(o*h+u+2*a)+l}else u=r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-o*r+s)),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,-(o*r+s)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=o>0?-r:r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(yi).multiplyScalar(u).add(vi),d}intersectSphere(t,e){gi.subVectors(t.center,this.origin);const n=gi.dot(this.direction),i=gi.dot(gi)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,o=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,o=(t.min.y-u.y)*c),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(s=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,gi)}intersectTriangle(t,e,n,i,r){bi.subVectors(e,t),xi.subVectors(n,t),wi.crossVectors(bi,xi);let o,s=this.direction.dot(wi);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}_i.subVectors(this.origin,t);const a=o*this.direction.dot(xi.crossVectors(_i,xi));if(a<0)return null;const l=o*this.direction.dot(bi.cross(_i));if(l<0)return null;if(a+l>s)return null;const c=-o*_i.dot(wi);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}class Ei{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),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(t,e,n,i,r,o,s,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,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 Ei).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Si.setFromMatrixColumn(t,0).length(),r=1/Si.setFromMatrixColumn(t,1).length(),o=1/Si.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*c,n=o*h,i=s*c,r=s*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*l,e[1]=o*h,e[5]=o*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*c,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*c,n=o*h,i=s*c,r=s*h;e[0]=a*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=o*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ai,t,Li)}lookAt(t,e,n){const i=this.elements;return Pi.subVectors(t,e),0===Pi.lengthSq()&&(Pi.z=1),Pi.normalize(),Ci.crossVectors(n,Pi),0===Ci.lengthSq()&&(1===Math.abs(n.z)?Pi.x+=1e-4:Pi.z+=1e-4,Pi.normalize(),Ci.crossVectors(n,Pi)),Ci.normalize(),Ri.crossVectors(Pi,Ci),i[0]=Ci.x,i[4]=Ri.x,i[8]=Pi.x,i[1]=Ci.y,i[5]=Ri.y,i[9]=Pi.y,i[2]=Ci.z,i[6]=Ri.z,i[10]=Pi.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=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],v=n[3],y=n[7],_=n[11],b=n[15],x=i[0],w=i[4],M=i[8],E=i[12],S=i[1],T=i[5],A=i[9],L=i[13],C=i[2],R=i[6],P=i[10],O=i[14],N=i[3],B=i[7],I=i[11],D=i[15];return r[0]=o*x+s*S+a*C+l*N,r[4]=o*w+s*T+a*R+l*B,r[8]=o*M+s*A+a*P+l*I,r[12]=o*E+s*L+a*O+l*D,r[1]=c*x+h*S+u*C+d*N,r[5]=c*w+h*T+u*R+d*B,r[9]=c*M+h*A+u*P+d*I,r[13]=c*E+h*L+u*O+d*D,r[2]=p*x+f*S+m*C+g*N,r[6]=p*w+f*T+m*R+g*B,r[10]=p*M+f*A+m*P+g*I,r[14]=p*E+f*L+m*O+g*D,r[3]=v*x+y*S+_*C+b*N,r[7]=v*w+y*T+_*R+b*B,r[11]=v*M+y*A+_*P+b*I,r[15]=v*E+y*L+_*O+b*D,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*a*h-i*l*h-r*s*u+n*l*u+i*s*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*o*u-i*o*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*s*d-r*o*h+n*o*d+r*s*c-n*l*c)+t[15]*(-i*s*c-e*a*h+e*s*u+i*o*h-n*o*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}getInverse(t,e){void 0!==e&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");const n=this.elements,i=t.elements,r=i[0],o=i[1],s=i[2],a=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],_=i[15],b=p*y*u-v*f*u+v*h*m-c*y*m-p*h*_+c*f*_,x=g*f*u-d*y*u-g*h*m+l*y*m+d*h*_-l*f*_,w=d*v*u-g*p*u+g*c*m-l*v*m-d*c*_+l*p*_,M=g*p*h-d*v*h-g*c*f+l*v*f+d*c*y-l*p*y,E=r*b+o*x+s*w+a*M;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/E;return n[0]=b*S,n[1]=(v*f*a-p*y*a-v*s*m+o*y*m+p*s*_-o*f*_)*S,n[2]=(c*y*a-v*h*a+v*s*u-o*y*u-c*s*_+o*h*_)*S,n[3]=(p*h*a-c*f*a-p*s*u+o*f*u+c*s*m-o*h*m)*S,n[4]=x*S,n[5]=(d*y*a-g*f*a+g*s*m-r*y*m-d*s*_+r*f*_)*S,n[6]=(g*h*a-l*y*a-g*s*u+r*y*u+l*s*_-r*h*_)*S,n[7]=(l*f*a-d*h*a+d*s*u-r*f*u-l*s*m+r*h*m)*S,n[8]=w*S,n[9]=(g*p*a-d*v*a-g*o*m+r*v*m+d*o*_-r*p*_)*S,n[10]=(l*v*a-g*c*a+g*o*u-r*v*u-l*o*_+r*c*_)*S,n[11]=(d*c*a-l*p*a-d*o*u+r*p*u+l*o*m-r*c*m)*S,n[12]=M*S,n[13]=(d*v*s-g*p*s+g*o*f-r*v*f-d*o*y+r*p*y)*S,n[14]=(g*c*s-l*v*s-g*o*h+r*v*h+l*o*y-r*c*y)*S,n[15]=(l*p*s-d*c*s+d*o*h-r*p*h-l*o*f+r*c*f)*S,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,l=r*o,c=r*s;return this.set(l*o+n,l*s-i*a,l*a+i*s,0,l*s+i*a,c*s+n,c*a-i*o,0,l*a-i*s,c*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,c=o+o,h=s+s,u=r*l,d=r*c,p=r*h,f=o*c,m=o*h,g=s*h,v=a*l,y=a*c,_=a*h,b=n.x,x=n.y,w=n.z;return i[0]=(1-(f+g))*b,i[1]=(d+_)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-_)*x,i[5]=(1-(u+g))*x,i[6]=(m+v)*x,i[7]=0,i[8]=(p+y)*w,i[9]=(m-v)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Si.set(i[0],i[1],i[2]).length();const o=Si.set(i[4],i[5],i[6]).length(),s=Si.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Ti.copy(this);const a=1/r,l=1/o,c=1/s;return Ti.elements[0]*=a,Ti.elements[1]*=a,Ti.elements[2]*=a,Ti.elements[4]*=l,Ti.elements[5]*=l,Ti.elements[6]*=l,Ti.elements[8]*=c,Ti.elements[9]*=c,Ti.elements[10]*=c,e.setFromRotationMatrix(Ti),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),l=1/(n-i),c=1/(o-r),h=(e+t)*a,u=(n+i)*l,d=(o+r)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Si=new Zn,Ti=new Ei,Ai=new Zn(0,0,0),Li=new Zn(1,1,1),Ci=new Zn,Ri=new Zn,Pi=new Zn;class Oi{constructor(t=0,e=0,n=0,i=Oi.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const i=Fn.clamp,r=t.elements,o=r[0],s=r[4],a=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ni.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ni,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Bi.setFromEuler(this),this.setFromQuaternion(Bi,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Zn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Oi.DefaultOrder="XYZ",Oi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const Ni=new Ei,Bi=new Jn;class Ii{constructor(){this.mask=1}set(t){this.mask=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e1?void 0:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Zn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Qi.getNormalMatrix(t),i=this.coplanarPoint(Zi).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}const tr=new Zn,er=new Zn,nr=new Zn,ir=new Zn,rr=new Zn,or=new Zn,sr=new Zn,ar=new Zn,lr=new Zn,cr=new Zn;class hr{constructor(t,e,n){this.a=void 0!==t?t:new Zn,this.b=void 0!==e?e:new Zn,this.c=void 0!==n?n:new Zn}static getNormal(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Zn),i.subVectors(n,e),tr.subVectors(t,e),i.cross(tr);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){tr.subVectors(i,e),er.subVectors(n,e),nr.subVectors(t,e);const o=tr.dot(tr),s=tr.dot(er),a=tr.dot(nr),l=er.dot(er),c=er.dot(nr),h=o*l-s*s;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Zn),0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-s*c)*u,p=(o*c-s*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,ir),ir.x>=0&&ir.y>=0&&ir.x+ir.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,ir),a.set(0,0),a.addScaledVector(r,ir.x),a.addScaledVector(o,ir.y),a.addScaledVector(s,ir.z),a}static isFrontFacing(t,e,n,i){return tr.subVectors(n,e),er.subVectors(t,e),tr.cross(er).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return tr.subVectors(this.c,this.b),er.subVectors(this.a,this.b),.5*tr.cross(er).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Zn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return hr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new $i),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return hr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return hr.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return hr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return hr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Zn);const n=this.a,i=this.b,r=this.c;let o,s;rr.subVectors(i,n),or.subVectors(r,n),ar.subVectors(t,n);const a=rr.dot(ar),l=or.dot(ar);if(a<=0&&l<=0)return e.copy(n);lr.subVectors(t,i);const c=rr.dot(lr),h=or.dot(lr);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return o=a/(a-c),e.copy(n).addScaledVector(rr,o);cr.subVectors(t,r);const d=rr.dot(cr),p=or.dot(cr);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(or,s);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return sr.subVectors(r,i),s=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(sr,s);const g=1/(m+f+u);return o=f*g,s=u*g,e.copy(n).addScaledVector(rr,o).addScaledVector(or,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const ur={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},dr={h:0,s:0,l:0},pr={h:0,s:0,l:0};function fr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function mr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class vr{constructor(t,e,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=fr(r,i,t+1/3),this.g=fr(r,i,t),this.b=fr(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[5]),this;if(t=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[5]),this;break;case"hsl":case"hsla":if(t=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[5]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ur[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e){void 0===e&&(e=2);const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=mr(t.r),this.g=mr(t.g),this.b=mr(t.b),this}copyLinearToSRGB(t){return this.r=gr(t.r),this.g=gr(t.g),this.b=gr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n0&&(n.alphaTest=this.alphaTest),!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.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(br.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),xr.prototype=Object.create(br.prototype),xr.prototype.constructor=xr,xr.prototype.isMeshBasicMaterial=!0,xr.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const wr=new Zn,Mr=new zn;function Er(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=Sn,this.updateRange={offset:0,count:-1},this.version=0}function Sr(t,e,n){Er.call(this,new Int8Array(t),e,n)}function Tr(t,e,n){Er.call(this,new Uint8Array(t),e,n)}function Ar(t,e,n){Er.call(this,new Uint8ClampedArray(t),e,n)}function Lr(t,e,n){Er.call(this,new Int16Array(t),e,n)}function Cr(t,e,n){Er.call(this,new Uint16Array(t),e,n)}function Rr(t,e,n){Er.call(this,new Int32Array(t),e,n)}function Pr(t,e,n){Er.call(this,new Uint32Array(t),e,n)}function Or(t,e,n){Er.call(this,new Float32Array(t),e,n)}function Nr(t,e,n){Er.call(this,new Float64Array(t),e,n)}Object.defineProperty(Er.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Er.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0,o=i[1]&&i[1].length>0,s=t.morphTargets,a=s.length;let l;if(a>0){l=[];for(let t=0;t0){u=[];for(let t=0;t0&&0===e.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let t=0;te&&(e=t[n]);return e}let Dr=1;const kr=new Ei,Ur=new Ji,Fr=new Zn,zr=new $n,Gr=new $n,Hr=new Zn;function jr(){Object.defineProperty(this,"id",{value:Dr+=2}),this.uuid=Fn.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}jr.prototype=Object.assign(Object.create(Dn.prototype),{constructor:jr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Ir(t)>65535?Pr:Cr)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Gn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return kr.makeRotationX(t),this.applyMatrix4(kr),this},rotateY:function(t){return kr.makeRotationY(t),this.applyMatrix4(kr),this},rotateZ:function(t){return kr.makeRotationZ(t),this.applyMatrix4(kr),this},translate:function(t,e,n){return kr.makeTranslation(t,e,n),this.applyMatrix4(kr),this},scale:function(t,e,n){return kr.makeScale(t,e,n),this.applyMatrix4(kr),this},lookAt:function(t){return Ur.lookAt(t),Ur.updateMatrix(),this.applyMatrix4(Ur.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fr).negate(),this.translate(Fr.x,Fr.y,Fr.z),this},setFromObject:function(t){const e=t.geometry;if(t.isPoints||t.isLine){const t=new Or(3*e.vertices.length,3),n=new Or(3*e.colors.length,3);if(this.setAttribute("position",t.copyVector3sArray(e.vertices)),this.setAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){const t=new Or(e.lineDistances.length,1);this.setAttribute("lineDistance",t.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){const e=[];for(let n=0,i=t.length;n0){const e=new Float32Array(3*t.normals.length);this.setAttribute("normal",new Er(e,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const e=new Float32Array(3*t.colors.length);this.setAttribute("color",new Er(e,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const e=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new Er(e,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const e=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new Er(e,2).copyVector2sArray(t.uvs2))}this.groups=t.groups;for(const e in t.morphTargets){const n=[],i=t.morphTargets[e];for(let t=0,e=i.length;t0){const e=new Or(4*t.skinIndices.length,4);this.setAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const e=new Or(4*t.skinWeights.length,4);this.setAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new $n);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Zn(-1/0,-1/0,-1/0),new Zn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e],r=i.toJSON(t.data);""!==i.name&&(r.name=i.name),t.data.attributes[e]=r}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,i=n.length;e0&&(i[e]=o,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t},clone:function(){return(new jr).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;tn.far?null:{distance:c,point:so.clone(),object:t}}function co(t,e,n,i,r,o,s,a,l,c,h,u){Xr.fromBufferAttribute(r,c),Yr.fromBufferAttribute(r,h),Jr.fromBufferAttribute(r,u);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){$r.set(0,0,0),to.set(0,0,0),eo.set(0,0,0);for(let t=0,e=o.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){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===t.ray.intersectsSphere(qr))return;if(Vr.getInverse(r),Wr.copy(t.ray).applyMatrix4(Vr),null!==n.boundingBox&&!1===Wr.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=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;n0&&(l=c);for(let n=0,c=a.length;n0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-o/g),S+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},go.prototype=Object.assign(Object.create(Ji.prototype),{constructor:go,isCamera:!0,copy:function(t,e){return Ji.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Zn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Ji.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(t,e){Ji.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),vo.prototype=Object.assign(Object.create(go.prototype),{constructor:vo,isPerspectiveCamera:!0,copy:function(t,e){return go.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){const e=Ji.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const yo=90;function _o(t,e,n){if(Ji.call(this),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 vo(yo,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Zn(1,0,0)),this.add(i);const r=new vo(yo,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Zn(-1,0,0)),this.add(r);const o=new vo(yo,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Zn(0,1,0)),this.add(o);const s=new vo(yo,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new Zn(0,-1,0)),this.add(s);const a=new vo(yo,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Zn(0,0,1)),this.add(a);const l=new vo(yo,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Zn(0,0,-1)),this.add(l),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();const c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}function bo(t,e,n,i,r,o,s,a,l,c){t=void 0!==t?t:[],e=void 0!==e?e:ot,s=void 0!==s?s:kt,Wn.call(this,t,e,n,i,r,o,s,a,l,c),this.flipY=!1,this._needsFlipEnvMap=!0}function xo(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),Xn.call(this,t,t,e),e=e||{},this.texture=new bo(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}function wo(t,e,n,i,r,o,s,a,l,c,h,u){Wn.call(this,null,o,s,a,l,c,i,r,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ft,this.minFilter=void 0!==c?c:ft,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}_o.prototype=Object.create(Ji.prototype),_o.prototype.constructor=_o,bo.prototype=Object.create(Wn.prototype),bo.prototype.constructor=bo,bo.prototype.isCubeTexture=!0,Object.defineProperty(bo.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),xo.prototype=Object.create(Xn.prototype),xo.prototype.constructor=xo,xo.prototype.isWebGLCubeRenderTarget=!0,xo.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=Ut,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t}\n\t\t",r="\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",o=new ho(5,5,5),s=new mo({name:"CubemapFromEquirect",uniforms:uo(n),vertexShader:i,fragmentShader:r,side:m,blending:_});s.uniforms.tEquirect.value=e;const a=new ao(o,s),l=e.minFilter;return e.minFilter===wt&&(e.minFilter=_t),new _o(1,10,this).update(t,a),e.minFilter=l,a.geometry.dispose(),a.material.dispose(),this},xo.prototype.clear=function(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)},wo.prototype=Object.create(Wn.prototype),wo.prototype.constructor=wo,wo.prototype.isDataTexture=!0;const Mo=new mi,Eo=new Zn;class So{constructor(t,e,n,i,r,o){this.planes=[void 0!==t?t:new $i,void 0!==e?e:new $i,void 0!==n?n:new $i,void 0!==i?i:new $i,void 0!==r?r:new $i,void 0!==o?o:new $i]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}clone(){return(new this.constructor).copy(this)}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=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],v=n[14],y=n[15];return e[0].setComponents(s-i,h-a,f-u,y-m).normalize(),e[1].setComponents(s+i,h+a,f+u,y+m).normalize(),e[2].setComponents(s+r,h+l,f+d,y+g).normalize(),e[3].setComponents(s-r,h-l,f-d,y-g).normalize(),e[4].setComponents(s-o,h-c,f-p,y-v).normalize(),e[5].setComponents(s+o,h+c,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Mo.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Mo)}intersectsSprite(t){return Mo.center.set(0,0,0),Mo.radius=.7071067811865476,Mo.applyMatrix4(t.matrixWorld),this.intersectsSphere(Mo)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,Eo.y=i.normal.y>0?t.max.y:t.min.y,Eo.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Eo)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}function To(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ao(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){var o=i.get(e);return void((!o||o.version 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\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 ) {\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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.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\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\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\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\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_maxMipLevel );\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\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\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#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\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\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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 texture2D( gradientMap, coord ).rgb;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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 );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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 );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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 getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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 getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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 getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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 = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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 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\tgetPointDirectLightIrradiance( 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\tgetSpotDirectLightIrradiance( 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\tgetDirectionalDirectLightIrradiance( 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 );\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 );\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 = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\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\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\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",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\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 ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef 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 );\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",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\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\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; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\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 )\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_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",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}",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}",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}",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 \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}",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}",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 \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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \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}",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 \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\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\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}",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 \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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 \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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\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\t#include \n\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#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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\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}",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}",shadow_vert:"#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}",sprite_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},Ro={common:{diffuse:{value:new vr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Gn},uv2Transform:{value:new Gn},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 zn(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 vr(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 vr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gn}},sprite:{diffuse:{value:new vr(15658734)},opacity:{value:1},center:{value:new zn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gn}}},Po={basic:{uniforms:po([Ro.common,Ro.specularmap,Ro.envmap,Ro.aomap,Ro.lightmap,Ro.fog]),vertexShader:Co.meshbasic_vert,fragmentShader:Co.meshbasic_frag},lambert:{uniforms:po([Ro.common,Ro.specularmap,Ro.envmap,Ro.aomap,Ro.lightmap,Ro.emissivemap,Ro.fog,Ro.lights,{emissive:{value:new vr(0)}}]),vertexShader:Co.meshlambert_vert,fragmentShader:Co.meshlambert_frag},phong:{uniforms:po([Ro.common,Ro.specularmap,Ro.envmap,Ro.aomap,Ro.lightmap,Ro.emissivemap,Ro.bumpmap,Ro.normalmap,Ro.displacementmap,Ro.fog,Ro.lights,{emissive:{value:new vr(0)},specular:{value:new vr(1118481)},shininess:{value:30}}]),vertexShader:Co.meshphong_vert,fragmentShader:Co.meshphong_frag},standard:{uniforms:po([Ro.common,Ro.envmap,Ro.aomap,Ro.lightmap,Ro.emissivemap,Ro.bumpmap,Ro.normalmap,Ro.displacementmap,Ro.roughnessmap,Ro.metalnessmap,Ro.fog,Ro.lights,{emissive:{value:new vr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Co.meshphysical_vert,fragmentShader:Co.meshphysical_frag},toon:{uniforms:po([Ro.common,Ro.aomap,Ro.lightmap,Ro.emissivemap,Ro.bumpmap,Ro.normalmap,Ro.displacementmap,Ro.gradientmap,Ro.fog,Ro.lights,{emissive:{value:new vr(0)}}]),vertexShader:Co.meshtoon_vert,fragmentShader:Co.meshtoon_frag},matcap:{uniforms:po([Ro.common,Ro.bumpmap,Ro.normalmap,Ro.displacementmap,Ro.fog,{matcap:{value:null}}]),vertexShader:Co.meshmatcap_vert,fragmentShader:Co.meshmatcap_frag},points:{uniforms:po([Ro.points,Ro.fog]),vertexShader:Co.points_vert,fragmentShader:Co.points_frag},dashed:{uniforms:po([Ro.common,Ro.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Co.linedashed_vert,fragmentShader:Co.linedashed_frag},depth:{uniforms:po([Ro.common,Ro.displacementmap]),vertexShader:Co.depth_vert,fragmentShader:Co.depth_frag},normal:{uniforms:po([Ro.common,Ro.bumpmap,Ro.normalmap,Ro.displacementmap,{opacity:{value:1}}]),vertexShader:Co.normal_vert,fragmentShader:Co.normal_frag},sprite:{uniforms:po([Ro.sprite,Ro.fog]),vertexShader:Co.sprite_vert,fragmentShader:Co.sprite_frag},background:{uniforms:{uvTransform:{value:new Gn},t2D:{value:null}},vertexShader:Co.background_vert,fragmentShader:Co.background_frag},cube:{uniforms:po([Ro.envmap,{opacity:{value:1}}]),vertexShader:Co.cube_vert,fragmentShader:Co.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Co.equirect_vert,fragmentShader:Co.equirect_frag},distanceRGBA:{uniforms:po([Ro.common,Ro.displacementmap,{referencePosition:{value:new Zn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Co.distanceRGBA_vert,fragmentShader:Co.distanceRGBA_frag},shadow:{uniforms:po([Ro.lights,Ro.fog,{color:{value:new vr(0)},opacity:{value:1}}]),vertexShader:Co.shadow_vert,fragmentShader:Co.shadow_frag}};function Oo(t,e,n,i,r){const o=new vr(0);let s,a,l=0,c=null,h=0,u=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e){o.set(t),l=void 0!==e?e:1,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(n,r,p,g){let v=!0===r.isScene?r.background:null;v&&v.isTexture&&(v=e.get(v));const y=t.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(v=null),null===v?d(o,l):v&&v.isColor&&(d(v,1),g=!0),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.isWebGLCubeRenderTarget||v.mapping===ct)?(void 0===a&&(a=new ao(new ho(1,1,1),new mo({name:"BackgroundCubeMaterial",uniforms:uo(Po.cube.uniforms),vertexShader:Po.cube.vertexShader,fragmentShader:Po.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(a)),v.isWebGLCubeRenderTarget&&(v=v.texture),a.material.uniforms.envMap.value=v,a.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v._needsFlipEnvMap?-1:1,c===v&&h===v.version&&u===t.toneMapping||(a.material.needsUpdate=!0,c=v,h=v.version,u=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):v&&v.isTexture&&(void 0===s&&(s=new ao(new Lo(2,2),new mo({name:"BackgroundMaterial",uniforms:uo(Po.background.uniforms),vertexShader:Po.background.vertexShader,fragmentShader:Po.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=v,!0===v.matrixAutoUpdate&&v.updateMatrix(),s.material.uniforms.uvTransform.value.copy(v.matrix),c===v&&h===v.version&&u===t.toneMapping||(s.material.needsUpdate=!0,c=v,h=v.version,u=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function No(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},l=d(null);let c=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t=0){const o=l[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=n.get(o);if(void 0===s)continue;const l=s.buffer,c=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,u=o.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,l),v(i,r,c,e,s*h,u*h)}else o.isInstancedBufferAttribute?(m(i,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(i),t.bindBuffer(34962,l),v(i,r,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i+0,4,s,!1,64,0),t.vertexAttribPointer(i+1,4,s,!1,64,16),t.vertexAttribPointer(i+2,4,s,!1,64,32),t.vertexAttribPointer(i+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i,3,s,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,l,u,y),null!==_&&t.bindBuffer(34963,n.get(_).buffer))},reset:y,resetDefaultState:_,dispose:function(){y();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function Bo(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,i,s,a),n.update(s,o,a)}}function Io(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=h>0,y=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;const n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?t.getParameter(36183):0}}function Do(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new $i,a=new Gn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let c=null;if(0!==o){if(c=l.value,!0!==r||null===c){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length0){const s=t.getRenderList(),a=t.getRenderTarget(),l=t.getRenderState(),c=new xo(o.height/2);return c.fromEquirectangularTexture(t,r),e.set(r,c),t.setRenderTarget(a),t.setRenderList(s),t.setRenderState(l),r.addEventListener("dispose",i),n(c.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function Uo(t){const e={};return{has:function(n){if(void 0!==e[n])return null!==e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,null!==i},get:function(t){return this.has(t)||console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]}}}function Fo(t,e,n,i){const r=new WeakMap,o=new WeakMap;function s(t){const a=t.target,l=r.get(a);null!==l.index&&e.remove(l.index);for(const t in l.attributes)e.remove(l.attributes[t]);a.removeEventListener("dispose",s),r.delete(a);const c=o.get(l);c&&(e.remove(c),o.delete(l)),i.releaseStatesOfGeometry(l),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e65535?Pr:Cr)(n,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){let i=r.get(e);return i||(e.addEventListener("dispose",s),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new jr).setFromObject(t)),i=e._bufferGeometry),r.set(e,i),n.memory.geometries++,i)},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t0)return t;const r=e*n;let o=Qo[r];if(void 0===o&&(o=new Float32Array(r),Qo[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function rs(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function ta(t){return t.replace($s,ea)}function ea(t,e){const n=Co[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ta(n)}const na=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ia=/#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 ra(t){return t.replace(ia,sa).replace(na,oa)}function oa(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),sa(0,e,n,i)}function sa(t,e,n,i){let r="";for(let t=parseInt(e);t0?t.gammaFactor:1,g=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Zs).join("\n")}(n),v=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(o),y=r.createProgram();let _,b,x=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(_=[v].filter(Zs).join("\n"),_.length>0&&(_+="\n"),b=[g,v].filter(Zs).join("\n"),b.length>0&&(b+="\n")):(_=[aa(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,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.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",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","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(Zs).join("\n"),b=[g,aa(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+m,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:"",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.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",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":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Co.tonemapping_pars_fragment:"",n.toneMapping!==Q?Js("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Co.encodings_pars_fragment,n.map?Xs("mapTexelToLinear",n.mapEncoding):"",n.matcap?Xs("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Xs("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Xs("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Xs("lightMapTexelToLinear",n.lightMapEncoding):"",Ys("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Zs).join("\n")),s=ta(s),s=Ks(s,n),s=Qs(s,n),a=ta(a),a=Ks(a,n),a=Qs(a,n),s=ra(s),a=ra(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",_=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,b=["#define varying in",n.glslVersion===In?"":"out highp vec4 pc_fragColor;",n.glslVersion===In?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+b);const w=x+b+a,M=js(r,35633,x+_+s),E=js(r,35632,w);if(r.attachShader(y,M),r.attachShader(y,E),void 0!==n.index0AttributeName?r.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(y).trim(),e=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(E).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(y,35714)){i=!1;const e=qs(r,M,"vertex"),n=qs(r,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(y,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:_},fragmentShader:{log:n,prefix:b}})}let S,T;return r.deleteShader(M),r.deleteShader(E),this.getUniforms=function(){return void 0===S&&(S=new Hs(r,y)),S},this.getAttributes=function(){return void 0===T&&(T=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,maxBones:E,useVertexTexture:c,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:Q,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===g,flipSided:r.side===m,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&i.sort(t||ua),r.length>1&&r.sort(e||da)}}}function fa(t){let e=new WeakMap;return{get:function(n,i){const r=e.get(n);let o;return void 0===r?(o=new pa(t),e.set(n,new WeakMap),e.get(n).set(i,o)):(o=r.get(i),void 0===o&&(o=new pa(t),r.set(i,o))),o},dispose:function(){e=new WeakMap}}}function ma(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Zn,color:new vr};break;case"SpotLight":n={position:new Zn,direction:new Zn,color:new vr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Zn,color:new vr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Zn,skyColor:new vr,groundColor:new vr};break;case"RectAreaLight":n={color:new vr,position:new Zn,halfWidth:new Zn,halfHeight:new Zn}}return t[e.id]=n,n}}}let ga=0;function va(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ya(t,e){const n=new ma,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new zn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new zn,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.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 t=0;t<9;t++)r.probe.push(new Zn);const o=new Zn,s=new Ei,a=new Ei;return{setup:function(l,c,h){let u=0,d=0,p=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let f=0,m=0,g=0,v=0,y=0,_=0,b=0,x=0;const w=h.matrixWorldInverse;l.sort(va);for(let t=0,e=l.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ro.LTC_FLOAT_1,r.rectAreaLTC2=Ro.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ro.LTC_HALF_1,r.rectAreaLTC2=Ro.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=u,r.ambient[1]=d,r.ambient[2]=p;const M=r.hash;M.directionalLength===f&&M.pointLength===m&&M.spotLength===g&&M.rectAreaLength===v&&M.hemiLength===y&&M.numDirectionalShadows===_&&M.numPointShadows===b&&M.numSpotShadows===x||(r.directional.length=f,r.spot.length=g,r.rectArea.length=v,r.point.length=m,r.hemi.length=y,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=b,r.pointShadowMap.length=b,r.spotShadow.length=x,r.spotShadowMap.length=x,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=b,r.spotShadowMatrix.length=x,M.directionalLength=f,M.pointLength=m,M.spotLength=g,M.rectAreaLength=v,M.hemiLength=y,M.numDirectionalShadows=_,M.numPointShadows=b,M.numSpotShadows=x,r.version=ga++)},state:r}}function _a(t,e){const n=new ya(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,r,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function ba(t,e){let n=new WeakMap;return{get:function(i,r){let o;return!1===n.has(i)?(o=new _a(t,e),n.set(i,new WeakMap),n.get(i).set(r,o)):!1===n.get(i).has(r)?(o=new _a(t,e),n.get(i).set(r,o)):o=n.get(i).get(r),o},dispose:function(){n=new WeakMap}}}function xa(t){br.call(this),this.type="MeshDepthMaterial",this.depthPacking=on,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function wa(t){br.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Zn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}function Ma(t,e,n){let i=new So;const r=new zn,o=new zn,s=new qn,a=[],l=[],c={},h={0:m,1:f,2:g},d=new mo({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new zn},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 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, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=d.clone();v.defines.HORIZONAL_PASS=1;const y=new jr;y.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new ao(y,d),x=this;function w(n,i){const r=e.update(b);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,b,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,v,b,null)}function M(t,e,n){const i=t<<0|e<<1|n<<2;let r=a[i];return void 0===r&&(r=new xa({depthPacking:sn,morphTargets:t,skinning:e}),a[i]=r),r}function E(t,e,n){const i=t<<0|e<<1|n<<2;let r=l[i];return void 0===r&&(r=new wa({morphTargets:t,skinning:e}),l[i]=r),r}function S(e,n,i,r,o,s,a){let l=null,u=M,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=E,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===i.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=u(t,r,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=l.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=l.clone(),n[e]=r),l=r}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=a===p?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function T(n,r,o,s,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(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;ln||r.y>n)&&(r.x>n&&(o.x=Math.floor(n/f.x),r.x=o.x*f.x,u.mapSize.x=o.x),r.y>n&&(o.y=Math.floor(n/f.y),r.y=o.y*f.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&this.type===p){const t={minFilter:_t,magFilter:_t,format:Ut};u.map=new Xn(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.mapPass=new Xn(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ft,magFilter:ft,format:Ut};u.map=new Xn(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t=1):-1!==at.indexOf("OpenGL ES")&&(st=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(at)[1]),ot=st>=2);let lt=null,ct={};const ht=new qn,ut=new qn;function dt(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;ei||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Fn.floorPowerOfTwo:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===p&&(p=m(o,s));const a=n?m(o,s):p;return a.width=o,a.height=s,a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function y(t,e){return t.generateMipmaps&&e&&t.minFilter!==ft&&t.minFilter!==_t}function _(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function b(n,i,r){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function x(t){return t===ft||t===mt||t===vt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=i.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),i.remove(e))}(n),n.isVideoTexture&&d.delete(n),s.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&t.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(e.texture),i.remove(e)}}(n),s.memory.textures--}let E=0;function S(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function T(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;R(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||l?l?i.image[t].image:i.image[t]:g(i.image[t],!1,!0,c);const u=h[0],d=v(u)||a,p=o.convert(i.format),f=o.convert(i.type),m=b(i.internalFormat,p,f);let x;if(C(34067,i,d),s){for(let t=0;t<6;t++){x=h[t].mipmaps;for(let e=0;e1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function R(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function P(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),R(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment);const l=function(t){return!a&&(t.wrapS!==dt||t.wrapT!==dt||t.minFilter!==ft&&t.minFilter!==_t)}(i)&&!1===v(i.image),c=g(i.image,l,!1,h),u=v(c)||a,d=o.convert(i.format);let p,f=o.convert(i.type),m=b(i.internalFormat,d,f);C(s,i,u);const x=i.mipmaps;if(i.isDepthTexture)m=6402,a?m=i.type===Rt?36012:i.type===Ct?33190:i.type===It?35056:33189:i.type===Rt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Ht&&6402===m&&i.type!==At&&i.type!==Ct&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=At,f=o.convert(i.type)),i.format===jt&&6402===m&&(m=34041,i.type!==It&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=It,f=o.convert(i.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(i.isDataTexture)if(x.length>0&&u){for(let t=0,e=x.length;t0&&u){for(let t=0,e=x.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=S,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=T,this.setupRenderTarget=function(e){const r=i.get(e),l=i.get(e.texture);e.addEventListener("dispose",M),l.__webglTexture=t.createTexture(),s.memory.textures++;const c=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,u=v(e)||a;if(!a||e.texture.format!==kt||e.texture.type!==Rt&&e.texture.type!==Pt||(e.texture.format=Ut,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(let e=0;e<6;e++)r.__webglFramebuffer[e]=t.createFramebuffer()}else if(r.__webglFramebuffer=t.createFramebuffer(),h)if(a){r.__webglMultisampledFramebuffer=t.createFramebuffer(),r.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,r.__webglColorRenderbuffer);const n=o.convert(e.texture.format),i=o.convert(e.texture.type),s=b(e.texture.internalFormat,n,i),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),t.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(r.__webglDepthRenderbuffer=t.createRenderbuffer(),N(r.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,l.__webglTexture),C(34067,e.texture,u);for(let t=0;t<6;t++)O(r.__webglFramebuffer[t],e,36064,34069+t);y(e.texture,u)&&_(34067,e.texture,e.width,e.height),n.bindTexture(34067,null)}else n.bindTexture(3553,l.__webglTexture),C(3553,e.texture,u),O(r.__webglFramebuffer,e,36064,3553),y(e.texture,u)&&_(3553,e.texture,e.width,e.height),n.bindTexture(3553,null);e.depthBuffer&&function(e){const n=i.get(e),r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),S(n.depthTexture,0);const r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Ht)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(n.depthTexture.format!==jt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)t.bindFramebuffer(36160,n.__webglFramebuffer[i]),n.__webglDepthbuffer[i]=t.createRenderbuffer(),N(n.__webglDepthbuffer[i],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),N(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(y(e,v(t)||a)){const r=t.isWebGLCubeRenderTarget?34067:3553,o=i.get(e).__webglTexture;n.bindTexture(r,o),_(r,e,t.width,t.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=i.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===I&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),I=!0),t=t.texture),S(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!0),t=t.texture),T(t,e)}}function Ta(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===Et)return 5121;if(t===Ot)return 32819;if(t===Nt)return 32820;if(t===Bt)return 33635;if(t===St)return 5120;if(t===Tt)return 5122;if(t===At)return 5123;if(t===Lt)return 5124;if(t===Ct)return 5125;if(t===Rt)return 5126;if(t===Pt)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===Dt)return 6406;if(t===kt)return 6407;if(t===Ut)return 6408;if(t===Ft)return 6409;if(t===zt)return 6410;if(t===Ht)return 6402;if(t===jt)return 34041;if(t===Vt)return 6403;if(t===Wt)return 36244;if(t===qt)return 33319;if(t===Xt)return 33320;if(t===Yt)return 36248;if(t===Jt)return 36249;if(t===Zt||t===Kt||t===Qt||t===$t){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===Zt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Kt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Qt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===$t)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===te||t===ee||t===ne||t===ie){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===te)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ee)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ne)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ie)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===re)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===oe||t===se)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===oe)return n.COMPRESSED_RGB8_ETC2;if(t===se)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ae||t===le||t===ce||t===he||t===ue||t===de||t===pe||t===fe||t===me||t===ge||t===ve||t===ye||t===_e||t===be||t===we||t===Me||t===Ee||t===Se||t===Te||t===Ae||t===Le||t===Ce||t===Re||t===Pe||t===Oe||t===Ne||t===Be||t===Ie?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===xe?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===It?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Aa(t){vo.call(this),this.cameras=t||[]}function La(){Ji.call(this),this.type="Group"}function Ca(){this._targetRay=null,this._grip=null,this._hand=null}function Ra(t,e){const n=this;let i=null,r=1,o=null,s="local-floor",a=null;const l=[],c=new Map,h=new vo;h.layers.enable(1),h.viewport=new qn;const u=new vo;u.layers.enable(2),u.viewport=new qn;const d=[h,u],p=new Aa;p.layers.enable(1),p.layers.enable(2);let f=null,m=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function v(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),E.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(t){o=t,E.setContext(i),E.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function _(t){const e=i.inputSources;for(let t=0;t0&&xt(o,t,e),s.length>0&&xt(s,t,e),!0===t.isScene&&t.onAfterRender(p,t,e),null!==y&&(q.updateRenderTargetMipmap(y),q.updateMultisampleRenderTarget(y)),j.buffers.depth.setTest(!0),j.buffers.depth.setMask(!0),j.buffers.color.setMask(!0),j.setPolygonOffset(!1),u=null,d=null},this.setFramebuffer=function(t){m!==t&&null===y&&ct.bindFramebuffer(36160,t),m=t},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return v},this.getRenderList=function(){return u},this.setRenderList=function(t){u=t},this.getRenderState=function(){return d},this.setRenderState=function(t){d=t},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,n=0){y=t,g=e,v=n,t&&void 0===W.get(t).__webglFramebuffer&&q.setupRenderTarget(t);let i=m,r=!1;if(t){const n=W.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=n[e],r=!0):i=t.isWebGLMultisampleRenderTarget?W.get(t).__webglMultisampledFramebuffer:n,M.copy(t.viewport),E.copy(t.scissor),S=t.scissorTest}else M.copy(P).multiplyScalar(L).floor(),E.copy(O).multiplyScalar(L).floor(),S=N;if(_!==i&&(ct.bindFramebuffer(36160,i),_=i),j.viewport(M),j.scissor(E),j.setScissorTest(S),r){const i=W.get(t.texture);ct.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=W.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){let s=!1;a!==_&&(ct.bindFramebuffer(36160,a),s=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Ut&&at.convert(l)!==ct.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c===Et||at.convert(c)===ct.getParameter(35738)||c===Rt&&(H.isWebGL2||G.get("OES_texture_float")||G.get("WEBGL_color_buffer_float"))||c===Pt&&(H.isWebGL2?G.get("EXT_color_buffer_float"):G.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ct.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&ct.readPixels(e,n,i,r,at.convert(l),at.convert(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&ct.bindFramebuffer(36160,_)}}},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i),s=at.convert(e.format);q.setTexture2D(e,0),ct.copyTexImage2D(3553,n,s,t.x,t.y,r,o,0),j.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i){void 0===i&&(i=0);const r=e.image.width,o=e.image.height,s=at.convert(n.format),a=at.convert(n.type);q.setTexture2D(n,0),ct.pixelStorei(37440,n.flipY),ct.pixelStorei(37441,n.premultiplyAlpha),ct.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ct.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?ct.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):ct.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&ct.generateMipmap(3553),j.unbindTexture()},this.initTexture=function(t){q.setTexture2D(t,0),j.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Na(t){Oa.call(this,t)}xa.prototype=Object.create(br.prototype),xa.prototype.constructor=xa,xa.prototype.isMeshDepthMaterial=!0,xa.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},wa.prototype=Object.create(br.prototype),wa.prototype.constructor=wa,wa.prototype.isMeshDistanceMaterial=!0,wa.prototype.copy=function(t){return br.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Aa.prototype=Object.assign(Object.create(vo.prototype),{constructor:Aa,isArrayCamera:!0}),La.prototype=Object.assign(Object.create(Ji.prototype),{constructor:La,isGroup:!0}),Object.assign(Ca.prototype,{constructor:Ca,getHandSpace:function(){if(null===this._hand&&(this._hand=new La,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(let t=0;t<=window.XRHand.LITTLE_PHALANX_TIP;t++){const t=new La;t.matrixAutoUpdate=!1,t.visible=!1,this._hand.joints.push(t),this._hand.add(t)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new La,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new La,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t)if(l&&t.hand){o=!0;for(let i=0;i<=window.XRHand.LITTLE_PHALANX_TIP;i++)if(t.hand[i]){const r=e.getJointPose(t.hand[i],n),o=l.joints[i];null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.jointRadius=r.radius),o.visible=null!==r;const s=l.joints[window.XRHand.INDEX_PHALANX_TIP],a=l.joints[window.XRHand.THUMB_PHALANX_TIP],c=s.position.distanceTo(a.position),h=.02,u=.005;l.inputState.pinching&&c>h+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&c<=h-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}}else null!==s&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale))),null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}),Object.assign(Ra.prototype,Dn.prototype),Na.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Na,isWebGL1Renderer:!0});class Ba{constructor(t,e){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new vr(t),this.density=void 0!==e?e:25e-5}clone(){return new Ba(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Ia{constructor(t,e,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new vr(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new Ia(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Da extends Ji{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),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(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function ka(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Sn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}Object.defineProperty(ka.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ka.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:a,point:Ha.clone(),uv:hr.getUV(Ha,Ya,Ja,Za,Ka,Qa,$a,new zn),face:null,object:this})},copy:function(t){return Ji.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}});const nl=new Zn,il=new Zn;function rl(){Ji.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function ol(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ao.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ei,this.bindMatrixInverse=new Ei}rl.prototype=Object.assign(Object.create(Ji.prototype),{constructor:rl,isLOD:!0,copy:function(t){Ji.prototype.copy.call(this,t,!1);const e=t.levels;for(let t=0,n=e.length;t0){let n,i;for(n=1,i=e.length;n0){nl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(nl);this.getObjectForDistance(n).raycast(t,e)}},update:function(t){const e=this.levels;if(e.length>1){nl.setFromMatrixPosition(t.matrixWorld),il.setFromMatrixPosition(this.matrixWorld);const n=nl.distanceTo(il)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;is)continue;h.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(h);dt.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else for(let n=0,i=r.count-1;ns)continue;h.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(h);it.far||e.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){const i=n.vertices,r=i.length;for(let n=0;ns)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);rt.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const wl=new Zn,Ml=new Zn;function El(t,e){xl.call(this,t,e),this.type="LineSegments"}function Sl(t,e){xl.call(this,t,e),this.type="LineLoop"}function Tl(t){br.call(this),this.type="PointsMaterial",this.color=new vr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}El.prototype=Object.assign(Object.create(xl.prototype),{constructor:El,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;tr.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}function Nl(t,e,n,i,r,o,s,a,l){Wn.call(this,t,e,n,i,r,o,s,a,l),this.format=void 0!==s?s:kt,this.minFilter=void 0!==o?o:_t,this.magFilter=void 0!==r?r:_t,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}function Bl(t,e,n,i,r,o,s,a,l,c,h,u){Wn.call(this,null,o,s,a,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Il(t,e,n,i,r,o,s,a,l){Wn.call(this,t,e,n,i,r,o,s,a,l),this.needsUpdate=!0}function Dl(t,e,n,i,r,o,s,a,l,c){if((c=void 0!==c?c:Ht)!==Ht&&c!==jt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Ht&&(n=At),void 0===n&&c===jt&&(n=It),Wn.call(this,null,i,r,o,s,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:ft,this.minFilter=void 0!==a?a:ft,this.flipY=!1,this.generateMipmaps=!1}Pl.prototype=Object.assign(Object.create(Ji.prototype),{constructor:Pl,isPoints:!0,copy:function(t){return Ji.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Cl.copy(n.boundingSphere),Cl.applyMatrix4(i),Cl.radius+=r,!1===t.ray.intersectsSphere(Cl))return;Al.getInverse(i),Ll.copy(t.ray).applyMatrix4(Al);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,a=n.length;r0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),Nl.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Nl,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Bl.prototype=Object.create(Wn.prototype),Bl.prototype.constructor=Bl,Bl.prototype.isCompressedTexture=!0,Il.prototype=Object.create(Wn.prototype),Il.prototype.constructor=Il,Il.prototype.isCanvasTexture=!0,Dl.prototype=Object.create(Wn.prototype),Dl.prototype.constructor=Dl,Dl.prototype.isDepthTexture=!0;let kl=0;const Ul=new Ei,Fl=new Ji,zl=new Zn;function Gl(){Object.defineProperty(this,"id",{value:kl+=2}),this.uuid=Fn.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Gl.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Gl,isGeometry:!0,applyMatrix4:function(t){const e=(new Gn).getNormalMatrix(t);for(let e=0,n=this.vertices.length;e0)for(let t=0;t0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let t=0,e=this.faces.length;t=0;t--){const e=r[t];this.faces.splice(e,1);for(let t=0,n=this.faceVertexUvs.length;t0,a=e.vertexNormals.length>0,l=1!==e.color.r||1!==e.color.g||1!==e.color.b,p=e.vertexColors.length>0;let f=0;if(f=c(f,0,0),f=c(f,1,i),f=c(f,2,r),f=c(f,3,o),f=c(f,4,s),f=c(f,5,a),f=c(f,6,l),f=c(f,7,p),n.push(f),n.push(e.a,e.b,e.c),n.push(e.materialIndex),o){const e=this.faceVertexUvs[0][t];n.push(d(e[0]),d(e[1]),d(e[2]))}if(s&&n.push(h(e.normal)),a){const t=e.vertexNormals;n.push(h(t[0]),h(t[1]),h(t[2]))}if(l&&n.push(u(e.color)),p){const t=e.vertexColors;n.push(u(t[0]),u(t[1]),u(t[2]))}}function c(t,e,n){return n?t|1<0&&(t.data.colors=o),a.length>0&&(t.data.uvs=[a]),t.data.faces=n,t},clone:function(){return(new Gl).copy(this)},copy:function(t){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;const e=t.vertices;for(let t=0,n=e.length;t0&&v(!0),e>0&&v(!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))}}class ql extends Gl{constructor(t,e,n,i,r,o,s,a){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a},this.fromBufferGeometry(new Wl(t,e,n,i,r,o,s,a)),this.mergeVertices()}}class Xl extends ql{constructor(t,e,n,i,r,o,s){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}}class Yl extends Wl{constructor(t,e,n,i,r,o,s){super(0,t,e,n,i,r,o,s),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}}class Jl extends jr{constructor(t,e,n,i){super(),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1;const r=[],o=[];function s(t,e,n,i){const r=i+1,o=[];for(let i=0;i<=r;i++){o[i]=[];const s=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)o[i][t]=0===t&&i===r?s:s.clone().lerp(a,t/l)}for(let t=0;t.9&&s<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}class Zl extends Jl{constructor(t,e){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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}}class Kl extends Gl{constructor(t,e){super(),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Zl(t,e)),this.mergeVertices()}}const Ql=new Zn,$l=new Zn,tc=new Zn,ec=new hr;class nc extends jr{constructor(t,e){super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,t.isGeometry&&(t=(new jr).fromGeometry(t));const n=Math.pow(10,4),i=Math.cos(Fn.DEG2RAD*e),r=t.getIndex(),o=t.getAttribute("position"),s=r?r.count:o.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let t=0;t0)for(o=e;o=e;o-=i)s=Ec(o,t[o],t[o+1],s);return s&&yc(s,s.next)&&(Sc(s),s=s.next),s}function rc(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!yc(i,i.next)&&0!==vc(i.prev,i,i.next))i=i.next;else{if(Sc(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function oc(t,e,n,i,r,o,s){if(!t)return;!s&&o&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=pc(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,o,s,a,l,c=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(s>1)}(r)}(t,i,r,o);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?ac(t,i,r,o):sc(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),Sc(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?oc(t=lc(rc(t),e,n),e,n,i,r,o,2):2===s&&cc(t,e,n,i,r,o):oc(rc(t),e,n,i,r,o,1);break}}function sc(t){const e=t.prev,n=t,i=t.next;if(vc(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(mc(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&vc(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ac(t,e,n,i){const r=t.prev,o=t,s=t.next;if(vc(r,o,s)>=0)return!1;const a=r.xo.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,u=pc(a,l,e,n,i),d=pc(c,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&mc(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&vc(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&mc(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&vc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&mc(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&vc(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&mc(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&vc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function lc(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!yc(r,o)&&_c(r,i,i.next,o)&&wc(r,o)&&wc(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),Sc(i),Sc(i.next),i=t=o),i=i.next}while(i!==t);return rc(i)}function cc(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&gc(s,t)){let a=Mc(s,t);return s=rc(s,s.next),a=rc(a,a.next),oc(s,e,n,i,r,o),void oc(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function hc(t,e){return t.x-e.x}function uc(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let o,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x=n.x&&n.x>=l&&i!==n.x&&mc(ro.x||n.x===o.x&&dc(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}(t,e)){const n=Mc(e,t);rc(e,e.next),rc(n,n.next)}}function dc(t,e){return vc(t.prev,t,e.prev)<0&&vc(e.next,t,t.next)<0}function pc(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fc(t){let e=t,n=t;do{(e.x=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function gc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&_c(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(wc(t,e)&&wc(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(vc(t.prev,t,e.prev)||vc(t,e.prev,e))||yc(t,e)&&vc(t.prev,t,t.next)>0&&vc(e.prev,e,e.next)>0)}function vc(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function yc(t,e){return t.x===e.x&&t.y===e.y}function _c(t,e,n,i){const r=xc(vc(t,e,n)),o=xc(vc(t,e,i)),s=xc(vc(n,i,t)),a=xc(vc(n,i,e));return r!==o&&s!==a||!(0!==r||!bc(t,n,e))||!(0!==o||!bc(t,i,e))||!(0!==s||!bc(n,t,i))||!(0!==a||!bc(n,e,i))}function bc(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function xc(t){return t>0?1:t<0?-1:0}function wc(t,e){return vc(t.prev,t,t.next)<0?vc(t,e,t.next)>=0&&vc(t,t.prev,e)>=0:vc(t,e,t.prev)<0||vc(t,t.next,e)<0}function Mc(t,e){const n=new Tc(t.i,t.x,t.y),i=new Tc(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function Ec(t,e,n,i){const r=new Tc(t,e,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 Sc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Tc(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}const Ac={area:function(t){const e=t.length;let n=0;for(let i=e-1,r=0;r80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return oc(o,s,n,a,l,p),s}(n,i);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function Cc(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,f=e.y+s/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(s*c-a*l);i=p+s*m-t.x,r=f+a*m-t.y;const g=i*i+r*r;if(g<=2)return new zn(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new zn(i/o,r/o)}const P=[];for(let t=0,e=T.length,n=e-1,i=t+1;t=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=T.length;t=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t=0?(t(i-a,p,h),u.subVectors(c,h)):(t(i+a,p,h),u.subVectors(h,c)),p-a>=0?(t(i,p-a,h),d.subVectors(c,h)):(t(i,p+a,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),o.push(l.x,l.y,l.z),s.push(i,p)}}for(let t=0;t0)&&d.push(e,r,l),(t!==n-1||a=i)){l.push(e.times[t]);for(let n=0;no.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+a,e=t+l-a;d=yh.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(o),d=yh.arraySlice(t.resultBuffer,e,n)}"quaternion"===r&&(new Jn).fromArray(d).normalize().conjugate().toArray(d);const p=s.times.length;for(let t=0;t=r)break t;{const s=e[1];t=r)break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=yh.arraySlice(n,r,o),this.values=yh.arraySlice(this.values,r*t,o*t)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==o&&o>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,o),t=!1;break}o=i}if(void 0!==i&&yh.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t},optimize:function(){const t=yh.arraySlice(this.times),e=yh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Ge,r=t.length-1;let o=1;for(let s=1;s0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=yh.arraySlice(t,0,o),this.values=yh.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this},clone:function(){const t=yh.arraySlice(this.times,0),e=yh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),Eh.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Eh,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Sh.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Sh,ValueTypeName:"color"}),Th.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Th,ValueTypeName:"number"}),Ah.prototype=Object.assign(Object.create(_h.prototype),{constructor:Ah,interpolate_:function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)Jn.slerpFlat(r,0,o,l-s,o,l,a);return r}}),Lh.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Lh,ValueTypeName:"quaternion",DefaultInterpolation:ze,InterpolantFactoryMethodLinear:function(t){return new Ah(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Ch.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Ch,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Fe,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Rh.prototype=Object.assign(Object.create(Mh.prototype),{constructor:Rh,ValueTypeName:"vector"}),Object.assign(Ph,{parse:function(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Oh(n[t]).scale(i));return new Ph(t.name,t.duration,e,t.blendMode)},toJSON:function(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Mh.toJSON(n[t]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){const r=e.length,o=[];for(let t=0;t1){const t=o[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const o=[];for(const t in i)o.push(Ph.CreateFromMorphTargetSequence(t,i[t],e,n));return o},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];yh.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t0||0===t.search(/^data\:image\/jpeg/);r.format=i?kt:Ut,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}),Object.assign(Wh.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),s=n[i]-o,s<0)a=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===o)return i/(r-1);const c=n[i];return(i+(o-c)/(n[i+1]-c))/(r-1)},getTangent:function(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),s=this.getPoint(r),a=e||(o.isVector2?new zn:new Zn);return a.copy(s).sub(o).normalize(),a},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Zn,i=[],r=[],o=[],s=new Zn,a=new Ei;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new Zn),i[e].normalize()}r[0]=new Zn,o[0]=new Zn;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),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(i[e-1],i[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Fn.clamp(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Fn.clamp(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),qh.prototype=Object.create(Wh.prototype),qh.prototype.constructor=qh,qh.prototype.isEllipseCurve=!0,qh.prototype.getPoint=function(t,e){const n=e||new zn,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=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?s=i[(l-1)%r]:(Jh.subVectors(i[0],i[1]).add(i[0]),s=Jh);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(tu(s,a.x,l.x,c.x,h.x),tu(s,a.y,l.y,c.y,h.y)),n},cu.prototype.copy=function(t){Wh.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[i]-e,r=this.curves[i],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}i++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){Wh.prototype.copy.call(this,t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this},copy:function(t){return uu.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=uu.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return uu.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),pu.prototype=Object.assign(Object.create(du.prototype),{constructor:pu,getPointsHoles:function(t){const e=[];for(let n=0,i=this.holes.length;n0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new vr).setHex(r.value);break;case"v2":i.uniforms[e].value=(new zn).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new Zn).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new qn).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Gn).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Ei).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new zn).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new zn).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),i},setTextures:function(t){return this.textures=t,this}});const Cu={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n0){const s=new Bh(e);r=new Gh(s),r.setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;eNumber.EPSILON){if(l<0&&(n=e[o],a=-a,s=e[r],l=-l),t.ys.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=Ac.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let s,a,l;const c=[];if(1===o.length)return a=o[0],l=new pu,l.curves=a.curves,c.push(l),c;let h=!r(o[0].getPoints());h=t?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=o.length;e1){let t=!1;const e=[];for(let t=0,e=d.length;t0&&(t||(m=u))}for(let t=0,e=d.length;t0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){s.setValue(n,i);break}},saveOriginalState:function(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]},_slerp:function(t,e,n,i){Jn.slerpFlat(t,e,t,e,t,n,i)},_slerpAdditive:function(t,e,n,i,r){const o=this._workIndex*r;Jn.multiplyQuaternionsFlat(t,o,t,e,t,n),Jn.slerpFlat(t,e,t,e,t,o,i)},_lerp:function(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}},_lerpAdditive:function(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}});const ud=new RegExp("[\\[\\]\\.:\\/]","g"),dd="[^\\[\\]\\.:\\/]",pd="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",fd=/((?:WC+[\/:])*)/.source.replace("WC",dd),md=/(WCOD+)?/.source.replace("WCOD",pd),gd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dd),vd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dd),yd=new RegExp("^"+fd+md+gd+vd+"$"),_d=["material","materials","bones"];function bd(t,e,n){const i=n||xd.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function xd(t,e,n){this.path=e,this.parsedPath=n||xd.parseTrackName(e),this.node=xd.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function wd(){this.uuid=Fn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}Object.assign(bd.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(xd,{Composite:bd,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new xd.Composite(t,e,n):new xd(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(ud,"")},parseTrackName:function(t){const e=yd.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==_d.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i=r){const o=r++,c=t[o];e[c.uuid]=l,t[l]=c,e[a]=o,t[o]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[l];e[l]=i,e[o]=r}}}this.nCachedObjects_=r},uncache:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,o.push(t),s.push(e),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new xd(i,t,e)}return h},unsubscribe_:function(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=n,o[n]=a,o.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}});class Md{constructor(t,e,n,i){this._mixer=t,this._clip=e,this._localRoot=n||null,this.blendMode=i||e.blendMode;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:He,endingEnd:He};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ke,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(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case qe:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);break;case We:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=n===Ue;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(n===De){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=je,i.endingEnd=je):(i.endingStart=t?this.zeroSlopeAtStart?je:He:Ve,i.endingEnd=e?this.zeroSlopeAtEnd?je:He:Ve)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}function Ed(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}Ed.prototype=Object.assign(Object.create(Dn.prototype),{constructor:Ed,_bindAction:function(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)o[t]=h;else{if(h=o[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new hd(xd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[t]=h}s[t].resultBuffer=h.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this},update:function(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==n;++s)e[s]._update(i,t,r,o);const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this},setTime:function(t){this.time=0;for(let t=0;tthis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new zn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new zn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Nd.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Id=new Zn,Dd=new Zn;class kd{constructor(t,e){this.start=void 0!==t?t:new Zn,this.end=void 0!==e?e:new Zn}set(t,e){return this.start.copy(t),this.end.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Zn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Zn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Zn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Id.subVectors(t,this.start),Dd.subVectors(this.end,this.start);const n=Dd.dot(Dd);let i=Dd.dot(Id)/n;return e&&(i=Fn.clamp(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Zn),this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}function Ud(t){Ji.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Ud.prototype=Object.create(Ji.prototype),Ud.prototype.constructor=Ud,Ud.prototype.isImmediateRenderObject=!0;const Fd=new Zn;class zd extends Ji{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new jr,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 t=0,e=1,n=32;t.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{up.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(up,e)}}setLength(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class mp extends El{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new jr;n.setAttribute("position",new Or(e,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 ml({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}const gp=Math.pow(2,8),vp=[.125,.215,.35,.446,.526,.582],yp=5+vp.length,_p={[Ze]:0,[Ke]:1,[$e]:2,[en]:3,[nn]:4,[rn]:5,[Qe]:6},bp=new xu,{_lodPlanes:xp,_sizeLods:wp,_sigmas:Mp}=Rp();let Ep=null;const Sp=(1+Math.sqrt(5))/2,Tp=1/Sp,Ap=[new Zn(1,1,1),new Zn(-1,1,1),new Zn(1,1,-1),new Zn(-1,1,-1),new Zn(0,Sp,Tp),new Zn(0,Sp,-Tp),new Zn(Tp,0,Sp),new Zn(-Tp,0,Sp),new Zn(Sp,Tp,0),new Zn(-Sp,Tp,0)];class Lp{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=new lh({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new Zn(0,1,0)},inputEncoding:{value:_p[Ze]},outputEncoding:{value:_p[Ze]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1}),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Ep=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Bp(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Np(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?gp:0,gp,gp),a.setRenderTarget(i),a.render(t,r)}a.toneMapping=c,a.outputEncoding=l,a.setClearColor(h,u)}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Bp()):null==this._equirectShader&&(this._equirectShader=Np());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new ao(xp[0],i),o=i.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=_p[t.encoding],o.outputEncoding.value=_p[e.texture.encoding],Op(e,0,0,3*gp,2*gp),n.setRenderTarget(e),n.render(r,bp)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e20&&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 t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t4?i-8+4:0),3*v,2*v),a.setRenderTarget(e),a.render(c,bp)}}function Cp(t){return void 0!==t&&t.type===Et&&(t.encoding===Ze||t.encoding===Ke||t.encoding===Qe)}function Rp(){const t=[],e=[],n=[];let i=8;for(let r=0;r4?s=vp[r-8+4-1]:0==r&&(s=0),n.push(s);const a=1/(o-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*u),v=new Float32Array(f*d*u),y=new Float32Array(m*d*u);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,p*d*t),v.set(h,f*d*t);const r=[t,t,t,t,t,t];y.set(r,m*d*t)}const _=new jr;_.setAttribute("position",new Er(g,p)),_.setAttribute("uv",new Er(v,f)),_.setAttribute("faceIndex",new Er(y,m)),t.push(_),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pp(t){const e=new Xn(3*gp,3*gp,t);return e.texture.mapping=ct,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Op(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Np(){return new lh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new zn(1,1)},inputEncoding:{value:_p[Ze]},outputEncoding:{value:_p[Ze]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}function Bp(){return new lh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:_p[Ze]},outputEncoding:{value:_p[Ze]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}function Ip(t,e,n,i,r,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new yr(t,e,n,r,o,s)}const Dp=0,kp=1,Up=0,Fp=1,zp=2;function Gp(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Hp(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function jp(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Pl(t,e)}function Vp(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new tl(t)}function Wp(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Pl(t,e)}function qp(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Tl(t)}function Xp(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Tl(t)}function Yp(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Tl(t)}function Jp(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Zn(t,e,n)}function Zp(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Er(t,e).setUsage(Tn)}function Kp(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Sr(t,e)}function Qp(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Tr(t,e)}function $p(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Ar(t,e)}function tf(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Lr(t,e)}function ef(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Cr(t,e)}function nf(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Rr(t,e)}function rf(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Pr(t,e)}function of(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Or(t,e)}function sf(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Nr(t,e)}function af(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),$h.call(this,t),this.type="catmullrom",this.closed=!0}function lf(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),$h.call(this,t),this.type="catmullrom"}function cf(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),$h.call(this,t),this.type="catmullrom"}function hf(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new mp(t)}function uf(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new lp(t,e)}function df(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new El(new nc(t.geometry),new ml({color:void 0!==e?e:16777215}))}function pf(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new El(new oh(t.geometry),new ml({color:void 0!==e?e:16777215}))}function ff(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Uh(t)}function mf(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new jh(t)}function gf(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new xo(t,n)}Wh.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Wh.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(uu.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");const e=new Gl;for(let n=0,i=t.length;n{"use strict";n.d(e,{z:()=>r});var i=n(212),r=function(t,e){var n,r,o,s,a,l;void 0===e&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,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.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},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.getPolarAngle=function(){return g.phi},this.getAzimuthalAngle=function(){return g.theta},this.saveState=function(){c.target0.copy(c.target),c.position0.copy(c.object.position),c.zoom0=c.object.zoom},this.reset=function(){c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.zoom=c.zoom0,c.object.updateProjectionMatrix(),c.dispatchEvent(h),c.update(),f=p.NONE},this.update=(n=new i.Vector3,r=(new i.Quaternion).setFromUnitVectors(t.up,new i.Vector3(0,1,0)),o=r.clone().inverse(),s=new i.Vector3,a=new i.Quaternion,l=2*Math.PI,function(){var t=c.object.position;n.copy(t).sub(c.target),n.applyQuaternion(r),g.setFromVector3(n),c.autoRotate&&f===p.NONE&&P(2*Math.PI/60/60*c.autoRotateSpeed),c.enableDamping?(g.theta+=v.theta*c.dampingFactor,g.phi+=v.phi*c.dampingFactor):(g.theta+=v.theta,g.phi+=v.phi);var e=c.minAzimuthAngle,i=c.maxAzimuthAngle;return isFinite(e)&&isFinite(i)&&(e<-Math.PI?e+=l:e>Math.PI&&(e-=l),i<-Math.PI?i+=l:i>Math.PI&&(i-=l),g.theta=e(e+i)/2?Math.max(e,g.theta):Math.min(i,g.theta)),g.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,g.phi)),g.makeSafe(),g.radius*=y,g.radius=Math.max(c.minDistance,Math.min(c.maxDistance,g.radius)),!0===c.enableDamping?c.target.addScaledVector(_,c.dampingFactor):c.target.add(_),n.setFromSpherical(g),n.applyQuaternion(o),t.copy(c.target).add(n),c.object.lookAt(c.target),!0===c.enableDamping?(v.theta*=1-c.dampingFactor,v.phi*=1-c.dampingFactor,_.multiplyScalar(1-c.dampingFactor)):(v.set(0,0,0),_.set(0,0,0)),y=1,!!(b||s.distanceToSquared(c.object.position)>m||8*(1-a.dot(c.object.quaternion))>m)&&(c.dispatchEvent(h),s.copy(c.object.position),a.copy(c.object.quaternion),b=!1,!0)}),this.dispose=function(){c.domElement.removeEventListener("contextmenu",et,!1),c.domElement.removeEventListener("pointerdown",X,!1),c.domElement.removeEventListener("wheel",Z,!1),c.domElement.removeEventListener("touchstart",Q,!1),c.domElement.removeEventListener("touchend",tt,!1),c.domElement.removeEventListener("touchmove",$,!1),c.domElement.ownerDocument.removeEventListener("pointermove",Y,!1),c.domElement.ownerDocument.removeEventListener("pointerup",J,!1),c.domElement.removeEventListener("keydown",K,!1)};var c=this,h={type:"change"},u={type:"start"},d={type:"end"},p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=p.NONE,m=1e-6,g=new i.Spherical,v=new i.Spherical,y=1,_=new i.Vector3,b=!1,x=new i.Vector2,w=new i.Vector2,M=new i.Vector2,E=new i.Vector2,S=new i.Vector2,T=new i.Vector2,A=new i.Vector2,L=new i.Vector2,C=new i.Vector2;function R(){return Math.pow(.95,c.zoomSpeed)}function P(t){v.theta-=t}function O(t){v.phi-=t}var N,B=(N=new i.Vector3,function(t,e){N.setFromMatrixColumn(e,0),N.multiplyScalar(-t),_.add(N)}),I=function(){var t=new i.Vector3;return function(e,n){!0===c.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(c.object.up,t)),t.multiplyScalar(e),_.add(t)}}(),D=function(){var t=new i.Vector3;return function(e,n){var i=c.domElement;if(c.object.isPerspectiveCamera){var r=c.object.position;t.copy(r).sub(c.target);var o=t.length();o*=Math.tan(c.object.fov/2*Math.PI/180),B(2*e*o/i.clientHeight,c.object.matrix),I(2*n*o/i.clientHeight,c.object.matrix)}else c.object.isOrthographicCamera?(B(e*(c.object.right-c.object.left)/c.object.zoom/i.clientWidth,c.object.matrix),I(n*(c.object.top-c.object.bottom)/c.object.zoom/i.clientHeight,c.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),c.enablePan=!1)}}();function k(t){c.object.isPerspectiveCamera?y/=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom*t)),c.object.updateProjectionMatrix(),b=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function U(t){c.object.isPerspectiveCamera?y*=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom/t)),c.object.updateProjectionMatrix(),b=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function F(t){x.set(t.clientX,t.clientY)}function z(t){E.set(t.clientX,t.clientY)}function G(t){if(1==t.touches.length)x.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);x.set(e,n)}}function H(t){if(1==t.touches.length)E.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);E.set(e,n)}}function j(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);A.set(0,i)}function V(t){if(1==t.touches.length)w.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);w.set(e,n)}M.subVectors(w,x).multiplyScalar(c.rotateSpeed);var i=c.domElement;P(2*Math.PI*M.x/i.clientHeight),O(2*Math.PI*M.y/i.clientHeight),x.copy(w)}function W(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,n)}T.subVectors(S,E).multiplyScalar(c.panSpeed),D(T.x,T.y),E.copy(S)}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);L.set(0,i),C.set(0,Math.pow(L.y/A.y,c.zoomSpeed)),k(C.y),A.copy(L)}function X(t){if(!1!==c.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var e;switch(t.preventDefault(),c.domElement.focus?c.domElement.focus():window.focus(),t.button){case 0:e=c.mouseButtons.LEFT;break;case 1:e=c.mouseButtons.MIDDLE;break;case 2:e=c.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.MOUSE.DOLLY:if(!1===c.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(t),f=p.DOLLY;break;case i.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enablePan)return;z(t),f=p.PAN}else{if(!1===c.enableRotate)return;F(t),f=p.ROTATE}break;case i.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enableRotate)return;F(t),f=p.ROTATE}else{if(!1===c.enablePan)return;z(t),f=p.PAN}break;default:f=p.NONE}f!==p.NONE&&(c.domElement.ownerDocument.addEventListener("pointermove",Y,!1),c.domElement.ownerDocument.addEventListener("pointerup",J,!1),c.dispatchEvent(u))}(t)}}function Y(t){if(!1!==c.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){if(!1!==c.enabled)switch(t.preventDefault(),f){case p.ROTATE:if(!1===c.enableRotate)return;!function(t){w.set(t.clientX,t.clientY),M.subVectors(w,x).multiplyScalar(c.rotateSpeed);var e=c.domElement;P(2*Math.PI*M.x/e.clientHeight),O(2*Math.PI*M.y/e.clientHeight),x.copy(w),c.update()}(t);break;case p.DOLLY:if(!1===c.enableZoom)return;!function(t){L.set(t.clientX,t.clientY),C.subVectors(L,A),C.y>0?k(R()):C.y<0&&U(R()),A.copy(L),c.update()}(t);break;case p.PAN:if(!1===c.enablePan)return;!function(t){S.set(t.clientX,t.clientY),T.subVectors(S,E).multiplyScalar(c.panSpeed),D(T.x,T.y),E.copy(S),c.update()}(t)}}(t)}}function J(t){if(!1!==c.enabled)switch(t.pointerType){case"mouse":case"pen":!1!==c.enabled&&(c.domElement.ownerDocument.removeEventListener("pointermove",Y,!1),c.domElement.ownerDocument.removeEventListener("pointerup",J,!1),c.dispatchEvent(d),f=p.NONE)}}function Z(t){!1===c.enabled||!1===c.enableZoom||f!==p.NONE&&f!==p.ROTATE||(t.preventDefault(),t.stopPropagation(),c.dispatchEvent(u),function(t){t.deltaY<0?U(R()):t.deltaY>0&&k(R()),c.update()}(t),c.dispatchEvent(d))}function K(t){!1!==c.enabled&&!1!==c.enableKeys&&!1!==c.enablePan&&function(t){var e=!1;switch(t.keyCode){case c.keys.UP:D(0,c.keyPanSpeed),e=!0;break;case c.keys.BOTTOM:D(0,-c.keyPanSpeed),e=!0;break;case c.keys.LEFT:D(c.keyPanSpeed,0),e=!0;break;case c.keys.RIGHT:D(-c.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),c.update())}(t)}function Q(t){if(!1!==c.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(c.touches.ONE){case i.TOUCH.ROTATE:if(!1===c.enableRotate)return;G(t),f=p.TOUCH_ROTATE;break;case i.TOUCH.PAN:if(!1===c.enablePan)return;H(t),f=p.TOUCH_PAN;break;default:f=p.NONE}break;case 2:switch(c.touches.TWO){case i.TOUCH.DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(t){c.enableZoom&&j(t),c.enablePan&&H(t)}(t),f=p.TOUCH_DOLLY_PAN;break;case i.TOUCH.DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(t){c.enableZoom&&j(t),c.enableRotate&&G(t)}(t),f=p.TOUCH_DOLLY_ROTATE;break;default:f=p.NONE}break;default:f=p.NONE}f!==p.NONE&&c.dispatchEvent(u)}}function $(t){if(!1!==c.enabled)switch(t.preventDefault(),t.stopPropagation(),f){case p.TOUCH_ROTATE:if(!1===c.enableRotate)return;V(t),c.update();break;case p.TOUCH_PAN:if(!1===c.enablePan)return;W(t),c.update();break;case p.TOUCH_DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(t){c.enableZoom&&q(t),c.enablePan&&W(t)}(t),c.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(t){c.enableZoom&&q(t),c.enableRotate&&V(t)}(t),c.update();break;default:f=p.NONE}}function tt(t){!1!==c.enabled&&(c.dispatchEvent(d),f=p.NONE)}function et(t){!1!==c.enabled&&t.preventDefault()}c.domElement.addEventListener("contextmenu",et,!1),c.domElement.addEventListener("pointerdown",X,!1),c.domElement.addEventListener("wheel",Z,!1),c.domElement.addEventListener("touchstart",Q,!1),c.domElement.addEventListener("touchend",tt,!1),c.domElement.addEventListener("touchmove",$,!1),c.domElement.addEventListener("keydown",K,!1),-1===c.domElement.tabIndex&&(c.domElement.tabIndex=0),this.update()};r.prototype=Object.create(i.EventDispatcher.prototype),r.prototype.constructor=r;var o=function(t,e){r.call(this,t,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=i.MOUSE.PAN,this.mouseButtons.RIGHT=i.MOUSE.ROTATE,this.touches.ONE=i.TOUCH.PAN,this.touches.TWO=i.TOUCH.DOLLY_ROTATE};(o.prototype=Object.create(i.EventDispatcher.prototype)).constructor=o},225:(t,e,n)=>{"use strict";n.d(e,{G:()=>o});var i=n(212),r=function(t){i.Loader.call(this,t)};r.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:r,load:function(t,e,n,r){var o=this,s=new i.Texture,a=new i.FileLoader(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.setWithCredentials(this.withCredentials),a.load(t,(function(t){s.image=o.parse(t),s.needsUpdate=!0,void 0!==e&&e(s)}),n,r),s},parse:function(t){t.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");var e=new Uint8Array(t),n=0,i={id_length:e[n++],colormap_type:e[n++],image_type:e[n++],colormap_index:e[n++]|e[n++]<<8,colormap_length:e[n++]|e[n++]<<8,colormap_size:e[n++],origin:[e[n++]|e[n++]<<8,e[n++]|e[n++]<<8],width:e[n++]|e[n++]<<8,height:e[n++]|e[n++]<<8,pixel_size:e[n++],flags:e[n++]};!function(t){switch(t.image_type){case 1:case 9:(t.colormap_length>256||24!==t.colormap_size||1!==t.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:t.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".',t.image_type)}(t.width<=0||t.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==t.pixel_size&&16!==t.pixel_size&&24!==t.pixel_size&&32!==t.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',t.pixel_size)}(i),i.id_length+n>t.length&&console.error("THREE.TGALoader: No data."),n+=i.id_length;var r=!1,o=!1,s=!1;switch(i.image_type){case 9:r=!0,o=!0;break;case 1:o=!0;break;case 10:r=!0;break;case 2:break;case 11:r=!0,s=!0;break;case 3:s=!0}var a="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(i.width,i.height):document.createElement("canvas");a.width=i.width,a.height=i.height;var l=a.getContext("2d"),c=l.createImageData(i.width,i.height),h=function(t,e,n,i,r){var o,s,a,l;if(a=n.width*n.height*(s=n.pixel_size>>3),e&&(l=r.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),t){var c,h,u;o=new Uint8Array(a);for(var d=0,p=new Uint8Array(s);d>4){default:case 2:a=0,c=1,u=e,l=0,h=1,d=n;break;case 0:a=0,c=1,u=e,l=n-1,h=-1,d=-1;break;case 3:a=e-1,c=-1,u=-1,l=0,h=1,d=n;break;case 1:a=e-1,c=-1,u=-1,l=n-1,h=-1,d=-1}if(s)switch(i.pixel_size){case 8:!function(t,e,n,r,o,s,a,l){var c,h,u,d=0,p=i.width;for(u=e;u!==r;u+=n)for(h=o;h!==a;h+=s,d++)c=l[d],t[4*(h+p*u)+0]=c,t[4*(h+p*u)+1]=c,t[4*(h+p*u)+2]=c,t[4*(h+p*u)+3]=255}(t,l,h,d,a,c,u,r);break;case 16:!function(t,e,n,r,o,s,a,l){var c,h,u=0,d=i.width;for(h=e;h!==r;h+=n)for(c=o;c!==a;c+=s,u+=2)t[4*(c+d*h)+0]=l[u+0],t[4*(c+d*h)+1]=l[u+0],t[4*(c+d*h)+2]=l[u+0],t[4*(c+d*h)+3]=l[u+1]}(t,l,h,d,a,c,u,r);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(i.pixel_size){case 8:!function(t,e,n,r,o,s,a,l,c){var h,u,d,p=c,f=0,m=i.width;for(d=e;d!==r;d+=n)for(u=o;u!==a;u+=s,f++)h=l[f],t[4*(u+m*d)+3]=255,t[4*(u+m*d)+2]=p[3*h+0],t[4*(u+m*d)+1]=p[3*h+1],t[4*(u+m*d)+0]=p[3*h+2]}(t,l,h,d,a,c,u,r,o);break;case 16:!function(t,e,n,r,o,s,a,l){var c,h,u,d=0,p=i.width;for(u=e;u!==r;u+=n)for(h=o;h!==a;h+=s,d+=2)c=l[d+0]+(l[d+1]<<8),t[4*(h+p*u)+0]=(31744&c)>>7,t[4*(h+p*u)+1]=(992&c)>>2,t[4*(h+p*u)+2]=(31&c)>>3,t[4*(h+p*u)+3]=32768&c?0:255}(t,l,h,d,a,c,u,r);break;case 24:!function(t,e,n,r,o,s,a,l){var c,h,u=0,d=i.width;for(h=e;h!==r;h+=n)for(c=o;c!==a;c+=s,u+=3)t[4*(c+d*h)+3]=255,t[4*(c+d*h)+2]=l[u+0],t[4*(c+d*h)+1]=l[u+1],t[4*(c+d*h)+0]=l[u+2]}(t,l,h,d,a,c,u,r);break;case 32:!function(t,e,n,r,o,s,a,l){var c,h,u=0,d=i.width;for(h=e;h!==r;h+=n)for(c=o;c!==a;c+=s,u+=4)t[4*(c+d*h)+2]=l[u+0],t[4*(c+d*h)+1]=l[u+1],t[4*(c+d*h)+0]=l[u+2],t[4*(c+d*h)+3]=l[u+3]}(t,l,h,d,a,c,u,r);break;default:console.error("THREE.TGALoader: Format not supported.")}}(c.data,i.width,i.height,h.pixel_data,h.palettes),l.putImageData(c,0,0),a}});var o=function(t){i.Loader.call(this,t)};o.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:o,load:function(t,e,n,r){var o=this,s=""===o.path?i.LoaderUtils.extractUrlBase(t):o.path,a=new i.FileLoader(o.manager);a.setPath(o.path),a.setRequestHeader(o.requestHeader),a.setWithCredentials(o.withCredentials),a.load(t,(function(n){try{e(o.parse(n,s))}catch(e){r?r(e):console.error(e),o.manager.itemError(t)}}),n,r)},options:{set convertUpAxis(t){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},parse:function(t,e){function n(t,e){for(var n=[],i=t.childNodes,r=0,o=i.length;r0&&e.push(new i.VectorKeyframeTrack(r+".position",o,s)),a.length>0&&e.push(new i.QuaternionKeyframeTrack(r+".quaternion",o,a)),l.length>0&&e.push(new i.VectorKeyframeTrack(r+".scale",o,l)),e}function E(t,e,n){var i,r,o,s=!0;for(r=0,o=t.length;r=0;){var i=t[e];if(null!==i.value[n])return i;e--}return null}function T(t,e,n){for(;e>>0));switch(n=n.toLowerCase()){case"tga":e=qt;break;default:e=Yt}return e}(n);if(void 0!==o){var s=o.load(n),a=t.extra;if(void 0!==a&&void 0!==a.technique&&!1===c(a.technique)){var l=a.technique;s.wrapS=l.wrapU?i.RepeatWrapping:i.ClampToEdgeWrapping,s.wrapT=l.wrapV?i.RepeatWrapping:i.ClampToEdgeWrapping,s.offset.set(l.offsetU||0,l.offsetV||0),s.repeat.set(l.repeatU||1,l.repeatV||1)}else s.wrapS=i.RepeatWrapping,s.wrapT=i.RepeatWrapping;return s}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",t.id),null}n.name=t.name||"";var l=o.parameters;for(var h in l){var u=l[h];switch(h){case"diffuse":u.color&&n.color.fromArray(u.color),u.texture&&(n.map=a(u.texture));break;case"specular":u.color&&n.specular&&n.specular.fromArray(u.color),u.texture&&(n.specularMap=a(u.texture));break;case"bump":u.texture&&(n.normalMap=a(u.texture));break;case"ambient":u.texture&&(n.lightMap=a(u.texture));break;case"shininess":u.float&&n.shininess&&(n.shininess=u.float);break;case"emission":u.color&&n.emissive&&n.emissive.fromArray(u.color),u.texture&&(n.emissiveMap=a(u.texture))}}var d=l.transparent,p=l.transparency;if(void 0===p&&d&&(p={float:1}),void 0===d&&p&&(d={opaque:"A_ONE",data:{color:[1,1,1,1]}}),d&&p)if(d.data.texture)n.transparent=!0;else{var m=d.data.color;switch(d.opaque){case"A_ONE":n.opacity=m[3]*p.float;break;case"RGB_ZERO":n.opacity=1-m[0]*p.float;break;case"A_ZERO":n.opacity=1-m[3]*p.float;break;case"RGB_ONE":n.opacity=m[0]*p.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',d.opaque)}n.opacity<1&&(n.transparent=!0)}return void 0!==s&&void 0!==s.technique&&1===s.technique.double_sided&&(n.side=i.DoubleSide),n}function Z(t){return f(Qt.materials[t],J)}function K(t){for(var e=0;e0?s+h:s;e.inputs[u]={id:o,offset:c},e.stride=Math.max(e.stride,c+1),"TEXCOORD"===s&&(e.hasUV=!0);break;case"vcount":e.vcount=a(r.textContent);break;case"p":e.p=a(r.textContent)}}return e}function ct(t){for(var e=0,n=0,i=t.length;n0&&e0&&d.setAttribute("position",new i.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&d.setAttribute("normal",new i.Float32BufferAttribute(s.array,s.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=t[0].type,r.materialKeys=p,r}function dt(t,e,n,i){var r=t.p,o=t.stride,s=t.vcount;function a(t){for(var e=r[t+n]*c,o=e+c;e4)for(var v=1,y=p-2;v<=y;v++)f=h+o*v,m=h+o*(v+1),a(h+0*o),a(f),a(m);h+=o*p}else for(u=0,d=r.length;u=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function yt(t){for(var e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]},n=0;nr.limits.max||e{"use strict";n.d(e,{v:()=>r});var i=n(212),r=function(t){i.Loader.call(this,t)};r.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:r,load:function(t,e,n,r){var o=this,s=""===this.path?i.LoaderUtils.extractUrlBase(t):this.path,a=new i.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{e(o.parse(n,s))}catch(e){r?r(e):console.error(e),o.manager.itemError(t)}}),n,r)},setMaterialOptions:function(t){return this.materialOptions=t,this},parse:function(t,e){for(var n=t.split("\n"),i={},o=/\s+/,s={},a=0;a=0?l.substring(0,c):l;h=h.toLowerCase();var u=c>=0?l.substring(c+1):"";if(u=u.trim(),"newmtl"===h)i={name:u},s[u]=i;else if("ka"===h||"kd"===h||"ks"===h||"ke"===h){var d=u.split(o,3);i[h]=[parseFloat(d[0]),parseFloat(d[1]),parseFloat(d[2])]}else i[h]=u}}var p=new r.MaterialCreator(this.resourcePath||e,this.materialOptions);return p.setCrossOrigin(this.crossOrigin),p.setManager(this.manager),p.setMaterials(s),p}}),r.MaterialCreator=function(t,e){this.baseUrl=t||"",this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:i.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:i.RepeatWrapping},r.MaterialCreator.prototype={constructor:r.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(t){return this.crossOrigin=t,this},setManager:function(t){this.manager=t},setMaterials:function(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(t){if(!this.options)return t;var e={};for(var n in t){var i=t[n],r={};for(var o in e[n]=r,i){var s=!0,a=i[o],l=o.toLowerCase();switch(l){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(a=[a[0]/255,a[1]/255,a[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===a[0]&&0===a[1]&&0===a[2]&&(s=!1)}s&&(r[l]=a)}}return e},preload:function(){for(var t in this.materialsInfo)this.create(t)},getIndex:function(t){return this.nameLookup[t]},getAsArray:function(){var t=0;for(var e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray},create:function(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]},createMaterial_:function(t){var e=this,n=this.materialsInfo[t],r={name:t,side:this.side};function o(t,n){if(!r[t]){var i,o,s=e.getTextureParams(n,r),a=e.loadTexture((i=e.baseUrl,"string"!=typeof(o=s.url)||""===o?"":/^https?:\/\//i.test(o)?o:i+o));a.repeat.copy(s.scale),a.offset.copy(s.offset),a.wrapS=e.wrap,a.wrapT=e.wrap,r[t]=a}}for(var s in n){var a,l=n[s];if(""!==l)switch(s.toLowerCase()){case"kd":r.color=(new i.Color).fromArray(l);break;case"ks":r.specular=(new i.Color).fromArray(l);break;case"ke":r.emissive=(new i.Color).fromArray(l);break;case"map_kd":o("map",l);break;case"map_ks":o("specularMap",l);break;case"map_ke":o("emissiveMap",l);break;case"norm":o("normalMap",l);break;case"map_bump":case"bump":o("bumpMap",l);break;case"map_d":o("alphaMap",l),r.transparent=!0;break;case"ns":r.shininess=parseFloat(l);break;case"d":(a=parseFloat(l))<1&&(r.opacity=a,r.transparent=!0);break;case"tr":a=parseFloat(l),this.options&&this.options.invertTrProperty&&(a=1-a),a>0&&(r.opacity=1-a,r.transparent=!0)}}return this.materials[t]=new i.MeshPhongMaterial(r),this.materials[t]},getTextureParams:function(t,e){var n,r={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},o=t.split(/\s+/);return(n=o.indexOf("-bm"))>=0&&(e.bumpScale=parseFloat(o[n+1]),o.splice(n,2)),(n=o.indexOf("-s"))>=0&&(r.scale.set(parseFloat(o[n+1]),parseFloat(o[n+2])),o.splice(n,4)),(n=o.indexOf("-o"))>=0&&(r.offset.set(parseFloat(o[n+1]),parseFloat(o[n+2])),o.splice(n,4)),r.url=o.join(" ").trim(),r},loadTexture:function(t,e,n,r,o){var s,a=void 0!==this.manager?this.manager:i.DefaultLoadingManager,l=a.getHandler(t);return null===l&&(l=new i.TextureLoader(a)),l.setCrossOrigin&&l.setCrossOrigin(this.crossOrigin),s=l.load(t,n,r,o),void 0!==e&&(s.mapping=e),s}}},189:(t,e,n)=>{"use strict";n.d(e,{o:()=>l});var i=n(212);const r=function(){this.logging={enabled:!1,debug:!1};const t=this;this.callbacks={onProgress:function(e){t._onProgress(e)},onAssetAvailable:function(e){t._onAssetAvailable(e)},onError:function(e){t._onError(e)},onLoad:function(e,n){t._onLoad(e,n)}},this.contentRef=null,this.legacyMode=!1,this.materials={},this.materialPerSmoothingGroup=!1,this.useOAsMesh=!1,this.useIndices=!1,this.disregardNormals=!1,this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],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}};r.prototype={constructor:r,_resetRawMesh:function(){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},setMaterialPerSmoothingGroup:function(t){return this.materialPerSmoothingGroup=!0===t,this},setUseOAsMesh:function(t){return this.useOAsMesh=!0===t,this},setUseIndices:function(t){return this.useIndices=!0===t,this},setDisregardNormals:function(t){return this.disregardNormals=!0===t,this},setMaterials:function(t){this.materials=Object.assign({},t)},setCallbackOnAssetAvailable:function(t){return null!=t&&t instanceof Function&&(this.callbacks.onAssetAvailable=t),this},setCallbackOnProgress:function(t){return null!=t&&t instanceof Function&&(this.callbacks.onProgress=t),this},setCallbackOnError:function(t){return null!=t&&t instanceof Function&&(this.callbacks.onError=t),this},setCallbackOnLoad:function(t){return null!=t&&t instanceof Function&&(this.callbacks.onLoad=t),this},_onProgress:function(t){const e=t||"";this.logging.enabled&&this.logging.debug&&console.log(e)},_onError:function(t){this.logging.enabled&&this.logging.debug&&console.error(t)},_onAssetAvailable:function(){const t="OBJLoader2Parser does not provide implementation for onAssetAvailable. Aborting...";throw this.callbacks.onError(t),t},_onLoad:function(t,e){console.log("You reached parser default onLoad callback: "+e)},setLogging:function(t,e){return this.logging.enabled=!0===t,this.logging.debug=!0===e,this},_configure:function(){if(this._pushSmoothingGroup(1),this.logging.enabled){const t=Object.keys(this.materials);let e="OBJLoader.Parser configuration:"+(t.length>0?"\n\tmaterialNames:\n\t\t- "+t.join("\n\t\t- "):"\n\tmaterialNames: None")+"\n\tmaterialPerSmoothingGroup: "+this.materialPerSmoothingGroup+"\n\tuseOAsMesh: "+this.useOAsMesh+"\n\tuseIndices: "+this.useIndices+"\n\tdisregardNormals: "+this.disregardNormals;e+="\n\tcallbacks.onProgress: "+this.callbacks.onProgress.name,e+="\n\tcallbacks.onAssetAvailable: "+this.callbacks.onAssetAvailable.name,e+="\n\tcallbacks.onError: "+this.callbacks.onError.name,console.info(e)}},execute:function(t){this.logging.enabled&&console.time("OBJLoader2Parser.execute"),this._configure();const e=new Uint8Array(t);this.contentRef=e;const n=e.byteLength;this.globalCounts.totalBytes=n;const i=new Array(128);let r,o=0,s=0,a="",l=0;for(;l0&&(i[o++]=a),a="";break;case 47:a.length>0&&(i[o++]=a),s++,a="";break;case 10:this._processLine(i,o,s,a,l),a="",o=0,s=0;break;case 13:break;default:a+=String.fromCharCode(r)}this._processLine(i,o,s,a,l),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.execute")},executeLegacy:function(t){this.logging.enabled&&console.time("OBJLoader2Parser.executeLegacy"),this._configure(),this.legacyMode=!0,this.contentRef=t;const e=t.length;this.globalCounts.totalBytes=e;const n=new Array(128);let i,r=0,o=0,s="",a=0;for(;a0&&(n[r++]=s),s="";break;case"/":s.length>0&&(n[r++]=s),o++,s="";break;case"\n":this._processLine(n,r,o,s,a),s="",r=0,o=0;break;case"\r":break;default:s+=i}this._processLine(n,r,s,o),this._finalizeParsing(),this.logging.enabled&&console.timeEnd("OBJLoader2Parser.executeLegacy")},_processLine:function(t,e,n,i,r){if(this.globalCounts.lineByte=this.globalCounts.currentByte,this.globalCounts.currentByte=r,e<1)return;i.length>0&&(t[e++]=i);const o=function(t,e,n,i){let r="";if(i>n){let o;if(e)for(o=n;o4&&(this.colors.push(parseFloat(t[4])),this.colors.push(parseFloat(t[5])),this.colors.push(parseFloat(t[6])));break;case"vt":this.uvs.push(parseFloat(t[1])),this.uvs.push(parseFloat(t[2]));break;case"vn":this.normals.push(parseFloat(t[1])),this.normals.push(parseFloat(t[2])),this.normals.push(parseFloat(t[3]));break;case"f":if(s=e-1,0===n)for(this._checkFaceType(0),l=2,a=s;l0?o-1:o+r.vertices.length/3),a=r.colors.length>0?s:null;const l=i.vertices;if(l.push(r.vertices[s++]),l.push(r.vertices[s++]),l.push(r.vertices[s]),null!==a){const t=i.colors;t.push(r.colors[a++]),t.push(r.colors[a++]),t.push(r.colors[a])}if(e){const t=parseInt(e);let n=2*(t>0?t-1:t+r.uvs.length/2);const o=i.uvs;o.push(r.uvs[n++]),o.push(r.uvs[n])}if(n&&!r.disregardNormals){const t=parseInt(n);let e=3*(t>0?t-1:t+r.normals.length/3);const o=i.normals;o.push(r.normals[e++]),o.push(r.normals[e++]),o.push(r.normals[e])}};if(this.useIndices){this.disregardNormals&&(n=void 0);const r=t+(e?"_"+e:"_n")+(n?"_"+n:"_n");let s=i.indexMappings[r];null==s?(s=this.rawMesh.subGroupInUse.vertices.length/3,o(),i.indexMappings[r]=s,i.indexMappingsCount++):this.rawMesh.counts.doubleIndicesCount++,i.indices.push(s)}else o();this.rawMesh.counts.faceCount++},_createRawMeshReport:function(t){return"Input Object number: "+t+"\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:function(){const t=[];let e,n,i=0,r=0,o=0,s=0,a=0,l=0;for(const c in this.rawMesh.subGroups)if(e=this.rawMesh.subGroups[c],e.vertices.length>0){if(n=e.indices,n.length>0&&r>0)for(let t=0;t0&&(c={name:""!==this.rawMesh.groupName?this.rawMesh.groupName:this.rawMesh.objectName,subGroups:t,absoluteVertexCount:i,absoluteIndexCount:o,absoluteColorCount:s,absoluteNormalCount:a,absoluteUvCount:l,faceCount:this.rawMesh.counts.faceCount,doubleIndicesCount:this.rawMesh.counts.doubleIndicesCount}),c},_processCompletedMesh:function(){const t=this._finalizeRawMesh(),e=null!==t;if(e){this.colors.length>0&&this.colors.length!==this.vertices.length&&this.callbacks.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(t);const e=this.globalCounts.currentByte/this.globalCounts.totalBytes;this._onProgress("Completed [o: "+this.rawMesh.objectName+" g:"+this.rawMesh.groupName+"] Total progress: "+(100*e).toFixed(2)+"%"),this._resetRawMesh()}return e},_buildMesh:function(t){const e=t.subGroups,n=new Float32Array(t.absoluteVertexCount);this.globalCounts.vertices+=t.absoluteVertexCount/3,this.globalCounts.faces+=t.faceCount,this.globalCounts.doubleIndicesCount+=t.doubleIndicesCount;const i=t.absoluteIndexCount>0?new Uint32Array(t.absoluteIndexCount):null,r=t.absoluteColorCount>0?new Float32Array(t.absoluteColorCount):null,o=t.absoluteNormalCount>0?new Float32Array(t.absoluteNormalCount):null,s=t.absoluteUvCount>0?new Float32Array(t.absoluteUvCount):null,a=null!==r;let l;const c=[],h=e.length>1;let u=0;const d=[];let p,f;const m=[];let g,v,y,_,b=0,x=0,w=0,M=0,E=0,S=0,T=0;for(const t in e)if(e.hasOwnProperty(t)){if(l=e[t],_=l.materialName,y=this.rawMesh.faceType<4?_+(a?"_vertexColor":"")+(0===l.smoothingGroup?"_flat":""):6===this.rawMesh.faceType?"defaultPointMaterial":"defaultLineMaterial",g=this.materials[_],v=this.materials[y],null==g&&null==v&&(y=a?"defaultVertexColorMaterial":"defaultMaterial",v=this.materials[y],this.logging.enabled&&console.info('object_group "'+l.objectName+"_"+l.groupName+'" was defined with unresolvable material "'+_+'"! Assigning "'+y+'".')),null==v){const t={materialNameOrg:_,materialName:y,materialProperties:{vertexColors:a?2:0,flatShading:0===l.smoothingGroup}},e={cmd:"assetAvailable",type:"material",materials:{materialCloneInstructions:t}};this.callbacks.onAssetAvailable(e);null==this.materials[y]&&(this.materials[y]=t)}if(h?(p=d[y],p||(p=u,d[y]=u,c.push(y),u++),T=this.useIndices?l.indices.length:l.vertices.length/3,f={start:S,count:T,index:p},m.push(f),S+=T):c.push(y),n.set(l.vertices,b),b+=l.vertices.length,i&&(i.set(l.indices,x),x+=l.indices.length),r&&(r.set(l.colors,w),w+=l.colors.length),o&&(o.set(l.normals,M),M+=l.normals.length),s&&(s.set(l.uvs,E),E+=l.uvs.length),this.logging.enabled&&this.logging.debug){let t="";p&&(t="\n\t\tmaterialIndex: "+p);const e="\tOutput Object no.: "+this.outputObjectCount+"\n\t\tgroupName: "+l.groupName+"\n\t\tIndex: "+l.index+"\n\t\tfaceType: "+this.rawMesh.faceType+"\n\t\tmaterialName: "+l.materialName+"\n\t\tsmoothingGroup: "+l.smoothingGroup+t+"\n\t\tobjectName: "+l.objectName+"\n\t\t#vertices: "+l.vertices.length/3+"\n\t\t#indices: "+l.indices.length+"\n\t\t#colors: "+l.colors.length/3+"\n\t\t#uvs: "+l.uvs.length/2+"\n\t\t#normals: "+l.normals.length/3;console.debug(e)}}this.outputObjectCount++,this.callbacks.onAssetAvailable({cmd:"assetAvailable",type:"mesh",progress:{numericalValue:this.globalCounts.currentByte/this.globalCounts.totalBytes},params:{meshName:t.name},materials:{multiMaterial:h,materialNames:c,materialGroups:m},buffers:{vertices:n,indices:i,colors:r,normals:o,uvs:s},geometryType:this.rawMesh.faceType<4?0:6===this.rawMesh.faceType?2:1},[n.buffer],null!==i?[i.buffer]:null,null!==r?[r.buffer]:null,null!==o?[o.buffer]:null,null!==s?[s.buffer]:null)},_finalizeParsing:function(){if(this.logging.enabled&&console.info("Global output object count: "+this.outputObjectCount),this._processCompletedMesh()&&this.logging.enabled){const t="Overall counts: \n\tVertices: "+this.globalCounts.vertices+"\n\tFaces: "+this.globalCounts.faces+"\n\tMultiple definitions: "+this.globalCounts.doubleIndicesCount;console.info(t)}}};const o=function(t){this.logging={enabled:!1,debug:!1},this.callbacks={onProgress:null,onMeshAlter:null},this.materialHandler=t};o.prototype={constructor:o,setLogging:function(t,e){this.logging.enabled=!0===t,this.logging.debug=!0===e},_setCallbacks:function(t,e){null!=t&&t instanceof Function&&(this.callbacks.onProgress=t),null!=e&&e instanceof Function&&(this.callbacks.onMeshAlter=e)},buildMeshes:function(t){const e=t.params.meshName,n=t.buffers,r=new i.BufferGeometry;let o,s,a;void 0!==n.vertices&&null!==n.vertices&&r.setAttribute("position",new i.BufferAttribute(new Float32Array(n.vertices),3)),void 0!==n.indices&&null!==n.indices&&r.setIndex(new i.BufferAttribute(new Uint32Array(n.indices),1)),void 0!==n.colors&&null!==n.colors&&r.setAttribute("color",new i.BufferAttribute(new Float32Array(n.colors),3)),void 0!==n.normals&&null!==n.normals?r.setAttribute("normal",new i.BufferAttribute(new Float32Array(n.normals),3)):r.computeVertexNormals(),void 0!==n.uvs&&null!==n.uvs&&r.setAttribute("uv",new i.BufferAttribute(new Float32Array(n.uvs),2)),void 0!==n.skinIndex&&null!==n.skinIndex&&r.setAttribute("skinIndex",new i.BufferAttribute(new Uint16Array(n.skinIndex),4)),void 0!==n.skinWeight&&null!==n.skinWeight&&r.setAttribute("skinWeight",new i.BufferAttribute(new Float32Array(n.skinWeight),4));const l=t.materials.materialNames,c=t.materials.multiMaterial,h=[];for(a in l)s=l[a],o=this.materialHandler.getMaterial(s),c&&h.push(o);if(c){o=h;const e=t.materials.materialGroups;let n;for(a in e)n=e[a],r.addGroup(n.start,n.count,n.index)}const u=[];let d,p,f=!0;const m=null===t.geometryType?0:t.geometryType;if(this.callbacks.onMeshAlter&&(p=this.callbacks.onMeshAlter({detail:{meshName:e,bufferGeometry:r,material:o,geometryType:m}})),p)if(p.isDisregardMesh())f=!1;else if(p.providesAlteredMeshes()){for(const t in p.meshes)u.push(p.meshes[t]);f=!1}f&&(t.computeBoundingSphere&&r.computeBoundingSphere(),d=0===m?new i.Mesh(r,o):1===m?new i.LineSegments(r,o):new i.Points(r,o),d.name=e,u.push(d));let g=t.params.meshName;if(u.length>0){const n=[];for(const t in u)d=u[t],n[t]=d.name;g+=": Adding mesh(es) ("+n.length+": "+n+") from input mesh: "+e,g+=" ("+(100*t.progress.numericalValue).toFixed(2)+"%)"}else g+=": Not adding mesh: "+e,g+=" ("+(100*t.progress.numericalValue).toFixed(2)+"%)";return this.callbacks.onProgress&&this.callbacks.onProgress("progress",g,t.progress.numericalValue),u}};const s=function(t,e){this.disregardMesh=!0===t,this.alteredMesh=!0===e,this.meshes=[]};s.prototype={constructor:s,addMesh:function(t){this.meshes.push(t),this.alteredMesh=!0},isDisregardMesh:function(){return this.disregardMesh},providesAlteredMeshes:function(){return this.alteredMesh}};const a=function(){this.logging={enabled:!1,debug:!1},this.callbacks={onLoadMaterials:null},this.materials={}};a.prototype={constructor:a,setLogging:function(t,e){this.logging.enabled=!0===t,this.logging.debug=!0===e},_setCallbacks:function(t){null!=t&&t instanceof Function&&(this.callbacks.onLoadMaterials=t)},createDefaultMaterials:function(t){const e=new i.MeshStandardMaterial({color:14479871});e.name="defaultMaterial";const n=new i.MeshStandardMaterial({color:14479871});n.name="defaultVertexColorMaterial",n.vertexColors=!0;const r=new i.LineBasicMaterial;r.name="defaultLineMaterial";const o=new i.PointsMaterial({size:.1});o.name="defaultPointMaterial";const s={};s[e.name]=e,s[n.name]=n,s[r.name]=r,s[o.name]=o,this.addMaterials(s,t)},addPayloadMaterials:function(t){let e,n;const r=t.materials.materialCloneInstructions;let o={};if(null!=r){let t=r.materialNameOrg;t=null!=t?t:"";const i=this.materials[t];i?(e=i.clone(),n=r.materialName,e.name=n,Object.assign(e,r.materialProperties),this.materials[n]=e,o[n]=e):this.logging.enabled&&console.info('Requested material "'+t+'" is not available!')}let s=t.materials.serializedMaterials;if(null!=s&&Object.keys(s).length>0){const t=new i.MaterialLoader;let r;for(n in s)r=s[n],null!=r&&(e=t.parse(r),this.logging.enabled&&console.info('De-serialized material with name "'+n+'" will be added.'),this.materials[n]=e,o[n]=e)}return s=t.materials.runtimeMaterials,o=this.addMaterials(s,!0,o),o},addMaterials:function(t,e,n){if(null==n&&(n={}),null!=t&&Object.keys(t).length>0){let i,r,o;for(const s in t)i=t[s],o=!0===e,o||(r=this.materials[s],o=null==r),o&&(this.materials[s]=i,n[s]=i),this.logging.enabled&&this.logging.debug&&console.info('Material with name "'+s+'" was added.')}return this.callbacks.onLoadMaterials&&this.callbacks.onLoadMaterials(n),n},getMaterials:function(){return this.materials},getMaterial:function(t){return this.materials[t]},getMaterialsJSON:function(){const t={};let e;for(const n in this.materials)e=this.materials[n],t[n]=e.toJSON();return t},clearMaterials:function(){this.materials={}}};const l=function(t){i.Loader.call(this,t),this.parser=new r,this.modelName="",this.instanceNo=0,this.baseObject3d=new i.Object3D,this.materialHandler=new a,this.meshReceiver=new o(this.materialHandler);const e=this;this.parser.setCallbackOnAssetAvailable((function(t){e._onAssetAvailable(t)}))};l.OBJLOADER2_VERSION="3.2.0",console.info("Using OBJLoader2 version: "+l.OBJLOADER2_VERSION),l.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:l,setLogging:function(t,e){return this.parser.setLogging(t,e),this},setMaterialPerSmoothingGroup:function(t){return this.parser.setMaterialPerSmoothingGroup(t),this},setUseOAsMesh:function(t){return this.parser.setUseOAsMesh(t),this},setUseIndices:function(t){return this.parser.setUseIndices(t),this},setDisregardNormals:function(t){return this.parser.setDisregardNormals(t),this},setModelName:function(t){return this.modelName=t||this.modelName,this},setBaseObject3d:function(t){return this.baseObject3d=null==t?this.baseObject3d:t,this},addMaterials:function(t,e){return this.materialHandler.addMaterials(t,e),this},setCallbackOnAssetAvailable:function(t){return this.parser.setCallbackOnAssetAvailable(t),this},setCallbackOnProgress:function(t){return this.parser.setCallbackOnProgress(t),this},setCallbackOnError:function(t){return this.parser.setCallbackOnError(t),this},setCallbackOnLoad:function(t){return this.parser.setCallbackOnLoad(t),this},setCallbackOnMeshAlter:function(t){return this.meshReceiver._setCallbacks(this.parser.callbacks.onProgress,t),this},setCallbackOnLoadMaterials:function(t){return this.materialHandler._setCallbacks(t),this},load:function(t,e,n,r,o){const s=this;if(!(null!=e&&e instanceof Function)){const t="onLoad is not a function! Aborting...";throw s.parser.callbacks.onError(t),t}this.parser.setCallbackOnLoad(e),null!=r&&r instanceof Function||(r=function(t){let e=t;t.currentTarget&&null!==t.currentTarget.statusText&&(e="Error occurred while downloading!\nurl: "+t.currentTarget.responseURL+"\nstatus: "+t.currentTarget.statusText),s.parser.callbacks.onError(e)}),t||r("An invalid url was provided. Unable to continue!");const a=new URL(t,window.location.href).href;let l=a;const c=a.split("/");if(c.length>2&&(l=c[c.length-1],this.path=c.slice(0,c.length-1).join("/")+"/"),null==n||!(n instanceof Function)){let e=0,i=0;n=function(n){if(n.lengthComputable&&(i=n.loaded/n.total,i>e)){e=i;const n='Download of "'+t+'": '+(100*i).toFixed(2)+"%";s.parser.callbacks.onProgress("progressLoad",n,i)}}}this.setCallbackOnMeshAlter(o);const h=new i.FileLoader(this.manager);h.setPath(this.path||this.resourcePath),h.setResponseType("arraybuffer"),h.load(l,(function(t){s.parser.callbacks.onLoad(s.parse(t),"OBJLoader2#load: Parsing completed")}),n,r)},parse:function(t){if(null==t)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),this.materialHandler.createDefaultMaterials(!1),this.parser.setMaterials(this.materialHandler.getMaterials()),t instanceof ArrayBuffer||t instanceof Uint8Array?(this.parser.logging.enabled&&console.info("Parsing arrayBuffer..."),this.parser.execute(t)):"string"==typeof t||t instanceof String?(this.parser.logging.enabled&&console.info("Parsing text..."),this.parser.executeLegacy(t)):this.parser.callbacks.onError("Provided content was neither of type String nor Uint8Array! Aborting..."),this.parser.logging.enabled&&console.timeEnd("OBJLoader parse: "+this.modelName),this.baseObject3d},_onAssetAvailable:function(t){if("assetAvailable"===t.cmd)if("mesh"===t.type){const e=this.meshReceiver.buildMeshes(t);for(const t of e)this.baseObject3d.add(t)}else"material"===t.type&&this.materialHandler.addPayloadMaterials(t)}})},637:(t,e,n)=>{"use strict";n.d(e,{j:()=>r});var i=n(212),r=function(t){i.Loader.call(this,t)};r.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:r,load:function(t,e,n,r){var o=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(o.parse(n))}catch(e){r?r(e):console.error(e),o.manager.itemError(t)}}),n,r)},parse:function(t){function e(t,e,n){for(var i=0,r=t.length;i>5&31)/31,r=(w>>10&31)/31):(e=s,n=a,r=l)}for(var M=1;M<=3;M++){var E=y+12*M,S=3*v*3+3*(M-1);m[S]=h.getFloat32(E,!0),m[S+1]=h.getFloat32(E+4,!0),m[S+2]=h.getFloat32(E+8,!0),g[S]=_,g[S+1]=b,g[S+2]=x,d&&(o[S]=e,o[S+1]=n,o[S+2]=r)}}return f.setAttribute("position",new i.BufferAttribute(m,3)),f.setAttribute("normal",new i.BufferAttribute(g,3)),d&&(f.setAttribute("color",new i.BufferAttribute(o,3)),f.hasColors=!0,f.alpha=c),f}(r):function(t){for(var e,n=new i.BufferGeometry,r=/solid([\s\S]*?)endsolid/g,o=/facet([\s\S]*?)endfacet/g,s=0,a=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,l=new RegExp("vertex"+a+a+a,"g"),c=new RegExp("normal"+a+a+a,"g"),h=[],u=[],d=new i.Vector3,p=0,f=0,m=0;null!==(e=r.exec(t));){f=m;for(var g=e[0];null!==(e=o.exec(g));){for(var v=0,y=0,_=e[0];null!==(e=c.exec(_));)d.x=parseFloat(e[1]),d.y=parseFloat(e[2]),d.z=parseFloat(e[3]),y++;for(;null!==(e=l.exec(_));)h.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),u.push(d.x,d.y,d.z),v++,m++;1!==y&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==v&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}var b=f,x=m-f;n.addGroup(b,x,p),p++}return n.setAttribute("position",new i.Float32BufferAttribute(h,3)),n.setAttribute("normal",new i.Float32BufferAttribute(u,3)),n}("string"!=typeof(n=t)?i.LoaderUtils.decodeText(new Uint8Array(n)):n)}})},223:(t,e,n)=>{"use strict";n.d(e,{e:()=>r});var i=n(864);const r={link:function(t,e){"function"==typeof e.addMaterials&&e.addMaterials(this.addMaterialsFromMtlLoader(t),!0)},addMaterialsFromMtlLoader:function(t){let e={};return t instanceof i.v.MaterialCreator&&(t.preload(),e=t.materials),e}}},678:(t,e,n)=>{"use strict";n.d(e,{O:()=>r});var i=n(212),r={computeTangents:function(t){var e=t.index,n=t.attributes;if(null!==e&&void 0!==n.position&&void 0!==n.normal&&void 0!==n.uv){var r=e.array,o=n.position.array,s=n.normal.array,a=n.uv.array,l=o.length/3;void 0===n.tangent&&t.setAttribute("tangent",new i.BufferAttribute(new Float32Array(4*l),4));for(var c=n.tangent.array,h=[],u=[],d=0;d[])));var m=Math.log10(1/e),g=Math.pow(10,m);for(p=0;p{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Viewer:()=>Viewer,THREE:()=>THREE});var three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(678),three_examples_jsm_loaders_OBJLoader2_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(189),three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(225),three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(864),three_examples_jsm_loaders_obj2_bridge_MtlObjBridge_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(223),three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(637),three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(886),THREE=__webpack_require__(212),msgpack=__webpack_require__(374),dat=__webpack_require__(376).ZP;function merge_geometries(t,e=!1){let n=[],i=[],r=t.matrix.clone();!function t(e,r){let o=r.clone().multiply(e.matrix);"Mesh"===e.type&&(e.geometry.applyMatrix(o),i.push(e.geometry),n.push(e.material));for(let n of e.children)t(n,o)}(t,r);let o=null;return 1==i.length?(o=i[0],e&&(o.material=n[0])):i.length>1?(o=three_examples_jsm_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_0__.O.mergeBufferGeometries(i,!0),e&&(o.material=n)):o=new THREE.BufferGeometry,o}function handle_special_texture(t){if("_text"==t.type){let e=document.createElement("canvas");e.width=256,e.height=256;let n=e.getContext("2d");n.textAlign="center";let i=t.font_size;for(n.font=i+"px "+t.font_face;n.measureText(t.text).width>e.width;)i--,n.font=i+"px "+t.font_face;n.fillText(t.text,e.width/2,e.height/2);let r=new THREE.CanvasTexture(e);return r.uuid=t.uuid,r}return null}function handle_special_geometry(t){if("_meshfile"==t.type&&(console.warn("_meshfile is deprecated. Please use _meshfile_geometry for geometries and _meshfile_object for objects with geometry and material"),t.type="_meshfile_geometry"),"_meshfile_geometry"==t.type){if("obj"==t.format){let e=merge_geometries((new three_examples_jsm_loaders_OBJLoader2_js__WEBPACK_IMPORTED_MODULE_1__.o).parse(t.data+"\n"));return e.uuid=t.uuid,e}if("dae"==t.format){let e=merge_geometries((new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_2__.G).parse(t.data).scene);return e.uuid=t.uuid,e}if("stl"==t.format){let e=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(t.data.buffer);return e.uuid=t.uuid,e}return console.error("Unsupported mesh type:",t),null}return null}__webpack_require__(583);class ExtensibleObjectLoader extends THREE.ObjectLoader{delegate(t,e,n,i){let r={};if(void 0===n)return r;let o=[];for(let e of n){let n=t(e);null!==n?r[n.uuid]=n:o.push(e)}return Object.assign(r,e(o,i))}parseTextures(t,e){return this.delegate(handle_special_texture,super.parseTextures,t,e)}parseGeometries(t,e){return this.delegate(handle_special_geometry,super.parseGeometries,t,e)}parseObject(t,e,n){if("_meshfile_object"==t.type){let e,n,i=new THREE.LoadingManager,r=void 0===t.url?void 0:THREE.LoaderUtils.extractUrlBase(t.url);if(i.setURLModifier((e=>void 0!==t.resources[e]?t.resources[e]:e)),"obj"==t.format){let o=new three_examples_jsm_loaders_OBJLoader2_js__WEBPACK_IMPORTED_MODULE_1__.o(i);if(t.mtl_library){let e=new three_examples_jsm_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_3__.v(i).parse(t.mtl_library+"\n",""),n=three_examples_jsm_loaders_obj2_bridge_MtlObjBridge_js__WEBPACK_IMPORTED_MODULE_4__.e.addMaterialsFromMtlLoader(e);o.addMaterials(n),this.onTextureLoad()}e=merge_geometries(o.parse(t.data+"\n",r),!0),e.uuid=t.uuid,n=e.material}else if("dae"==t.format){let o=new three_examples_jsm_loaders_ColladaLoader_js__WEBPACK_IMPORTED_MODULE_2__.G(i);o.onTextureLoad=this.onTextureLoad,e=merge_geometries(o.parse(t.data,r).scene,!0),e.uuid=t.uuid,n=e.material}else{if("stl"!=t.format)return console.error("Unsupported mesh type:",t),null;e=(new three_examples_jsm_loaders_STLLoader_js__WEBPACK_IMPORTED_MODULE_5__.j).parse(t.data.buffer,r),e.uuid=t.uuid,n=e.material}let o=new THREE.Mesh(e,n);return o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userjson&&(o.userjson=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),o}return super.parseObject(t,e,n)}}class SceneNode{constructor(t,e,n){this.object=t,this.folder=e,this.children={},this.controllers=[],this.on_update=n,this.create_controls();for(let t of this.object.children)this.add_child(t)}add_child(t){let e=this.folder.addFolder(t.name),n=new SceneNode(t,e,this.on_update);return this.children[t.name]=n,n}create_child(t){let e=new THREE.Group;return e.name=t,this.object.add(e),this.add_child(e)}find(t){if(0==t.length)return this;{let e=t[0],n=this.children[e];return void 0===n&&(n=this.create_child(e)),n.find(t.slice(1))}}create_controls(){for(let t of this.controllers)this.folder.remove(t);if(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",(t=>{t.target.checked?this.folder.domElement.classList.remove("meshcat-hidden-scene-element"):this.folder.domElement.classList.add("meshcat-hidden-scene-element")})),this.object.isLight){let t=this.folder.add(this.object,"intensity").min(0).step(.01);if(t.onChange((()=>this.on_update())),this.controllers.push(t),void 0!==this.object.castShadow){let t=this.folder.add(this.object,"castShadow");if(t.onChange((()=>this.on_update())),this.controllers.push(t),void 0!==this.object.shadow){let t=this.folder.add(this.object.shadow,"radius").min(0).step(.05).max(3);t.onChange((()=>this.on_update())),this.controllers.push(t)}}if(void 0!==this.object.distance){let t=this.folder.add(this.object,"distance").min(0).step(.1).max(100);t.onChange((()=>this.on_update())),this.controllers.push(t)}}if(this.object.isCamera){let t=this.folder.add(this.object,"zoom").min(0).step(.1);t.onChange((()=>{this.on_update()})),this.controllers.push(t)}}set_property(t,e){if("position"===t)this.object.position.set(e[0],e[1],e[2]);else if("quaternion"===t)this.object.quaternion.set(e[0],e[1],e[2],e[3]);else if("scale"===t)this.object.scale.set(e[0],e[1],e[2]);else if("color"===t){function t(e,n){if(e.material){e.material.color.setRGB(n[0],n[1],n[2]);let t=n[3];e.material.opacity=t,e.material.transparent=1!=t}for(let i of e.children)t(i,n)}t(this.object,e)}else this.object[t]="top_color"==t||"bottom_color"==t?e.map((t=>255*t)):e;this.vis_controller.updateDisplay(),this.controllers.forEach((t=>t.updateDisplay()))}set_transform(t){let e=new THREE.Matrix4;e.fromArray(t),e.decompose(this.object.position,this.object.quaternion,this.object.scale)}set_object(t){let e=this.object.parent;this.dispose_recursive(),this.object.parent.remove(this.object),this.object=t,e.add(t),this.create_controls()}dispose_recursive(){for(let t of Object.keys(this.children))this.children[t].dispose_recursive();dispose(this.object)}delete(t){if(0==t.length)console.error("Can't delete an empty path");else{let e=this.find(t.slice(0,t.length-1)),n=t[t.length-1],i=e.children[n];void 0!==i&&(i.dispose_recursive(),e.object.remove(i.object),remove_folders(i.folder),e.folder.removeFolder(i.folder),delete e.children[n])}}}function remove_folders(t){for(let e of Object.keys(t.__folders)){let n=t.__folders[e];remove_folders(n),dat.dom.dom.unbind(window,"resize",n.__resizeHandler),t.removeFolder(n)}}function dispose(t){if(t&&(t.geometry&&t.geometry.dispose(),t.material))if(Array.isArray(t.material))for(let e of t.material)e.map&&e.map.dispose(),e.dispose();else t.material.map&&t.material.map.dispose(),t.material.dispose()}function create_default_scene(){var t=new THREE.Scene;return t.name="Scene",t.rotateX(-Math.PI/2),t}function download_data_uri(t,e){let n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function download_file(t,e,n){n=n||"text/plain";let i=new Blob([e],{type:n}),r=document.createElement("a");document.body.appendChild(r),r.download=t,r.href=window.URL.createObjectURL(i),r.onclick=function(t){let e=this;setTimeout((function(){window.URL.revokeObjectURL(e.href)}),1500)},r.click(),r.remove()}class Animator{constructor(t){this.viewer=t,this.folder=this.viewer.gui.addFolder("Animations"),this.mixer=new THREE.AnimationMixer,this.loader=new THREE.ObjectLoader,this.clock=new THREE.Clock,this.actions=[],this.playing=!1,this.time=0,this.time_scrubber=null,this.setup_capturer("png"),this.duration=0}setup_capturer(t){this.capturer=new window.CCapture({format:t,name:"meshcat_"+String(Date.now())}),this.capturer.format=t}play(){this.clock.start();for(let t of this.actions)t.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(t){this.time=t,null!==this.time_scrubber&&this.time_scrubber.updateDisplay()}seek(t){this.actions.forEach((e=>{e.time=Math.max(0,Math.min(e._clip.duration,t))})),this.mixer.update(0),this.viewer.set_dirty()}reset(){for(let t of this.actions)t.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.AnimationMixer}load(t,e){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((t=>this.seek(t))),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((t=>{this.setup_capturer(t)})),void 0===e.play&&(e.play=!0),void 0===e.loopMode&&(e.loopMode=THREE.LoopRepeat),void 0===e.repetitions&&(e.repetitions=1),void 0===e.clampWhenFinished&&(e.clampWhenFinished=!0),this.duration=0,this.progress=0;for(let n of t){let t=this.viewer.scene_tree.find(n.path).object,i=this.loader.parseAnimations([n.clip]),r=Object.values(i)[0],o=this.mixer.clipAction(r,t);o.clampWhenFinished=e.clampWhenFinished,o.setLoop(e.loopMode,e.repetitions),this.actions.push(o),this.duration=Math.max(this.duration,r.duration)}this.time_scrubber.min(0),this.time_scrubber.max(this.duration),this.reset(),e.play&&this.play()}update(){if(this.playing){if(this.mixer.update(this.clock.getDelta()),this.viewer.set_dirty(),0!=this.duration){let t=this.actions.reduce(((t,e)=>Math.max(t,e.time)),0);this.display_progress(t)}else this.display_progress(0);if(this.actions.every((t=>t.paused))){this.pause();for(let t of this.actions)t.reset()}}}after_render(){this.recording&&this.capturer.capture(this.viewer.renderer.domElement)}}function gradient_texture(t,e){let n=[e,t];var i=new Uint8Array(6);for(let t=0;t<2;t++){let e=n[t];for(let n=0;n<1;n++){let r=3*(1*t+n);for(let t=0;t<3;t++)i[r+t]=e[t]}}var r=new THREE.DataTexture(i,1,2,THREE.RGBFormat);return r.magFilter=THREE.LinearFilter,r.encoding=THREE.LinearEncoding,r.matrixAutoUpdate=!1,r.matrix.set(.5,0,.25,0,.5,.25,0,0,1),r.needsUpdate=!0,r}class Viewer{constructor(t,e,n){this.dom_element=t,void 0===n?(this.renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=THREE.PCFSoftShadowMap,this.dom_element.appendChild(this.renderer.domElement)):this.renderer=n,this.scene=create_default_scene(),this.gui_controllers={},this.create_scene_tree(),this.add_default_scene_elements(),this.set_dirty(),this.create_camera(),this.num_messages_received=0,window.onload=t=>this.set_3d_pane_size(),window.addEventListener("resize",(t=>this.set_3d_pane_size()),!1),requestAnimationFrame((()=>this.set_3d_pane_size())),(e||void 0===e)&&this.animate()}hide_background(){this.scene.background=null,this.set_dirty()}show_background(){var t=this.scene_tree.find(["Background"]).object.top_color,e=this.scene_tree.find(["Background"]).object.bottom_color;this.scene.background=gradient_texture(t,e),this.set_dirty()}set_dirty(){this.needs_render=!0}create_camera(){let t=new THREE.Matrix4;t.makeRotationX(Math.PI/2),this.set_transform(["Cameras","default","rotated"],t.toArray());let e=new THREE.PerspectiveCamera(75,1,.01,100);this.set_camera(e),this.set_object(["Cameras","default","rotated"],e),e.position.set(3,1,0)}create_default_spot_light(){var t=new THREE.SpotLight(16777215,.8);return t.position.set(1.5,1.5,2),t.castShadow=!1,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,t.shadow.camera.near=.5,t.shadow.camera.far=50,t.shadow.bias=-.001,t}add_default_scene_elements(){var t=this.create_default_spot_light();this.set_object(["Lights","SpotLight"],t),this.set_property(["Lights","SpotLight"],"visible",!1);var e=new THREE.PointLight(16777215,.4);e.position.set(1.5,1.5,2),e.castShadow=!1,e.distance=10,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024,e.shadow.camera.near=.5,e.shadow.camera.far=10,e.shadow.bias=-.001,this.set_object(["Lights","PointLightNegativeX"],e);var n=new THREE.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.AmbientLight(16777215,.3);i.intensity=.6,this.set_object(["Lights","AmbientLight"],i);var r=new THREE.DirectionalLight(16777215,.4);r.position.set(-10,-10,0),this.set_object(["Lights","FillLight"],r);var o=new THREE.GridHelper(20,40);o.rotateX(Math.PI/2),this.set_object(["Grid"],o);var s=new THREE.AxesHelper(.5);this.set_object(["Axes"],s)}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 t=this.gui.addFolder("Scene");t.open(),this.scene_tree=new SceneNode(this.scene,t,(()=>this.set_dirty()));let e=this.gui.addFolder("Save / Load / Capture");e.add(this,"save_scene"),e.add(this,"load_scene"),e.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(t,e){void 0===t&&(t=this.dom_element.offsetWidth),void 0===e&&(e=window.innerHeight),"OrthographicCamera"==this.camera.type?this.camera.right=this.camera.left+t*(this.camera.top-this.camera.bottom)/e:this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),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(){return this.render(),this.renderer.domElement.toDataURL()}save_image(){download_data_uri("meshcat.png",this.capture_image())}set_camera(t){this.camera=t,this.controls=new three_examples_jsm_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_6__.z(t,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_from_json(t){(new ExtensibleObjectLoader).parse(t,(t=>{this.set_camera(t)}))}set_transform(t,e){this.scene_tree.find(t).set_transform(e)}set_object(t,e){this.scene_tree.find(t.concat([""])).set_object(e)}set_object_from_json(t,e){let n=new ExtensibleObjectLoader;n.onTextureLoad=()=>{this.set_dirty()},n.parse(e,(e=>{void 0!==e.geometry&&"BufferGeometry"==e.geometry.type?void 0!==e.geometry.attributes.normal&&0!==e.geometry.attributes.normal.count||e.geometry.computeVertexNormals():e.type.includes("Camera")&&(this.set_camera(e),this.set_3d_pane_size()),e.castShadow=!0,e.receiveShadow=!0,this.set_object(t,e),this.set_dirty()}))}delete_path(t){0==t.length?console.error("Deleting the entire scene is not implemented"):this.scene_tree.delete(t)}set_property(t,e,n){this.scene_tree.find(t).set_property(e,n),"Background"===t[0]&&this.scene_tree.find(t).on_update()}set_animation(t,e){e=e||{},this.animator.load(t,e)}set_control(name,callback,value,min,max,step){let handler={};name in this.gui_controllers&&this.gui.remove(this.gui_controllers[name]),void 0!==value?(handler[name]=value,this.gui_controllers[name]=this.gui.add(handler,name,min,max,step),this.gui_controllers[name].onChange(eval(callback))):(handler[name]=eval(callback),this.gui_controllers[name]=this.gui.add(handler,name))}set_control_value(t,e){t in this.gui_controllers&&this.gui_controllers[t]instanceof dat.controllers.NumberController&&(this.gui_controllers[t].setValue(e),this.gui_controllers[t].updateDisplay())}delete_control(t){t in this.gui_controllers&&(this.gui.remove(this.gui_controllers[t]),delete this.gui_controllers[t])}handle_command(t){if("set_transform"==t.type){let e=split_path(t.path);this.set_transform(e,t.matrix)}else if("delete"==t.type){let e=split_path(t.path);this.delete_path(e)}else if("set_object"==t.type){let e=split_path(t.path);this.set_object_from_json(e,t.object)}else if("set_property"==t.type){let e=split_path(t.path);this.set_property(e,t.property,t.value)}else if("set_animation"==t.type)t.animations.forEach((t=>{t.path=split_path(t.path)})),this.set_animation(t.animations,t.options);else if("set_control"==t.type)this.set_control(t.name,t.callback,t.value,t.min,t.max,t.step);else if("set_control_value"==t.type)this.set_control_value(t.name,t.value);else if("delete_control"==t.type)this.delete_control(t.name);else if("capture_image"==t.type){let t=this.capture_image();this.connection.send(JSON.stringify({type:"img",data:t}))}else"save_image"==t.type&&this.save_image();this.set_dirty()}handle_command_bytearray(t){let e=msgpack.decode(t);this.handle_command(e)}handle_command_message(t){this.num_messages_received++,this.handle_command_bytearray(new Uint8Array(t.data))}connect(t){void 0===t&&(t=`ws://${location.host}`),"https:"==location.protocol&&(t=t.replace("ws:","wss:")),this.connection=new WebSocket(t),this.connection.binaryType="arraybuffer",this.connection.onmessage=t=>this.handle_command_message(t),this.connection.onclose=function(t){console.log("onclose:",t)}}save_scene(){download_file("scene.json",JSON.stringify(this.scene.toJSON()))}load_scene_from_json(t){let e=new ExtensibleObjectLoader;e.onTextureLoad=()=>{this.set_dirty()},this.scene_tree.dispose_recursive(),this.scene=e.parse(t),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(t){let e=t.files[0];if(!e)return;let n=new FileReader,i=this;n.onload=function(t){let e=this.result,n=JSON.parse(e);i.load_scene_from_json(n)},n.readAsText(e)}load_scene(){let t=document.createElement("input");t.type="file",document.body.appendChild(t);let e=this;t.addEventListener("change",(function(){console.log(this,e),e.handle_load_file(this)}),!1),t.click(),t.remove()}}function split_path(t){return t.split("/").filter((t=>t.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 diff --git a/package.json b/package.json index 32f171f..11208d2 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,7 @@ "ccapture.js": "aceslowman/ccapture.js#npm-fix", "dat.gui": "^0.7.7", "msgpack-lite": "^0.1.26", - "three": "^0.131.1", - "three-wtm": "^1.0", - "wwobjloader2": "^4.0" + "three": "0.122" }, "scripts": { "build": "webpack" diff --git a/src/index.js b/src/index.js index db9e80d..d8b8d8a 100644 --- a/src/index.js +++ b/src/index.js @@ -2,9 +2,10 @@ var THREE = require('three'); var msgpack = require('msgpack-lite'); var dat = require('dat.gui').default; // TODO: why is .default needed? import {BufferGeometryUtils} from 'three/examples/jsm/utils/BufferGeometryUtils.js'; -import {OBJLoader2, MtlObjBridge} from 'wwobjloader2' +import {OBJLoader2} from 'three/examples/jsm/loaders/OBJLoader2.js'; import {ColladaLoader} from 'three/examples/jsm/loaders/ColladaLoader.js'; import {MTLLoader} from 'three/examples/jsm/loaders/MTLLoader.js'; +import {MtlObjBridge} from 'three/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js'; import {STLLoader} from 'three/examples/jsm/loaders/STLLoader.js'; import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js'; require('ccapture.js'); @@ -20,7 +21,7 @@ function merge_geometries(object, preserve_materials = false) { function collectGeometries(node, parent_transform) { let transform = parent_transform.clone().multiply(node.matrix); if (node.type==='Mesh') { - node.geometry.applyMatrix4(transform); + node.geometry.applyMatrix(transform); geometries.push(node.geometry); materials.push(node.material); } @@ -175,7 +176,7 @@ class ExtensibleObjectLoader extends THREE.ObjectLoader { let mtl_loader = new MTLLoader(manager); let mtl_parse_result = mtl_loader.parse(json.mtl_library + "\n", ""); let materials = MtlObjBridge.addMaterialsFromMtlLoader(mtl_parse_result); - loader.setMaterials(materials); + loader.addMaterials(materials); this.onTextureLoad(); } let obj = loader.parse(json.data + "\n", path); @@ -628,7 +629,8 @@ class Animator { this.progress = 0; for (let animation of animations) { let target = this.viewer.scene_tree.find(animation.path).object; - let clip = Object.values(this.loader.parseAnimations([animation.clip]))[0]; + let animations = this.loader.parseAnimations([animation.clip]); + let clip = Object.values(animations)[0]; let action = this.mixer.clipAction(clip, target); action.clampWhenFinished = options.clampWhenFinished; action.setLoop(options.loopMode, options.repetitions); diff --git a/test/animation.html b/test/animation.html index b2626cf..2c4a334 100644 --- a/test/animation.html +++ b/test/animation.html @@ -8,7 +8,7 @@
- +