aframe-globe-component
Version:
A 3D Globe component for A-Frame.
2 lines • 908 kB
JavaScript
/*! For license information please see aframe-globe-component.min.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(()=>(()=>{var t={539:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},296:t=>{function e(t,e,n){var r,i,a,o,A;function s(){var l=Date.now()-o;l<e&&l>=0?r=setTimeout(s,e-l):(r=null,n||(A=t.apply(a,i),a=i=null))}null==e&&(e=100);var l=function(){a=this,i=arguments,o=Date.now();var l=n&&!r;return r||(r=setTimeout(s,e)),l&&(A=t.apply(a,i),a=i=null),A};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(A=t.apply(a,i),a=i=null,clearTimeout(r),r=null)},l}e.debounce=e,t.exports=e},187:t=>{"use strict";function e(t,e,r){r=r||2;var a,o,A,s,c,h,d,p=e&&e.length,m=p?e[0]*r:t.length,g=n(t,0,m,r,!0),v=[];if(!g||g.next===g.prev)return v;if(p&&(g=function(t,e,r,i){var a,o,A,s=[];for(a=0,o=e.length;a<o;a++)(A=n(t,e[a]*i,a<o-1?e[a+1]*i:t.length,i,!1))===A.next&&(A.steiner=!0),s.push(f(A));for(s.sort(l),a=0;a<s.length;a++)r=u(s[a],r);return r}(t,e,g,r)),t.length>80*r){a=A=t[0],o=s=t[1];for(var _=r;_<m;_+=r)(c=t[_])<a&&(a=c),(h=t[_+1])<o&&(o=h),c>A&&(A=c),h>s&&(s=h);d=0!==(d=Math.max(A-a,s-o))?32767/d:0}return i(g,v,r,a,o,d,0),v}function n(t,e,n,r,i){var a,o;if(i===E(t,e,n,r)>0)for(a=e;a<n;a+=r)o=w(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=w(a,t[a],t[a+1],o);return o&&g(o,o.next)&&(M(o),o=o.next),o}function r(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!g(r,r.next)&&0!==m(r.prev,r,r.next))r=r.next;else{if(M(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function i(t,e,n,l,u,c,f){if(t){!f&&c&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=h(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,A,s,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,A=0,e=0;e<l&&(A++,r=r.nextZ);e++);for(s=l;A>0||s>0&&r;)0!==A&&(0===s||!r||n.z<=r.z)?(i=n,n=n.nextZ,A--):(i=r,r=r.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,l,u,c);for(var d,p,m=t;t.prev!==t.next;)if(d=t.prev,p=t.next,c?o(t,l,u,c):a(t))e.push(d.i/n|0),e.push(t.i/n|0),e.push(p.i/n|0),M(t),t=p.next,m=p.next;else if((t=p)===m){f?1===f?i(t=A(r(t),e,n),e,n,l,u,c,2):2===f&&s(t,e,n,l,u,c):i(r(t),e,n,l,u,c,1);break}}}function a(t){var e=t.prev,n=t,r=t.next;if(m(e,n,r)>=0)return!1;for(var i=e.x,a=n.x,o=r.x,A=e.y,s=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,c=A<s?A<l?A:l:s<l?s:l,h=i>a?i>o?i:o:a>o?a:o,f=A>s?A>l?A:l:s>l?s:l,p=r.next;p!==e;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=f&&d(i,A,a,s,o,l,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){var i=t.prev,a=t,o=t.next;if(m(i,a,o)>=0)return!1;for(var A=i.x,s=a.x,l=o.x,u=i.y,c=a.y,f=o.y,p=A<s?A<l?A:l:s<l?s:l,g=u<c?u<f?u:f:c<f?c:f,v=A>s?A>l?A:l:s>l?s:l,_=u>c?u>f?u:f:c>f?c:f,x=h(p,g,e,n,r),y=h(v,_,e,n,r),b=t.prevZ,w=t.nextZ;b&&b.z>=x&&w&&w.z<=y;){if(b.x>=p&&b.x<=v&&b.y>=g&&b.y<=_&&b!==i&&b!==o&&d(A,u,s,c,l,f,b.x,b.y)&&m(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=p&&w.x<=v&&w.y>=g&&w.y<=_&&w!==i&&w!==o&&d(A,u,s,c,l,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=x;){if(b.x>=p&&b.x<=v&&b.y>=g&&b.y<=_&&b!==i&&b!==o&&d(A,u,s,c,l,f,b.x,b.y)&&m(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=y;){if(w.x>=p&&w.x<=v&&w.y>=g&&w.y<=_&&w!==i&&w!==o&&d(A,u,s,c,l,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function A(t,e,n){var i=t;do{var a=i.prev,o=i.next.next;!g(a,o)&&v(a,i,i.next,o)&&y(a,o)&&y(o,a)&&(e.push(a.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),M(i),M(i.next),i=t=o),i=i.next}while(i!==t);return r(i)}function s(t,e,n,a,o,A){var s=t;do{for(var l=s.next.next;l!==s.prev;){if(s.i!==l.i&&p(s,l)){var u=b(s,l);return s=r(s,s.next),u=r(u,u.next),i(s,e,n,a,o,A,0),void i(u,e,n,a,o,A,0)}l=l.next}s=s.next}while(s!==t)}function l(t,e){return t.x-e.x}function u(t,e){var n=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var A=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(A<=i&&A>o&&(o=A,n=r.x<r.next.x?r:r.next,A===i))return n}r=r.next}while(r!==e);if(!n)return null;var s,l=n,u=n.x,h=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&d(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&(s=Math.abs(a-r.y)/(i-r.x),y(r,t)&&(s<f||s===f&&(r.x>n.x||r.x===n.x&&c(n,r)))&&(n=r,f=s)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var i=b(n,t);return r(i,i.next),r(n,n.next)}function c(t,e){return m(t.prev,t,e.prev)<0&&m(e.next,t,t.next)<0}function h(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function d(t,e,n,r,i,a,o,A){return(i-o)*(e-A)>=(t-o)*(a-A)&&(t-o)*(r-A)>=(n-o)*(e-A)&&(n-o)*(a-A)>=(i-o)*(r-A)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&v(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(y(t,e)&&y(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(m(t.prev,t,e.prev)||m(t,e.prev,e))||g(t,e)&&m(t.prev,t,t.next)>0&&m(e.prev,e,e.next)>0)}function m(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function v(t,e,n,r){var i=x(m(t,e,n)),a=x(m(t,e,r)),o=x(m(n,r,t)),A=x(m(n,r,e));return i!==a&&o!==A||!(0!==i||!_(t,n,e))||!(0!==a||!_(t,r,e))||!(0!==o||!_(n,t,r))||!(0!==A||!_(n,e,r))}function _(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 x(t){return t>0?1:t<0?-1:0}function y(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function b(t,e){var n=new S(t.i,t.x,t.y),r=new S(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function w(t,e,n,r){var i=new S(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function M(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 S(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}t.exports=e,t.exports.default=e,e.deviation=function(t,e,n,r){var i=e&&e.length,a=i?e[0]*n:t.length,o=Math.abs(E(t,0,a,n));if(i)for(var A=0,s=e.length;A<s;A++){var l=e[A]*n,u=A<s-1?e[A+1]*n:t.length;o-=Math.abs(E(t,l,u,n))}var c=0;for(A=0;A<r.length;A+=3){var h=r[A]*n,f=r[A+1]*n,d=r[A+2]*n;c+=Math.abs((t[h]-t[d])*(t[f+1]-t[h+1])-(t[h]-t[f])*(t[d+1]-t[h+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},e.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)n.vertices.push(t[i][a][o]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}},585:function(t){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=n(1),i=function(){function t(t,e,n){void 0===t&&(t=NaN),void 0===e&&(e=NaN),void 0===n&&(n=!1),this._minFPS=e,this._maxFPS=t,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new r.default,this._onPause=new r.default,this._onTick=new r.default,this._onTickOncePerFrame=new r.default,n||this.resume()}return t.prototype.updateOnce=function(t){t(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},t.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},t.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},t.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(t.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"timeScale",{get:function(){return this._timeScale},set:function(t){this._timeScale!==t&&(this._timeScale=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),t.prototype.animateOnce=function(){var t=this;this._animationFrameHandle=window.requestAnimationFrame((function(){return t.onFrame()}))},t.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},t.prototype.update=function(t,e){void 0===e&&(e=!0),this._currentTick++,this._currentTime+=t,this._tickDeltaTime=t,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),e&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},t.prototype.getTimer=function(){return Date.now()},t}();Object.defineProperty(e,"__esModule",{value:!0}),e.default=i},function(t,e,n){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){"use strict";var n=function(){function t(){this.functions=[]}return t.prototype.add=function(t){return-1===this.functions.indexOf(t)&&(this.functions.push(t),!0)},t.prototype.remove=function(t){var e=this.functions.indexOf(t);return e>-1&&(this.functions.splice(e,1),!0)},t.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.functions.concat().forEach((function(e){e.apply(void 0,t)}))},Object.defineProperty(t.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),t}();Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}])}])},839:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>mg});var r={};n.r(r),n.d(r,{computeMikkTSpaceTangents:()=>Ls,computeMorphedAttributes:()=>Gs,computeTangents:()=>Ps,deepCloneAttribute:()=>Bs,deinterleaveAttribute:()=>ks,deinterleaveGeometry:()=>Ns,estimateBytesUsed:()=>zs,interleaveAttributes:()=>Os,mergeBufferAttributes:()=>Is,mergeBufferGeometries:()=>Rs,mergeGroups:()=>Hs,mergeVertices:()=>Us,toTrianglesDrawMode:()=>Fs});const i=100,a=301,o=302,A=306,s=1e3,l=1001,u=1002,c=1003,h=1006,f=1008,d=1009,p=1014,m=1015,g=1016,v=1020,_=1023,x=1026,y=1027,b=33776,w=33777,M=33778,S=33779,E=2300,T=2301,C=2302,q=3e3,D=3001,P="srgb",L="srgb-linear",R=7680,I=35044,B="300 es",O=1035;class k{addEventListener(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(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(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(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,r=n.length;e<r;e++)n[e].call(this,t);t.target=null}}}const N=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let z=1234567;const U=Math.PI/180,F=180/Math.PI;function G(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(N[255&t]+N[t>>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&n|128]+N[n>>8&255]+"-"+N[n>>16&255]+N[n>>24&255]+N[255&r]+N[r>>8&255]+N[r>>16&255]+N[r>>24&255]).toLowerCase()}function H(t,e,n){return Math.max(e,Math.min(n,t))}function V(t,e){return(t%e+e)%e}function W(t,e,n){return(1-n)*t+n*e}function j(t){return 0==(t&t-1)&&0!==t}function Q(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function X(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Y(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}var Z=Object.freeze({__proto__:null,DEG2RAD:U,RAD2DEG:F,generateUUID:G,clamp:H,euclideanModulo:V,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:W,damp:function(t,e,n,r){return W(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(V(t,2*e)-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){void 0!==t&&(z=t);let e=z+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*U},radToDeg:function(t){return t*F},isPowerOfTwo:j,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:Q,setQuaternionFromProperEuler:function(t,e,n,r,i){const a=Math.cos,o=Math.sin,A=a(n/2),s=o(n/2),l=a((e+r)/2),u=o((e+r)/2),c=a((e-r)/2),h=o((e-r)/2),f=a((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":t.set(A*u,s*c,s*h,A*l);break;case"YZY":t.set(s*h,A*u,s*c,A*l);break;case"ZXZ":t.set(s*c,s*h,A*u,A*l);break;case"XZX":t.set(A*u,s*d,s*f,A*l);break;case"YXY":t.set(s*f,A*u,s*d,A*l);break;case"ZYZ":t.set(s*d,s*f,A*u,A*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:Y,denormalize:X});class J{constructor(t=0,e=0){J.prototype.isVector2=!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){return 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){return 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,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[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){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class K{constructor(){K.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,r,i,a,o,A,s){const l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=A,l[6]=n,l[7]=a,l[8]=s,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}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,r=e.elements,i=this.elements,a=n[0],o=n[3],A=n[6],s=n[1],l=n[4],u=n[7],c=n[2],h=n[5],f=n[8],d=r[0],p=r[3],m=r[6],g=r[1],v=r[4],_=r[7],x=r[2],y=r[5],b=r[8];return i[0]=a*d+o*g+A*x,i[3]=a*p+o*v+A*y,i[6]=a*m+o*_+A*b,i[1]=s*d+l*g+u*x,i[4]=s*p+l*v+u*y,i[7]=s*m+l*_+u*b,i[2]=c*d+h*g+f*x,i[5]=c*p+h*v+f*y,i[8]=c*m+h*_+f*b,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],r=t[2],i=t[3],a=t[4],o=t[5],A=t[6],s=t[7],l=t[8];return e*a*l-e*o*s-n*i*l+n*o*A+r*i*s-r*a*A}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],A=t[6],s=t[7],l=t[8],u=l*a-o*s,c=o*A-l*i,h=s*i-a*A,f=e*u+n*c+r*h;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const d=1/f;return t[0]=u*d,t[1]=(r*s-l*n)*d,t[2]=(o*n-r*a)*d,t[3]=c*d,t[4]=(l*e-r*A)*d,t[5]=(r*i-o*e)*d,t[6]=h*d,t[7]=(n*A-s*e)*d,t[8]=(a*e-n*i)*d,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).invert().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,r,i,a,o){const A=Math.cos(i),s=Math.sin(i);return this.set(n*A,n*s,-n*(A*a+s*o)+a+t,-r*s,r*A,-r*(-s*a+A*o)+o+e,0,0,1),this}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),r=this.elements,i=r[0],a=r[3],o=r[6],A=r[1],s=r[4],l=r[7];return r[0]=e*i+n*A,r[3]=e*a+n*s,r[6]=e*o+n*l,r[1]=-n*i+e*A,r[4]=-n*a+e*s,r[7]=-n*o+e*l,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}clone(){return(new this.constructor).fromArray(this.elements)}}function $(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function tt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function et(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function nt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const rt={[P]:{[L]:et},[L]:{[P]:nt}},it={legacyMode:!0,get workingColorSpace(){return L},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(rt[e]&&void 0!==rt[e][n]){const r=rt[e][n];return t.r=r(t.r),t.g=r(t.g),t.b=r(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},at={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},ot={r:0,g:0,b:0},At={h:0,s:0,l:0},st={h:0,s:0,l:0};function lt(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 ut(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class ct{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,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,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,it.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r="srgb-linear"){return this.r=t,this.g=e,this.b=n,it.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r="srgb-linear"){if(t=V(t,1),e=H(e,0,1),n=H(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=lt(i,r,t+1/3),this.g=lt(i,r,t),this.b=lt(i,r,t-1/3)}return it.toWorkingColorSpace(this,r),this}setStyle(t,e="srgb"){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=r[1],a=r[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,it.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,it.toWorkingColorSpace(this,e),n(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const r=parseFloat(t[1])/360,i=parseFloat(t[2])/100,a=parseFloat(t[3])/100;return n(t[4]),this.setHSL(r,i,a,e)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=r[1],n=t.length;if(3===n)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,it.toWorkingColorSpace(this,e),this;if(6===n)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,it.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=at[t.toLowerCase()];return void 0!==n?this.setHex(n,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}copySRGBToLinear(t){return this.r=et(t.r),this.g=et(t.g),this.b=et(t.b),this}copyLinearToSRGB(t){return this.r=nt(t.r),this.g=nt(t.g),this.b=nt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return it.fromWorkingColorSpace(ut(this,ot),t),H(255*ot.r,0,255)<<16^H(255*ot.g,0,255)<<8^H(255*ot.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){it.fromWorkingColorSpace(ut(this,ot),e);const n=ot.r,r=ot.g,i=ot.b,a=Math.max(n,r,i),o=Math.min(n,r,i);let A,s;const l=(o+a)/2;if(o===a)A=0,s=0;else{const t=a-o;switch(s=l<=.5?t/(a+o):t/(2-a-o),a){case n:A=(r-i)/t+(r<i?6:0);break;case r:A=(i-n)/t+2;break;case i:A=(n-r)/t+4}A/=6}return t.h=A,t.s=s,t.l=l,t}getRGB(t,e="srgb-linear"){return it.fromWorkingColorSpace(ut(this,ot),e),t.r=ot.r,t.g=ot.g,t.b=ot.b,t}getStyle(t="srgb"){return it.fromWorkingColorSpace(ut(this,ot),t),t!==P?`color(${t} ${ot.r} ${ot.g} ${ot.b})`:`rgb(${255*ot.r|0},${255*ot.g|0},${255*ot.b|0})`}offsetHSL(t,e,n){return this.getHSL(At),At.h+=t,At.s+=e,At.l+=n,this.setHSL(At.h,At.s,At.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(At),t.getHSL(st);const n=W(At.h,st.h,e),r=W(At.s,st.s,e),i=W(At.l,st.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let ht;ct.NAMES=at;class ft{static getDataURL(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===ht&&(ht=tt("canvas")),ht.width=t.width,ht.height=t.height;const n=ht.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ht}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=tt("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),i=r.data;for(let t=0;t<i.length;t++)i[t]=255*et(i[t]/255);return n.putImageData(r,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*et(e[t]/255)):e[t]=et(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class dt{constructor(t=null){this.isSource=!0,this.uuid=G(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(null!==r){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e<n;e++)r[e].isDataTexture?t.push(pt(r[e].image)):t.push(pt(r[e]))}else t=pt(r);n.url=t}return e||(t.images[this.uuid]=n),n}}function pt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ft.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let mt=0;class gt extends k{constructor(t=gt.DEFAULT_IMAGE,e=gt.DEFAULT_MAPPING,n=1001,r=1001,i=1006,a=1008,o=1023,A=1009,s=1,l=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:mt++}),this.uuid=G(),this.name="",this.source=new dt(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=s,this.format=o,this.internalFormat=null,this.type=A,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new K,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}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(t){return this.name=t.name,this.source=t.source,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.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(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,image:this.source.toJSON(t).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case s:t.x=t.x-Math.floor(t.x);break;case l:t.x=t.x<0?0:1;break;case u: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 s:t.y=t.y-Math.floor(t.y);break;case l:t.y=t.y<0?0:1;break;case u: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}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}gt.DEFAULT_IMAGE=null,gt.DEFAULT_MAPPING=300;class vt{constructor(t=0,e=0,n=0,r=1){vt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}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,r){return this.x=t,this.y=e,this.z=n,this.w=r,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){return 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){return 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}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.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,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,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,r,i;const a=.01,o=.1,A=t.elements,s=A[0],l=A[4],u=A[8],c=A[1],h=A[5],f=A[9],d=A[2],p=A[6],m=A[10];if(Math.abs(l-c)<a&&Math.abs(u-d)<a&&Math.abs(f-p)<a){if(Math.abs(l+c)<o&&Math.abs(u+d)<o&&Math.abs(f+p)<o&&Math.abs(s+h+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,A=(h+1)/2,g=(m+1)/2,v=(l+c)/4,_=(u+d)/4,x=(f+p)/4;return t>A&&t>g?t<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=v/n,i=_/n):A>g?A<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(A),n=v/r,i=x/r):g<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=_/i,r=x/i),this.set(n,r,i,e),this}let g=Math.sqrt((p-f)*(p-f)+(u-d)*(u-d)+(c-l)*(c-l));return Math.abs(g)<.001&&(g=1),this.x=(p-f)/g,this.y=(u-d)/g,this.z=(c-l)/g,this.w=Math.acos((s+h+m-1)/2),this}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.w=Math.min(this.w,t.w),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.w=Math.max(this.w,t.w),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.w=Math.max(t.w,Math.min(e.w,this.w)),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.w=Math.max(t,Math.min(e,this.w)),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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(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.w+=(t.w-this.w)*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.w=t.w+(e.w-t.w)*n,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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class _t extends k{constructor(t=1,e=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new vt(0,0,t,e),this.scissorTest=!1,this.viewport=new vt(0,0,t,e);const r={width:t,height:e,depth:1};this.texture=new gt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:h,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new dt(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class xt extends gt{constructor(t=null,e=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=c,this.minFilter=c,this.wrapR=l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class yt extends gt{constructor(t=null,e=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=c,this.minFilter=c,this.wrapR=l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class bt{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,i,a,o){let A=n[r+0],s=n[r+1],l=n[r+2],u=n[r+3];const c=i[a+0],h=i[a+1],f=i[a+2],d=i[a+3];if(0===o)return t[e+0]=A,t[e+1]=s,t[e+2]=l,void(t[e+3]=u);if(1===o)return t[e+0]=c,t[e+1]=h,t[e+2]=f,void(t[e+3]=d);if(u!==d||A!==c||s!==h||l!==f){let t=1-o;const e=A*c+s*h+l*f+u*d,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),a=Math.atan2(i,e*n);t=Math.sin(t*a)/i,o=Math.sin(o*a)/i}const i=o*n;if(A=A*t+c*i,s=s*t+h*i,l=l*t+f*i,u=u*t+d*i,t===1-o){const t=1/Math.sqrt(A*A+s*s+l*l+u*u);A*=t,s*=t,l*=t,u*=t}}t[e]=A,t[e+1]=s,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,a){const o=n[r],A=n[r+1],s=n[r+2],l=n[r+3],u=i[a],c=i[a+1],h=i[a+2],f=i[a+3];return t[e]=o*f+l*u+A*h-s*c,t[e+1]=A*f+l*c+s*u-o*h,t[e+2]=s*f+l*h+o*c-A*u,t[e+3]=l*f-o*u-A*c-s*h,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,r){return this._x=t,this._y=e,this._z=n,this._w=r,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){const n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,A=Math.sin,s=o(n/2),l=o(r/2),u=o(i/2),c=A(n/2),h=A(r/2),f=A(i/2);switch(a){case"XYZ":this._x=c*l*u+s*h*f,this._y=s*h*u-c*l*f,this._z=s*l*f+c*h*u,this._w=s*l*u-c*h*f;break;case"YXZ":this._x=c*l*u+s*h*f,this._y=s*h*u-c*l*f,this._z=s*l*f-c*h*u,this._w=s*l*u+c*h*f;break;case"ZXY":this._x=c*l*u-s*h*f,this._y=s*h*u+c*l*f,this._z=s*l*f+c*h*u,this._w=s*l*u-c*h*f;break;case"ZYX":this._x=c*l*u-s*h*f,this._y=s*h*u+c*l*f,this._z=s*l*f-c*h*u,this._w=s*l*u+c*h*f;break;case"YZX":this._x=c*l*u+s*h*f,this._y=s*h*u+c*l*f,this._z=s*l*f-c*h*u,this._w=s*l*u-c*h*f;break;case"XZY":this._x=c*l*u-s*h*f,this._y=s*h*u-c*l*f,this._z=s*l*f+c*h*u,this._w=s*l*u+c*h*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],A=e[9],s=e[2],l=e[6],u=e[10],c=n+o+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-A)*t,this._y=(i-s)*t,this._z=(a-r)*t}else if(n>o&&n>u){const t=2*Math.sqrt(1+n-o-u);this._w=(l-A)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(i+s)/t}else if(o>u){const t=2*Math.sqrt(1+o-n-u);this._w=(i-s)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(A+l)/t}else{const t=2*Math.sqrt(1+u-n-o);this._w=(a-r)/t,this._x=(i+s)/t,this._y=(A+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(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(H(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),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(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){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,A=e._y,s=e._z,l=e._w;return this._x=n*l+a*o+r*s-i*A,this._y=r*l+a*A+i*o-n*s,this._z=i*l+a*s+n*A-r*o,this._w=a*l-n*o-r*A-i*s,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;const A=1-o*o;if(A<=Number.EPSILON){const t=1-e;return th